aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorDave Korn <dave.korn@artimi.com>2011-05-07 14:26:56 +0000
committerDave Korn <dave.korn@artimi.com>2011-05-07 14:26:56 +0000
commit88e5939496319c9169fffee2d24f4b6e928d06a6 (patch)
treebba70e66bdee11792bde6a3bd31c1811f06ee6c5 /bfd/coffgen.c
parent310fd250b9bdab1eae5303f363577e30b2932a77 (diff)
downloadgdb-88e5939496319c9169fffee2d24f4b6e928d06a6.zip
gdb-88e5939496319c9169fffee2d24f4b6e928d06a6.tar.gz
gdb-88e5939496319c9169fffee2d24f4b6e928d06a6.tar.bz2
PR ld/12365
* coffgen.c (coff_write_symbol): Assume input section is its own output section if output_section member not set. (coff_write_alien_symbol): Likewise.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index fc82d57..b0c2c62 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -915,6 +915,9 @@ coff_write_symbol (bfd *abfd,
unsigned int numaux = native->u.syment.n_numaux;
int type = native->u.syment.n_type;
int n_sclass = (int) native->u.syment.n_sclass;
+ asection *output_section = symbol->section->output_section
+ ? symbol->section->output_section
+ : symbol->section;
void * buf;
bfd_size_type symesz;
@@ -933,7 +936,7 @@ coff_write_symbol (bfd *abfd,
else
native->u.syment.n_scnum =
- symbol->section->output_section->target_index;
+ output_section->target_index;
coff_fix_symbol_name (abfd, symbol, native, string_size_p,
debug_string_section_p, debug_string_size_p);
@@ -990,6 +993,9 @@ coff_write_alien_symbol (bfd *abfd,
{
combined_entry_type *native;
combined_entry_type dummy;
+ asection *output_section = symbol->section->output_section
+ ? symbol->section->output_section
+ : symbol->section;
native = &dummy;
native->u.syment.n_type = T_NULL;
@@ -1015,12 +1021,11 @@ coff_write_alien_symbol (bfd *abfd,
}
else
{
- native->u.syment.n_scnum =
- symbol->section->output_section->target_index;
+ native->u.syment.n_scnum = output_section->target_index;
native->u.syment.n_value = (symbol->value
+ symbol->section->output_offset);
if (! obj_pe (abfd))
- native->u.syment.n_value += symbol->section->output_section->vma;
+ native->u.syment.n_value += output_section->vma;
/* Copy the any flags from the file header into the symbol.
FIXME: Why? */