diff options
author | Richard Henderson <rth@redhat.com> | 1999-07-13 18:31:17 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 1999-07-13 18:31:17 +0000 |
commit | 3018b4415306bf86c26515447e3e519f4cf1f135 (patch) | |
tree | a8ff9103e8c4510c3e307171d5885a294d369fdf /bfd | |
parent | 30b30c21815a6f23b0db7b135926f988ddff22a3 (diff) | |
download | gdb-3018b4415306bf86c26515447e3e519f4cf1f135.zip gdb-3018b4415306bf86c26515447e3e519f4cf1f135.tar.gz gdb-3018b4415306bf86c26515447e3e519f4cf1f135.tar.bz2 |
* elf-bfd.h (struct elf_backend_data): Add want_dynbss.
* elflink.c (_bfd_elf_create_dynamic_sections): Only create
.dynbss and .rel[a].bss if want_dynbss.
* elfxx-target.h (elf_backend_want_dynbss): Provide default.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 1 | ||||
-rw-r--r-- | bfd/elflink.c | 43 | ||||
-rw-r--r-- | bfd/elfxx-target.h | 3 |
4 files changed, 36 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e3d3275..f359ff7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,7 +1,16 @@ 1999-07-13 Richard Henderson <rth@cygnus.com> + * elf-bfd.h (struct elf_backend_data): Add want_dynbss. + * elflink.c (_bfd_elf_create_dynamic_sections): Only create + .dynbss and .rel[a].bss if want_dynbss. + * elfxx-target.h (elf_backend_want_dynbss): Provide default. + +1999-07-13 Richard Henderson <rth@cygnus.com> + * elf.c (assign_file_positions_for_segments): Don't overwrite p_flags. +1999-07-13 Richard Henderson <rth@cygnus.com> + * elf-bfd.h (struct elf_link_local_dynamic_entry): New. (struct elf_link_hash_table): Add dynlocal. (_bfd_elf_link_lookup_local_dynindx): Prototype. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 6c20b06..577823b 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -623,6 +623,7 @@ struct elf_backend_data unsigned plt_not_loaded : 1; unsigned plt_alignment : 4; unsigned can_gc_sections : 1; + unsigned want_dynbss : 1; }; /* Information stored for each BFD section in an ELF file. This diff --git a/bfd/elflink.c b/bfd/elflink.c index 93155b1..c30915b 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -157,18 +157,20 @@ _bfd_elf_create_dynamic_sections (abfd, info) if (! _bfd_elf_create_got_section (abfd, info)) return false; - /* The .dynbss section is a place to put symbols which are defined - by dynamic objects, are referenced by regular objects, and are - not functions. We must allocate space for them in the process - image and use a R_*_COPY reloc to tell the dynamic linker to - initialize them at run time. The linker script puts the .dynbss - section into the .bss section of the final image. */ - s = bfd_make_section (abfd, ".dynbss"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) - return false; + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return false; - /* The .rel[a].bss section holds copy relocs. This section is not + /* The .rel[a].bss section holds copy relocs. This section is not normally needed. We need to create it here, though, so that the linker will map it to an output section. We can't just create it only if we need it, because we will not know whether we need it @@ -179,15 +181,16 @@ _bfd_elf_create_dynamic_sections (abfd, info) be needed, we can discard it later. We will never need this section when generating a shared object, since they do not use copy relocs. */ - if (! info->shared) - { - s = bfd_make_section (abfd, - (bed->default_use_rela_p - ? ".rela.bss" : ".rel.bss")); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, ptralign)) - return false; + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return false; + } } return true; diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 735d95e..40d686d 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -80,6 +80,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef elf_backend_plt_alignment #define elf_backend_plt_alignment 2 #endif +#ifndef elf_backend_want_dynbss +#define elf_backend_want_dynbss 1 +#endif #define bfd_elfNN_bfd_debug_info_start bfd_void #define bfd_elfNN_bfd_debug_info_end bfd_void |