diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-06-23 21:36:03 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-06-23 21:36:03 +0000 |
commit | 8af74670dfb7ea87529f7ca1fbc254cdc59bc89b (patch) | |
tree | 3e754b1c8f09e37ee35173349fb8e6ece7deb3ce /bfd/elf32-i386.c | |
parent | 51fc377bab22057d52d81146902d7b2e4a5d5675 (diff) | |
download | gdb-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-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 6e942a5..5643c7a 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -488,10 +488,13 @@ elf_i386_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; + } /* The adjust_dynamic_symbol entry point has determined the sizes of the various dynamic sections. Allocate some memory for them to @@ -505,8 +508,10 @@ elf_i386_size_dynamic_sections (output_bfd, info) /* Add some entries to the .dynamic section. We fill in the values later, in elf_i386_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)) + 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)) return false; s = bfd_get_section_by_name (dynobj, ".plt"); |