@B restore 0e9acdc7ec
This commit is contained in:
parent
738025ab43
commit
4c5b7af9c9
|
@ -1411,7 +1411,6 @@ amiga_write_object_contents (abfd)
|
|||
int *index_map,max_hunk=-1;
|
||||
sec_ptr data_sec,p;
|
||||
unsigned long i,n[5];
|
||||
sec_ptr text_sec = 0;
|
||||
|
||||
/* Distinguish UNITS, LOAD Files
|
||||
Write out hunks+relocs+HUNK_EXT+HUNK_DEBUG (GNU format) */
|
||||
|
@ -1423,27 +1422,6 @@ amiga_write_object_contents (abfd)
|
|||
if (!index_map)
|
||||
return FALSE;
|
||||
|
||||
for (idx = 0, p = abfd->sections; p != NULL; p = p->next)
|
||||
if (!strcmp(p->name, ".bss") && !strcmp(p->output_section->name, ".text"))
|
||||
text_sec = p->output_section;
|
||||
|
||||
if (text_sec)
|
||||
for (idx = 0, p = abfd->sections; p != NULL; p = p->next)
|
||||
if (strcmp(p->name, ".text") && p->_raw_size)
|
||||
{
|
||||
unsigned ns = text_sec->_raw_size + p->_raw_size;
|
||||
char * c = (char *)bfd_zalloc(abfd, ns);
|
||||
memcpy(c, text_sec->contents, text_sec->_raw_size);
|
||||
if (p->contents)
|
||||
memcpy(c + text_sec->_raw_size, p->contents, p->_raw_size);
|
||||
text_sec->contents = c;
|
||||
text_sec->_raw_size = ns;
|
||||
p->_raw_size = 0;
|
||||
text_sec->_cooked_size += p->_cooked_size;
|
||||
p->_cooked_size = 0;
|
||||
}
|
||||
|
||||
|
||||
for (idx=0, p=abfd->sections; p!=NULL; p=p->next)
|
||||
index_map[idx++] = p->index;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ the sun3 backend only in these details:
|
|||
o The routine to get the relocated section contents is
|
||||
@code{get_relocated_section_contents}.
|
||||
|
||||
This ensures that the link is performed properly, but has the side effect of
|
||||
loosing performance.
|
||||
|
||||
The amiga bfd code uses the same functions since they check for the used flavour.
|
||||
|
@ -114,6 +115,7 @@ my_add_to PARAMS ((arelent *, PTR, int, int));
|
|||
static void amiga_update_target_section PARAMS ((sec_ptr));
|
||||
static bfd_reloc_status_type
|
||||
amiga_perform_reloc PARAMS ((bfd *, arelent *, PTR, sec_ptr, bfd *, char **));
|
||||
static void aout_update_target_section PARAMS ((sec_ptr));
|
||||
static bfd_reloc_status_type
|
||||
aout_perform_reloc PARAMS ((bfd *, arelent *, PTR, sec_ptr, bfd *, char **));
|
||||
static bfd_boolean
|
||||
|
@ -371,35 +373,6 @@ amiga_update_target_section (target_section)
|
|||
}
|
||||
}
|
||||
|
||||
/* For pc-relative linking place .bss symbols in the .data section.
|
||||
* Then place all .data symbols into .text section
|
||||
*/
|
||||
static void
|
||||
amiga_update_target_section_pcrel(target_section)
|
||||
sec_ptr target_section;
|
||||
{
|
||||
amiga_update_target_section(target_section);
|
||||
/* If target->out is .data, add the value of the .text section to
|
||||
sym->value and set new output_section */
|
||||
/* If we access a symbol in the .data section, we have to convert
|
||||
this to an access to .text section */
|
||||
/* This is done through a change to the output section of
|
||||
the symbol.. */
|
||||
if (!strcmp(target_section->output_section->name, ".data"))
|
||||
{
|
||||
/* get value for .data section */
|
||||
bfd *ibfd;
|
||||
sec_ptr s;
|
||||
|
||||
ibfd = target_section->output_section->owner;
|
||||
for (s = ibfd->sections; s != NULL; s = s->next)
|
||||
if (!strcmp(s->name, ".text"))
|
||||
{
|
||||
target_section->output_offset += s->_raw_size;
|
||||
target_section->output_section = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Perform an Amiga relocation */
|
||||
static bfd_reloc_status_type
|
||||
|
@ -479,18 +452,13 @@ amiga_perform_reloc (abfd, r, data, sec, obfd, error_message)
|
|||
{
|
||||
ret=bfd_reloc_undefined;
|
||||
}
|
||||
#if 0
|
||||
else if (sec->output_section!=target_section->output_section) /* Error */
|
||||
{
|
||||
DPRINT(5,("pc relative, but out-of-range\n"));
|
||||
ret=bfd_reloc_outofrange;
|
||||
}
|
||||
#endif
|
||||
else /* Same section */
|
||||
{
|
||||
if (sec->output_section != target_section->output_section)
|
||||
amiga_update_target_section_pcrel(target_section);
|
||||
|
||||
DPRINT(5,("PC relative\n"));
|
||||
relocation = sym->value + target_section->output_offset
|
||||
- (r->address + sec->output_offset);
|
||||
|
@ -552,6 +520,34 @@ amiga_perform_reloc (abfd, r, data, sec, obfd, error_message)
|
|||
}
|
||||
|
||||
|
||||
/* For base-relative linking place .bss symbols in the .data section. */
|
||||
static void
|
||||
aout_update_target_section (target_section)
|
||||
sec_ptr target_section;
|
||||
{
|
||||
/* If target->out is .bss, add the value of the .data section to
|
||||
sym->value and set new output_section */
|
||||
/* If we access a symbol in the .bss section, we have to convert
|
||||
this to an access to .data section */
|
||||
/* This is done through a change to the output section of
|
||||
the symbol.. */
|
||||
if (!strcmp(target_section->output_section->name,".bss"))
|
||||
{
|
||||
/* get value for .data section */
|
||||
bfd *ibfd;
|
||||
sec_ptr s;
|
||||
|
||||
ibfd=target_section->output_section->owner;
|
||||
for (s=ibfd->sections;s!=NULL;s=s->next)
|
||||
if (!strcmp(s->name,".data"))
|
||||
{
|
||||
target_section->output_offset+=s->_raw_size;
|
||||
target_section->output_section=s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Perform an a.out relocation */
|
||||
static bfd_reloc_status_type
|
||||
aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
|
||||
|
@ -648,7 +644,7 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
|
|||
else
|
||||
{
|
||||
if (amiga_base_relative)
|
||||
amiga_update_target_section (target_section);
|
||||
aout_update_target_section (target_section);
|
||||
relocation=0;
|
||||
copy=TRUE;
|
||||
}
|
||||
|
@ -665,21 +661,15 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
|
|||
case H_PC32:
|
||||
if (bfd_is_abs_section(target_section)) /* Ref to absolute hunk */
|
||||
relocation=sym->value;
|
||||
#if 0
|
||||
else if (sec->output_section!=target_section->output_section) /* Error */
|
||||
{
|
||||
DPRINT(5,("pc relative, but out-of-range\n"));
|
||||
ret=bfd_reloc_outofrange;
|
||||
}
|
||||
#endif
|
||||
else /* Same section */
|
||||
{
|
||||
if (sec->output_section != target_section->output_section)
|
||||
amiga_update_target_section_pcrel(target_section);
|
||||
relocation = sym->value + target_section->output_offset
|
||||
- sec->output_offset
|
||||
+ r->addend
|
||||
;
|
||||
- sec->output_offset;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -709,7 +699,7 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message)
|
|||
}
|
||||
else /* Target section and sec need not be the same.. */
|
||||
{
|
||||
amiga_update_target_section (target_section);
|
||||
aout_update_target_section (target_section);
|
||||
|
||||
relocation = sym->value + target_section->output_offset
|
||||
- (AMIGA_DATA(target_section->output_section->owner))->a4init;
|
||||
|
|
|
@ -1865,8 +1865,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
|
|||
/* Ignore a redefinition of an absolute symbol to the
|
||||
same value; it's harmless. */
|
||||
if (h->type == bfd_link_hash_defined
|
||||
&& ((bfd_is_abs_section (msec)
|
||||
&& bfd_is_abs_section (section)) || msec == section)
|
||||
&& bfd_is_abs_section (msec)
|
||||
&& bfd_is_abs_section (section)
|
||||
&& value == mval)
|
||||
break;
|
||||
|
||||
|
|
|
@ -76,15 +76,12 @@ static int dump_debugging; /* --debugging */
|
|||
static bfd_vma adjust_section_vma = 0; /* --adjust-vma */
|
||||
static int file_start_context = 0; /* --file-start-context */
|
||||
|
||||
static int flag_re_source = 0; /* -X, --re-source */
|
||||
|
||||
/* Extra info to pass to the disassembler address printing function. */
|
||||
struct objdump_disasm_info
|
||||
{
|
||||
bfd *abfd;
|
||||
asection *sec;
|
||||
bfd_boolean require_sec;
|
||||
bfd_boolean rts;
|
||||
};
|
||||
|
||||
/* Architecture to disassemble for, or default if NULL. */
|
||||
|
@ -167,7 +164,7 @@ static int objdump_symbol_at_address
|
|||
PARAMS ((bfd_vma, struct disassemble_info *));
|
||||
static void show_line
|
||||
PARAMS ((bfd *, asection *, bfd_vma));
|
||||
static bfd_vma disassemble_bytes
|
||||
static void disassemble_bytes
|
||||
PARAMS ((struct disassemble_info *, disassembler_ftype, bfd_boolean,
|
||||
bfd_byte *, bfd_vma, bfd_vma, arelent ***, arelent **));
|
||||
static void disassemble_data
|
||||
|
@ -236,7 +233,6 @@ usage (stream, status)
|
|||
`lucid', `arm', `hp', `edg', `gnu-v3', `java'\n\
|
||||
or `gnat'\n\
|
||||
-w, --wide Format output for more than 80 columns\n\
|
||||
-X, --re-source Generate asm style output\n\
|
||||
-z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n\
|
||||
--start-address=ADDR Only process data whose address is >= ADDR\n\
|
||||
--stop-address=ADDR Only process data whose address is <= ADDR\n\
|
||||
|
@ -287,7 +283,6 @@ static struct option long_options[]=
|
|||
{"no-show-raw-insn", no_argument, &show_raw_insn, -1},
|
||||
{"prefix-addresses", no_argument, &prefix_addresses, 1},
|
||||
{"reloc", no_argument, NULL, 'r'},
|
||||
{"re-source", no_argument, NULL, 'X'},
|
||||
{"section", required_argument, NULL, 'j'},
|
||||
{"section-headers", no_argument, NULL, 'h'},
|
||||
{"show-raw-insn", no_argument, &show_raw_insn, 1},
|
||||
|
@ -821,7 +816,6 @@ objdump_print_addr_with_sym (abfd, sec, sym, vma, info, skip_zeroes)
|
|||
struct disassemble_info *info;
|
||||
bfd_boolean skip_zeroes;
|
||||
{
|
||||
if (!flag_re_source)
|
||||
objdump_print_value (vma, info, skip_zeroes);
|
||||
|
||||
if (sym == NULL)
|
||||
|
@ -845,7 +839,6 @@ objdump_print_addr_with_sym (abfd, sec, sym, vma, info, skip_zeroes)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!flag_re_source)
|
||||
(*info->fprintf_func) (info->stream, " <");
|
||||
objdump_print_symname (abfd, info, sym);
|
||||
if (bfd_asymbol_value (sym) > vma)
|
||||
|
@ -858,8 +851,7 @@ objdump_print_addr_with_sym (abfd, sec, sym, vma, info, skip_zeroes)
|
|||
(*info->fprintf_func) (info->stream, "+0x");
|
||||
objdump_print_value (vma - bfd_asymbol_value (sym), info, TRUE);
|
||||
}
|
||||
if (!flag_re_source)
|
||||
(*info->fprintf_func) (info->stream, ">");
|
||||
(*info->fprintf_func) (info->stream, ">");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -921,65 +913,6 @@ objdump_symbol_at_address (vma, info)
|
|||
return (sym != NULL && (bfd_asymbol_value (sym) == vma));
|
||||
}
|
||||
|
||||
|
||||
/* This function is used to print to the bit-bucket. */
|
||||
static int
|
||||
#ifdef __STDC__
|
||||
dummy_printer(FILE *file ATTRIBUTE_UNUSED,
|
||||
const char *format ATTRIBUTE_UNUSED, ...)
|
||||
#else
|
||||
dummy_printer(file)
|
||||
FILE *file ATTRIBUTE_UNUSED;
|
||||
#endif
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* Add a synthetic symbol to the sorted symbols.
|
||||
* Derived from the current symbol.
|
||||
*/
|
||||
static asymbol * current_symbol;
|
||||
static unsigned dummy_symbol_counter;
|
||||
bfd_boolean mark_local;
|
||||
bfd_boolean mark_skip;
|
||||
static void
|
||||
objdump_add_synthetic_symbol(bfd_vma vma, struct disassemble_info *info)
|
||||
{
|
||||
static char buf[512];
|
||||
asymbol *new_symbol;
|
||||
long place = 0;
|
||||
|
||||
if (mark_skip)
|
||||
{
|
||||
mark_skip = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
struct objdump_disasm_info *aux =
|
||||
(struct objdump_disasm_info *) info->application_data;
|
||||
|
||||
new_symbol = find_symbol_for_address(aux->sec->owner, aux->sec, vma,
|
||||
TRUE, &place);
|
||||
if (new_symbol && new_symbol->section == info->section && new_symbol->value == vma)
|
||||
return;
|
||||
|
||||
|
||||
++sorted_symcount;
|
||||
sorted_syms = (asymbol **)xrealloc(sorted_syms, sorted_symcount * sizeof(asymbol *));
|
||||
sorted_syms[sorted_symcount - 1] = new_symbol = (asymbol *)xmalloc(sizeof(asymbol));
|
||||
*new_symbol = *current_symbol;
|
||||
new_symbol->section = aux->sec;
|
||||
new_symbol->value = vma;
|
||||
sprintf(buf, ".%s_%d", current_symbol->name, ++dummy_symbol_counter);
|
||||
new_symbol->name = xstrdup(buf);
|
||||
if (mark_local)
|
||||
{
|
||||
new_symbol->flags |= BSF_LOCAL;
|
||||
mark_local = 0;
|
||||
}
|
||||
/* Sort the symbols into section and symbol order. */
|
||||
qsort(sorted_syms, sorted_symcount, sizeof(asymbol *), compare_symbols);
|
||||
}
|
||||
|
||||
/* Hold the last function name and the last line number we displayed
|
||||
in a disassembly. */
|
||||
|
||||
|
@ -1252,7 +1185,7 @@ objdump_sprintf VPARAMS ((SFILE *f, const char *format, ...))
|
|||
|
||||
/* Disassemble some data in memory between given values. */
|
||||
|
||||
static bfd_vma
|
||||
static void
|
||||
disassemble_bytes (info, disassemble_fn, insns, data,
|
||||
start_offset, stop_offset, relppp,
|
||||
relppend)
|
||||
|
@ -1286,7 +1219,7 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
zeroes in chunks of 4, ensuring that there is always a leading
|
||||
zero remaining. */
|
||||
skip_addr_chars = 0;
|
||||
if (! prefix_addresses && !flag_re_source)
|
||||
if (! prefix_addresses)
|
||||
{
|
||||
char buf[30];
|
||||
char *s;
|
||||
|
@ -1354,17 +1287,14 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
|
||||
if (! prefix_addresses)
|
||||
{
|
||||
if (!flag_re_source)
|
||||
{
|
||||
char *s;
|
||||
char *s;
|
||||
|
||||
bfd_sprintf_vma(aux->abfd, buf, section->vma + addr_offset);
|
||||
for (s = buf + skip_addr_chars; *s == '0'; s++)
|
||||
*s = ' ';
|
||||
if (*s == '\0')
|
||||
*--s = '0';
|
||||
printf("%s:\t", buf + skip_addr_chars);
|
||||
}
|
||||
bfd_sprintf_vma (aux->abfd, buf, section->vma + addr_offset);
|
||||
for (s = buf + skip_addr_chars; *s == '0'; s++)
|
||||
*s = ' ';
|
||||
if (*s == '\0')
|
||||
*--s = '0';
|
||||
printf ("%s:\t", buf + skip_addr_chars);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1376,12 +1306,10 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
|
||||
if (insns)
|
||||
{
|
||||
fprintf_ftype saved_fprintf_func = info->fprintf_func;
|
||||
sfile.size = 120;
|
||||
sfile.buffer = xmalloc (sfile.size);
|
||||
sfile.current = sfile.buffer;
|
||||
|
||||
info->fprintf_func = (fprintf_ftype) objdump_sprintf;
|
||||
info->fprintf_func = (fprintf_ftype) objdump_sprintf;
|
||||
info->stream = (FILE *) &sfile;
|
||||
info->bytes_per_line = 0;
|
||||
info->bytes_per_chunk = 0;
|
||||
|
@ -1418,10 +1346,8 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
info->flags = 0;
|
||||
|
||||
octets = (*disassemble_fn) (section->vma + addr_offset, info);
|
||||
|
||||
info->fprintf_func = saved_fprintf_func;
|
||||
info->fprintf_func = (fprintf_ftype) fprintf;
|
||||
info->stream = stdout;
|
||||
|
||||
if (info->bytes_per_line != 0)
|
||||
octets_per_line = info->bytes_per_line;
|
||||
if (octets < 0)
|
||||
|
@ -1467,38 +1393,33 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
else
|
||||
bpc = 1;
|
||||
|
||||
if (!flag_re_source)
|
||||
{
|
||||
for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
|
||||
{
|
||||
int k;
|
||||
if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
|
||||
{
|
||||
for (k = bpc - 1; k >= 0; k--)
|
||||
printf("%02x", (unsigned)data[j + k]);
|
||||
putchar(' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
for (k = 0; k < bpc; k++)
|
||||
printf("%02x", (unsigned)data[j + k]);
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
|
||||
{
|
||||
int k;
|
||||
if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
|
||||
{
|
||||
for (k = bpc - 1; k >= 0; k--)
|
||||
printf ("%02x", (unsigned) data[j + k]);
|
||||
putchar (' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
for (k = 0; k < bpc; k++)
|
||||
printf ("%02x", (unsigned) data[j + k]);
|
||||
putchar (' ');
|
||||
}
|
||||
}
|
||||
|
||||
for (; pb < octets_per_line; pb += bpc)
|
||||
{
|
||||
int k;
|
||||
for (; pb < octets_per_line; pb += bpc)
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k < bpc; k++)
|
||||
printf (" ");
|
||||
putchar (' ');
|
||||
}
|
||||
|
||||
for (k = 0; k < bpc; k++)
|
||||
printf(" ");
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
/* Separate raw data from instruction by extra space. */
|
||||
if (insns < 0)
|
||||
{
|
||||
} else
|
||||
if (insns)
|
||||
putchar ('\t');
|
||||
else
|
||||
|
@ -1508,15 +1429,14 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
if (! insns)
|
||||
printf ("%s", buf);
|
||||
else
|
||||
if (insns > 0)
|
||||
{
|
||||
printf ("%s", sfile.buffer);
|
||||
free (sfile.buffer);
|
||||
}
|
||||
|
||||
if (!flag_re_source && (prefix_addresses
|
||||
if (prefix_addresses
|
||||
? show_raw_insn > 0
|
||||
: show_raw_insn >= 0))
|
||||
: show_raw_insn >= 0)
|
||||
{
|
||||
while (pb < octets)
|
||||
{
|
||||
|
@ -1557,19 +1477,15 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
}
|
||||
|
||||
if (!wide_output)
|
||||
{
|
||||
if (insns >= 0)
|
||||
putchar('\n');
|
||||
}
|
||||
putchar ('\n');
|
||||
else
|
||||
need_nl = TRUE;
|
||||
}
|
||||
|
||||
if ((section->flags & SEC_RELOC) != 0
|
||||
#ifndef DISASSEMBLER_NEEDS_RELOCS
|
||||
&& dump_reloc_info
|
||||
&& dump_reloc_info
|
||||
#endif
|
||||
&& !flag_re_source
|
||||
)
|
||||
{
|
||||
while ((*relppp) < relppend
|
||||
|
@ -1631,15 +1547,7 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
printf ("\n");
|
||||
|
||||
addr_offset += octets / opb;
|
||||
|
||||
if (((struct objdump_disasm_info *) info->application_data)->rts)
|
||||
{
|
||||
((struct objdump_disasm_info *) info->application_data)->rts = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return addr_offset;
|
||||
}
|
||||
|
||||
/* Disassemble the contents of an object file. */
|
||||
|
@ -1674,7 +1582,6 @@ disassemble_data (abfd)
|
|||
disasm_info.application_data = (PTR) &aux;
|
||||
aux.abfd = abfd;
|
||||
aux.require_sec = FALSE;
|
||||
aux.rts = FALSE;
|
||||
disasm_info.print_address_func = objdump_print_address;
|
||||
disasm_info.symbol_at_address_func = objdump_symbol_at_address;
|
||||
|
||||
|
@ -1780,10 +1687,8 @@ disassemble_data (abfd)
|
|||
++relpp;
|
||||
}
|
||||
}
|
||||
if (flag_re_source)
|
||||
printf(_("\tsection %s:\n"), section->name);
|
||||
else
|
||||
printf (_("Disassembly of section %s:\n"), section->name);
|
||||
|
||||
printf (_("Disassembly of section %s:\n"), section->name);
|
||||
|
||||
datasize = bfd_get_section_size_before_reloc (section);
|
||||
if (datasize == 0)
|
||||
|
@ -1817,40 +1722,6 @@ disassemble_data (abfd)
|
|||
stop_offset = disasm_info.buffer_length / opb;
|
||||
}
|
||||
|
||||
if (flag_re_source && (section->flags & BSF_KEEP))
|
||||
{
|
||||
arelent **myrelpp = relpp;
|
||||
disasm_info.fprintf_func = (fprintf_ftype)dummy_printer;
|
||||
disasm_info.print_address_func = &objdump_add_synthetic_symbol;
|
||||
|
||||
for (unsigned long pos = addr_offset, end = addr_offset; pos < stop_offset;)
|
||||
{
|
||||
current_symbol = find_symbol_for_address(abfd, section, section->vma + pos,
|
||||
TRUE, &place);
|
||||
|
||||
while (place < sorted_symcount) {
|
||||
asymbol * s = sorted_syms[place];
|
||||
if (s->section == section && s->value > pos && s->name[0] != '.')
|
||||
{
|
||||
end = s->value;
|
||||
break;
|
||||
}
|
||||
++place;
|
||||
}
|
||||
if (place == sorted_symcount)
|
||||
pos = stop_offset;
|
||||
|
||||
dummy_symbol_counter = 0;
|
||||
disassemble_bytes(&disasm_info, disassemble_fn, -1, data,
|
||||
pos, end, &myrelpp, relppend);
|
||||
|
||||
pos = end;
|
||||
}
|
||||
disasm_info.print_address_func = objdump_print_address;
|
||||
disasm_info.fprintf_func = (fprintf_ftype)fprintf;
|
||||
}
|
||||
|
||||
|
||||
sym = find_symbol_for_address (abfd, section, section->vma + addr_offset,
|
||||
TRUE, &place);
|
||||
|
||||
|
@ -1926,30 +1797,21 @@ disassemble_data (abfd)
|
|||
rather than a function, just dump the bytes without
|
||||
disassembling them. */
|
||||
if (disassemble_all
|
||||
|| sym == NULL
|
||||
|| bfd_asymbol_value(sym) > section->vma + addr_offset
|
||||
|| ((sym->flags & BSF_OBJECT) == 0
|
||||
&& (strstr(bfd_asymbol_name(sym), "gnu_compiled")
|
||||
== NULL)
|
||||
&& (strstr(bfd_asymbol_name(sym), "gcc2_compiled")
|
||||
== NULL))
|
||||
|| (sym->flags & BSF_FUNCTION) != 0)
|
||||
#ifdef TARGET_AMIGA
|
||||
insns = (section->flags & BSF_KEEP) != 0 && (sym->flags & BSF_LOCAL) == 0;
|
||||
#else
|
||||
|| sym == NULL
|
||||
|| bfd_asymbol_value (sym) > section->vma + addr_offset
|
||||
|| ((sym->flags & BSF_OBJECT) == 0
|
||||
&& (strstr (bfd_asymbol_name (sym), "gnu_compiled")
|
||||
== NULL)
|
||||
&& (strstr (bfd_asymbol_name (sym), "gcc2_compiled")
|
||||
== NULL))
|
||||
|| (sym->flags & BSF_FUNCTION) != 0)
|
||||
insns = TRUE;
|
||||
#endif
|
||||
else
|
||||
insns = FALSE;
|
||||
|
||||
addr_offset = disassemble_bytes (&disasm_info, disassemble_fn, insns, data,
|
||||
disassemble_bytes (&disasm_info, disassemble_fn, insns, data,
|
||||
addr_offset, nextstop_offset, &relpp, relppend);
|
||||
|
||||
if (addr_offset < nextstop_offset)
|
||||
disassemble_bytes(&disasm_info, disassemble_fn, 0, data,
|
||||
addr_offset, nextstop_offset, &relpp, relppend);
|
||||
|
||||
|
||||
addr_offset = nextstop_offset;
|
||||
sym = nextsym;
|
||||
}
|
||||
|
@ -2785,7 +2647,7 @@ main (argc, argv)
|
|||
bfd_init ();
|
||||
set_default_bfd_target ();
|
||||
|
||||
while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSj:wE:zgGX",
|
||||
while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSj:wE:zgG",
|
||||
long_options, (int *) 0))
|
||||
!= EOF)
|
||||
{
|
||||
|
@ -2793,9 +2655,6 @@ main (argc, argv)
|
|||
{
|
||||
case 0:
|
||||
break; /* We've been given a long option. */
|
||||
case 'X':
|
||||
flag_re_source = 1;
|
||||
break;
|
||||
case 'm':
|
||||
machine = optarg;
|
||||
break;
|
||||
|
|
153
ld/ldlang.c
153
ld/ldlang.c
|
@ -1532,10 +1532,7 @@ load_symbols (entry, place)
|
|||
char **matching;
|
||||
|
||||
if (entry->loaded)
|
||||
{
|
||||
bfd_link_add_symbols (entry->the_bfd, &link_info);
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
ldfile_open_file (entry);
|
||||
|
||||
|
@ -1987,106 +1984,82 @@ ldlang_open_output (statement)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Count the undefined symbols.
|
||||
*/
|
||||
static unsigned
|
||||
count_undef (void)
|
||||
{
|
||||
unsigned count = 0;
|
||||
for (struct bfd_link_hash_entry * p = link_info.hash->undefs; p; p = p->next)
|
||||
{
|
||||
if (p->type == bfd_link_hash_undefined || p->type == bfd_link_hash_undefweak)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/* Open all the input files. */
|
||||
|
||||
static void
|
||||
open_input_bfds (_s, force)
|
||||
lang_statement_union_type *_s;
|
||||
open_input_bfds (s, force)
|
||||
lang_statement_union_type *s;
|
||||
bfd_boolean force;
|
||||
{
|
||||
/* SBF: add more passes to resolve symbols with already loaded libs / files.
|
||||
* Stop is count of undefined symbols does not change.
|
||||
*/
|
||||
for (unsigned pass = 0; _s;)
|
||||
for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
|
||||
{
|
||||
for (lang_statement_union_type *s = _s; s != (lang_statement_union_type *) NULL; s = s->header.next)
|
||||
switch (s->header.type)
|
||||
{
|
||||
if (pass && s->header.type != lang_input_statement_enum)
|
||||
continue;
|
||||
case lang_constructors_statement_enum:
|
||||
open_input_bfds (constructor_list.head, force);
|
||||
break;
|
||||
case lang_output_section_statement_enum:
|
||||
open_input_bfds (s->output_section_statement.children.head, force);
|
||||
break;
|
||||
case lang_wild_statement_enum:
|
||||
/* Maybe we should load the file's symbols. */
|
||||
if (s->wild_statement.filename
|
||||
&& ! wildcardp (s->wild_statement.filename))
|
||||
(void) lookup_name (s->wild_statement.filename);
|
||||
open_input_bfds (s->wild_statement.children.head, force);
|
||||
break;
|
||||
case lang_group_statement_enum:
|
||||
{
|
||||
struct bfd_link_hash_entry *undefs;
|
||||
|
||||
switch (s->header.type)
|
||||
{
|
||||
case lang_constructors_statement_enum:
|
||||
open_input_bfds (constructor_list.head, force);
|
||||
break;
|
||||
case lang_output_section_statement_enum:
|
||||
open_input_bfds (s->output_section_statement.children.head, force);
|
||||
break;
|
||||
case lang_wild_statement_enum:
|
||||
/* Maybe we should load the file's symbols. */
|
||||
if (s->wild_statement.filename && !wildcardp (s->wild_statement.filename))
|
||||
(void) lookup_name (s->wild_statement.filename);
|
||||
open_input_bfds (s->wild_statement.children.head, force);
|
||||
break;
|
||||
case lang_group_statement_enum:
|
||||
/* We must continually search the entries in the group
|
||||
until no new symbols are added to the list of undefined
|
||||
symbols. */
|
||||
|
||||
do
|
||||
{
|
||||
struct bfd_link_hash_entry *undefs;
|
||||
|
||||
/* We must continually search the entries in the group
|
||||
until no new symbols are added to the list of undefined
|
||||
symbols. */
|
||||
|
||||
do
|
||||
{
|
||||
undefs = link_info.hash->undefs_tail;
|
||||
open_input_bfds (s->group_statement.children.head, TRUE);
|
||||
}
|
||||
while (undefs != link_info.hash->undefs_tail);
|
||||
undefs = link_info.hash->undefs_tail;
|
||||
open_input_bfds (s->group_statement.children.head, TRUE);
|
||||
}
|
||||
break;
|
||||
case lang_target_statement_enum:
|
||||
current_target = s->target_statement.target;
|
||||
break;
|
||||
case lang_input_statement_enum:
|
||||
if (s->input_statement.real)
|
||||
while (undefs != link_info.hash->undefs_tail);
|
||||
}
|
||||
break;
|
||||
case lang_target_statement_enum:
|
||||
current_target = s->target_statement.target;
|
||||
break;
|
||||
case lang_input_statement_enum:
|
||||
if (s->input_statement.real)
|
||||
{
|
||||
lang_statement_list_type add;
|
||||
|
||||
s->input_statement.target = current_target;
|
||||
|
||||
/* If we are being called from within a group, and this
|
||||
is an archive which has already been searched, then
|
||||
force it to be researched unless the whole archive
|
||||
has been loaded already. */
|
||||
if (force
|
||||
&& !s->input_statement.whole_archive
|
||||
&& s->input_statement.loaded
|
||||
&& bfd_check_format (s->input_statement.the_bfd,
|
||||
bfd_archive))
|
||||
s->input_statement.loaded = FALSE;
|
||||
|
||||
lang_list_init (&add);
|
||||
|
||||
if (! load_symbols (&s->input_statement, &add))
|
||||
config.make_executable = FALSE;
|
||||
|
||||
if (add.head != NULL)
|
||||
{
|
||||
lang_statement_list_type add;
|
||||
|
||||
s->input_statement.target = current_target;
|
||||
|
||||
/* If we are being called from within a group, and this
|
||||
is an archive which has already been searched, then
|
||||
force it to be researched unless the whole archive
|
||||
has been loaded already. */
|
||||
if (force && !s->input_statement.whole_archive && s->input_statement.loaded
|
||||
&& bfd_check_format (s->input_statement.the_bfd, bfd_archive))
|
||||
s->input_statement.loaded = FALSE;
|
||||
|
||||
lang_list_init (&add);
|
||||
|
||||
if (!load_symbols (&s->input_statement, &add))
|
||||
config.make_executable = FALSE;
|
||||
|
||||
if (add.head != NULL)
|
||||
{
|
||||
*add.tail = s->header.next;
|
||||
s->header.next = add.head;
|
||||
}
|
||||
*add.tail = s->header.next;
|
||||
s->header.next = add.head;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
unsigned n = count_undef ();
|
||||
if (pass == n)
|
||||
break;
|
||||
pass = n;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,12 +31,8 @@ struct objdump_disasm_info
|
|||
bfd *abfd;
|
||||
asection *sec;
|
||||
bfd_boolean require_sec;
|
||||
bfd_boolean rts;
|
||||
};
|
||||
|
||||
extern bfd_boolean mark_local;
|
||||
extern bfd_boolean mark_skip;
|
||||
|
||||
/* Support display of symbols in baserel offsets. */
|
||||
static void
|
||||
parse_disassembler_options (char *);
|
||||
|
@ -465,8 +461,6 @@ print_insn_m68k (memaddr, info)
|
|||
|
||||
d = best->args;
|
||||
|
||||
((struct objdump_disasm_info *) info->application_data)->rts = 0 == strncmp("rts", best->name, 3);
|
||||
|
||||
(*info->fprintf_func) (info->stream, "%s", best->name);
|
||||
|
||||
if (*d)
|
||||
|
@ -704,7 +698,7 @@ print_insn_arg (d, buffer, p0, addr, info)
|
|||
val = NEXTLONG (p1);
|
||||
else
|
||||
return -2;
|
||||
(*info->fprintf_func) (info->stream, "#%d", val);
|
||||
(*info->fprintf_func) (info->stream, "#%d", val);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
|
@ -842,7 +836,6 @@ print_insn_arg (d, buffer, p0, addr, info)
|
|||
(struct objdump_disasm_info *) info->application_data;
|
||||
asection * text = aux->sec;
|
||||
aux->sec = bfd_get_section (*info->relp->sym_ptr_ptr);
|
||||
mark_local = TRUE;
|
||||
(*info->print_address_func) (uval, info);
|
||||
|
||||
/* restore section to .text */
|
||||
|
@ -858,7 +851,6 @@ print_insn_arg (d, buffer, p0, addr, info)
|
|||
case 2:
|
||||
val = NEXTWORD (p);
|
||||
(*info->fprintf_func) (info->stream, "%%pc@(");
|
||||
mark_local = TRUE;
|
||||
(*info->print_address_func) (addr + val, info);
|
||||
(*info->fprintf_func) (info->stream, ")");
|
||||
break;
|
||||
|
@ -907,27 +899,8 @@ print_insn_arg (d, buffer, p0, addr, info)
|
|||
}
|
||||
if (flt_p) /* Print a float? */
|
||||
(*info->fprintf_func) (info->stream, "#%g", flval);
|
||||
else
|
||||
{
|
||||
if (info->relp &&
|
||||
info->relp->address <= addr + (p - p0)
|
||||
&& info->relp->sym_ptr_ptr && *info->relp->sym_ptr_ptr)
|
||||
{
|
||||
/* Swap section with the correct one. */
|
||||
struct objdump_disasm_info *aux =
|
||||
(struct objdump_disasm_info *) info->application_data;
|
||||
asection * text = aux->sec;
|
||||
aux->sec = bfd_get_section(*info->relp->sym_ptr_ptr);
|
||||
(*info->fprintf_func) (info->stream, "#");
|
||||
mark_local = 1;
|
||||
(*info->print_address_func) (val, info);
|
||||
|
||||
/* restore section to .text */
|
||||
aux->sec = text;
|
||||
}
|
||||
else
|
||||
(*info->fprintf_func) (info->stream, "#%d", val);
|
||||
}
|
||||
else
|
||||
(*info->fprintf_func) (info->stream, "#%d", val);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1379,7 +1352,6 @@ print_base (regno, disp, info)
|
|||
if (regno == -1)
|
||||
{
|
||||
(*info->fprintf_func) (info->stream, "%%pc@(");
|
||||
mark_local = TRUE;
|
||||
(*info->print_address_func) (disp, info);
|
||||
}
|
||||
else
|
||||
|
@ -1409,8 +1381,6 @@ print_base (regno, disp, info)
|
|||
*/
|
||||
if (disp & 0x80000000)
|
||||
offset = 0x7ffe;
|
||||
|
||||
mark_skip = TRUE;
|
||||
(*info->print_address_func) (disp + offset, info);
|
||||
|
||||
/* restore section to .text */
|
||||
|
|
Loading…
Reference in New Issue