diff options
author | Doug Evans <dje@google.com> | 1998-06-12 20:37:40 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 1998-06-12 20:37:40 +0000 |
commit | 37fcafe682929f14c2be4ee66073eaaa30396589 (patch) | |
tree | 22eb58fa731583e1f53c6985a381b64e9d4fac2c /bfd/elf.c | |
parent | 199cb74149bd81c3d7624049cbebc0ef4937a94d (diff) | |
download | gdb-37fcafe682929f14c2be4ee66073eaaa30396589.zip gdb-37fcafe682929f14c2be4ee66073eaaa30396589.tar.gz gdb-37fcafe682929f14c2be4ee66073eaaa30396589.tar.bz2 |
* elf.c (swap_out_syms): New arg relocatable_p.
Don't add section VMA to symbols for relocatable output.
(_bfd_elf_compute_section_file_positions): Update call to
swap_out_syms.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -45,7 +45,7 @@ static int elf_sort_sections PARAMS ((const PTR, const PTR)); static boolean assign_file_positions_for_segments PARAMS ((bfd *)); static boolean assign_file_positions_except_relocs PARAMS ((bfd *)); static boolean prep_headers PARAMS ((bfd *)); -static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **)); +static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **, int)); static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *)); static char *elf_read PARAMS ((bfd *, long, unsigned int)); static void elf_fake_sections PARAMS ((bfd *, asection *, PTR)); @@ -1982,7 +1982,10 @@ _bfd_elf_compute_section_file_positions (abfd, link_info) /* The backend linker builds symbol table information itself. */ if (link_info == NULL && abfd->symcount > 0) { - if (! swap_out_syms (abfd, &strtab)) + /* Non-zero if doing a relocatable link. */ + int relocatable_p = ! (abfd->flags & (EXEC_P | DYNAMIC)); + + if (! swap_out_syms (abfd, &strtab, relocatable_p)) return false; } @@ -3506,9 +3509,10 @@ _bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg) /* Swap out the symbols. */ static boolean -swap_out_syms (abfd, sttp) +swap_out_syms (abfd, sttp, relocatable_p) bfd *abfd; struct bfd_strtab_hash **sttp; + int relocatable_p; { struct elf_backend_data *bed = get_elf_backend_data (abfd); @@ -3604,7 +3608,9 @@ swap_out_syms (abfd, sttp) value += sec->output_offset; sec = sec->output_section; } - value += sec->vma; + /* Don't add in the section vma for relocatable output. */ + if (! relocatable_p) + value += sec->vma; sym.st_value = value; sym.st_size = type_ptr ? type_ptr->internal_elf_sym.st_size : 0; |