/* BFD semi-generic back-end for a.out binaries.
- Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+ Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
execp = abfd->tdata.aout_data->a.hdr;
/* Set the file flags */
- abfd->flags = NO_FLAGS;
+ abfd->flags = BFD_NO_FLAGS;
if (execp->a_drsize || execp->a_trsize)
abfd->flags |= HAS_RELOC;
/* Setting of EXEC_P has been deferred to the bottom of this function */
*unknown = false;
break;
- /* start-sanitize-rce */
- case bfd_arch_rce:
- arch_flags = M_RCE;
- break;
- /* end-sanitize-rce */
-
default:
arch_flags = M_UNKNOWN;
}
syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
#else
/* We allocate using malloc to make the values easy to free
- later on. If we put them on the obstack it might not be
+ later on. If we put them on the objalloc it might not be
possible to free them. */
syms = ((struct external_nlist *)
bfd_malloc ((size_t) count * EXTERNAL_NLIST_SIZE));
#endif /* 0 */
+ switch (cache_ptr->type & N_TYPE)
+ {
+ case N_SETA:
+ cache_ptr->symbol.section = bfd_abs_section_ptr;
+ break;
+ case N_SETT:
+ cache_ptr->symbol.section = obj_textsec (abfd);
+ break;
+ case N_SETD:
+ cache_ptr->symbol.section = obj_datasec (abfd);
+ break;
+ case N_SETB:
+ cache_ptr->symbol.section = obj_bsssec (abfd);
+ break;
+ }
+
cache_ptr->symbol.flags |= BSF_CONSTRUCTOR;
}
break;
/* This case occurs, e.g., for the *DEBUG* section of a COFF
file. */
(*_bfd_error_handler)
- ("%s: can not represent section `%s' in a.out object file format",
- bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
+ ("%s: can not represent section for symbol `%s' in a.out object file format",
+ bfd_get_filename (abfd),
+ cache_ptr->name != NULL ? cache_ptr->name : "*unknown*");
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
aout_symbol_type *q = (aout_symbol_type *)(*p);
next:
switch (q->type){
+ case N_TEXT:
+ /* If this looks like a file name symbol, and it comes after
+ the line number we have found so far, but before the
+ offset, then we have probably not found the right line
+ number. */
+ if (q->symbol.value <= offset
+ && ((q->symbol.value > low_line_vma
+ && (line_file_name != NULL
+ || *line_ptr != 0))
+ || (q->symbol.value > low_func_vma
+ && func != NULL)))
+ {
+ const char *symname;
+
+ symname = q->symbol.name;
+ if (strcmp (symname + strlen (symname) - 2, ".o") == 0)
+ {
+ if (q->symbol.value > low_line_vma)
+ {
+ *line_ptr = 0;
+ line_file_name = NULL;
+ }
+ if (q->symbol.value > low_func_vma)
+ func = NULL;
+ }
+ }
+ break;
+
case N_SO:
+ /* If this symbol is less than the offset, but greater than
+ the line number we have found so far, then we have not
+ found the right line number. */
+ if (q->symbol.value <= offset)
+ {
+ if (q->symbol.value > low_line_vma)
+ {
+ *line_ptr = 0;
+ line_file_name = NULL;
+ }
+ if (q->symbol.value > low_func_vma)
+ func = NULL;
+ }
+
main_file_name = current_file_name = q->symbol.name;
/* Look ahead to next symbol to check if that too is an N_SO. */
p++;
adata (abfd).line_buf = buf = NULL;
else
{
- buf = (char *) bfd_malloc (filelen + funclen + 2);
+ buf = (char *) bfd_malloc (filelen + funclen + 3);
adata (abfd).line_buf = buf;
if (buf == NULL)
return false;
case discard_none:
break;
case discard_l:
- if (*name == *finfo->info->lprefix
- && (finfo->info->lprefix_len == 1
- || strncmp (name, finfo->info->lprefix,
- finfo->info->lprefix_len) == 0))
+ if ((type & N_STAB) == 0
+ && bfd_is_local_label_name (input_bfd, name))
skip = true;
break;
case discard_all:
{
/* We are generating a relocateable output file, and must
modify the reloc accordingly. */
- if (r_extern)
+ if (r_extern
+ || r_type == RELOC_BASE10
+ || r_type == RELOC_BASE13
+ || r_type == RELOC_BASE22)
{
/* If we know the symbol this relocation is against,
convert it into a relocation against a section. This
is what the native linker does. */
- h = sym_hashes[r_index];
+ if (r_type == RELOC_BASE10
+ || r_type == RELOC_BASE13
+ || r_type == RELOC_BASE22)
+ h = NULL;
+ else
+ h = sym_hashes[r_index];
if (h != (struct aout_link_hash_entry *) NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
}
/* As described above, we must always adjust a PC relative
- reloc by the change in VMA of the source. */
- if (howto_table_ext[r_type].pc_relative)
+ reloc by the change in VMA of the source. However, if
+ pcrel_offset is set, then the addend does not include the
+ location within the section, in which case we don't need
+ to adjust anything. */
+ if (howto_table_ext[r_type].pc_relative
+ && ! howto_table_ext[r_type].pcrel_offset)
relocation -= (input_section->output_section->vma
+ input_section->output_offset
- input_section->vma);