diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-04-26 22:15:10 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-04-26 22:15:10 +0000 |
commit | efa6c49704b5d4a46840c7d93f1312010ad2bae4 (patch) | |
tree | e01dc1a4e85f0798e2a695e127744af92f355ff6 /ld/ldwrite.c | |
parent | ecba7a3a1aa79f341f0b1574e05e634a617247e5 (diff) | |
download | gdb-efa6c49704b5d4a46840c7d93f1312010ad2bae4.zip gdb-efa6c49704b5d4a46840c7d93f1312010ad2bae4.tar.gz gdb-efa6c49704b5d4a46840c7d93f1312010ad2bae4.tar.bz2 |
* ldmisc.h (demangle): Declare.
* ldmisc.c: Include "libiberty.h". Include demangle.h with "",
not <>.
(demangle): Make non-static. Remove remove_underscore paramter.
Always return an allocated string.
(vfinfo): Free result of demangle. Add case 'G'. Use %T to print
functionname, rather than calling demangle. Print a colon between
the BFD(section+offset) and the line number.
* ldmain.c (add_archive_element): Improve format of archive
information in map file.
(constructor_callback): Don't print anything to the map file.
* ldlang.c (lang_one_common): Improve format of common symbol
information in map file.
* ldctor.c (ldctor_build_sets): If producing a map file, print set
information.
* ldwrite.c (print_symbol_table): Print a newline before the
header in the map file.
* Makefile.in: Rebuild dependencies.
Diffstat (limited to 'ld/ldwrite.c')
-rw-r--r-- | ld/ldwrite.c | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/ld/ldwrite.c b/ld/ldwrite.c index 3dee0e3..4160ae2 100644 --- a/ld/ldwrite.c +++ b/ld/ldwrite.c @@ -64,6 +64,58 @@ build_link_order (statement) value = statement->data_statement.value; + /* If the endianness of the output BFD is not known, then we + base the endianness of the data on the first input file. + By convention, the bfd_put routines for an unknown + endianness are big endian, so we must swap here if the + input file is little endian. */ + if (! bfd_big_endian (output_bfd) + && ! bfd_little_endian (output_bfd)) + { + boolean swap; + + swap = false; + if (command_line.endian == ENDIAN_LITTLE) + swap = true; + else if (command_line.endian == ENDIAN_UNSET) + { + LANG_FOR_EACH_INPUT_STATEMENT (s) + { + if (s->the_bfd != NULL) + { + if (bfd_little_endian (s->the_bfd)) + swap = true; + break; + } + } + } + + if (swap) + { + bfd_byte buffer[8]; + + switch (statement->data_statement.type) + { + case QUAD: + bfd_putl64 (value, buffer); + value = bfd_getb64 (buffer); + break; + case LONG: + bfd_putl32 (value, buffer); + value = bfd_getb32 (buffer); + break; + case SHORT: + bfd_putl16 (value, buffer); + value = bfd_getb16 (buffer); + break; + case BYTE: + break; + default: + abort (); + } + } + } + ASSERT (output_section->owner == output_bfd); switch (statement->data_statement.type) { @@ -114,9 +166,8 @@ build_link_order (statement) link_order->u.reloc.p->reloc = rs->reloc; link_order->u.reloc.p->addend = rs->addend_value; - if (rs->section != (asection *) NULL) + if (rs->name == NULL) { - ASSERT (rs->name == (const char *) NULL); link_order->type = bfd_section_reloc_link_order; if (rs->section->owner == output_bfd) link_order->u.reloc.p->u.section = rs->section; @@ -128,7 +179,6 @@ build_link_order (statement) } else { - ASSERT (rs->name != (const char *) NULL); link_order->type = bfd_symbol_reloc_link_order; link_order->u.reloc.p->u.name = rs->name; } @@ -453,7 +503,7 @@ ldwrite () static void print_symbol_table () { - fprintf (config.map_file, "**FILES**\n\n"); + fprintf (config.map_file, "\n**FILES**\n\n"); lang_for_each_file (print_file_stuff); fprintf (config.map_file, "**GLOBAL SYMBOLS**\n\n"); |