aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-sparc.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-06-23 21:36:03 +0000
committerIan Lance Taylor <ian@airs.com>1994-06-23 21:36:03 +0000
commit8af74670dfb7ea87529f7ca1fbc254cdc59bc89b (patch)
tree3e754b1c8f09e37ee35173349fb8e6ece7deb3ce /bfd/elf32-sparc.c
parent51fc377bab22057d52d81146902d7b2e4a5d5675 (diff)
downloadgdb-8af74670dfb7ea87529f7ca1fbc254cdc59bc89b.zip
gdb-8af74670dfb7ea87529f7ca1fbc254cdc59bc89b.tar.gz
gdb-8af74670dfb7ea87529f7ca1fbc254cdc59bc89b.tar.bz2
Preliminary support for generating shared libraries, from Eric
Youngdale <ericy@cais.cais.com>. * elfcode.h (prep_headers): If DYNAMIC, set e_type to ET_DYN. (elf_link_add_object_symbols): If generating a shared library, create dynamic sections for first input BFD with the right format. (elf_link_create_dynamic_sections): Don't create .interp section if creating a shared library. (elf_link_input_bfd): Skip dynamic sections in input file. (elf_bfd_final_link): If creating a shared library, it's OK for dynobj to have sections which are not SEC_IN_MEMORY. * elf32-i386.c (elf_i386_size_dynamic_sections): Only set .interp section if not creating a shared library. * elf32-sparc.c (elf_sparc_size_dynamic_sections): Likewise.
Diffstat (limited to 'bfd/elf32-sparc.c')
-rw-r--r--bfd/elf32-sparc.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 4256878..2733a1e 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -472,10 +472,13 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
BFD_ASSERT (dynobj != NULL);
/* Set the contents of the .interp section to the interpreter. */
- s = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (s != NULL);
- s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
- s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+ if (! info->shared)
+ {
+ s = bfd_get_section_by_name (dynobj, ".interp");
+ BFD_ASSERT (s != NULL);
+ s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+ }
/* Make space for the trailing nop in .plt. */
s = bfd_get_section_by_name (dynobj, ".plt");
@@ -492,10 +495,12 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
return false;
/* Add some entries to the .dynamic section. We fill in the values
- later, in elf32_sparc_finish_dynamic_sections, but we must add the
- entries now so that we get the correct size for the .dynamic
- section. */
- if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
+ later, in elf32_sparc_finish_dynamic_sections, but we must add
+ the entries now so that we get the correct size for the .dynamic
+ section. The DT_DEBUG entry is filled in by the dynamic linker
+ and used by the debugger. */
+ if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)
+ || ! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
|| ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
|| ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
|| ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)