aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2015-12-15 14:31:25 +0100
committerJan Beulich <jbeulich@suse.com>2015-12-15 14:31:25 +0100
commit270f824531ceef276616a5d2f3027fa9f537c10b (patch)
tree3f20d74a1748d2da2516da51fa9afc63430f35e0 /bfd/coffgen.c
parent1d19cae752a7b032b8253feb4fa3b9f1dc162823 (diff)
downloadgdb-270f824531ceef276616a5d2f3027fa9f537c10b.zip
gdb-270f824531ceef276616a5d2f3027fa9f537c10b.tar.gz
gdb-270f824531ceef276616a5d2f3027fa9f537c10b.tar.bz2
bfd: don't produce corrupt COFF symbol table due to long ELF file name symbols
The re-writing logic in _bfd_coff_final_link() overwrote the ".file" part of the symbol table entry, due to not coping with the auxiliary entry generated in all cases. Note that while I would have wanted to add a test case, (a) I didn't spot any one testing the base functionality here, and (b) I wasn't able to figure out proper conditionals to use in e.g. ld-elf/elf.exp to check for the necessary PE/PE+ support (which varies by target).
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 9257f73..f8e82f1 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1066,6 +1066,7 @@ bfd_boolean
coff_write_alien_symbol (bfd *abfd,
asymbol *symbol,
struct internal_syment *isym,
+ union internal_auxent *iaux,
bfd_vma *written,
bfd_size_type *string_size_p,
asection **debug_string_section_p,
@@ -1151,6 +1152,8 @@ coff_write_alien_symbol (bfd *abfd,
debug_string_section_p, debug_string_size_p);
if (isym != NULL)
*isym = native->u.syment;
+ if (iaux != NULL && native->u.syment.n_numaux)
+ *iaux = native[1].u.auxent;
return ret;
}
@@ -1268,7 +1271,7 @@ coff_write_symbols (bfd *abfd)
if (c_symbol == (coff_symbol_type *) NULL
|| c_symbol->native == (combined_entry_type *) NULL)
{
- if (!coff_write_alien_symbol (abfd, symbol, NULL, &written,
+ if (!coff_write_alien_symbol (abfd, symbol, NULL, NULL, &written,
&string_size, &debug_string_section,
&debug_string_size))
return FALSE;