summaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1999-07-13 18:31:17 +0000
committerRichard Henderson <rth@redhat.com>1999-07-13 18:31:17 +0000
commit45d44768556c7da4643e8d2b496fd465b793ed92 (patch)
treef0905462145f8036d95eee43c056e9995e0dbbc8 /bfd/elflink.c
parent6617d920d3b3f9852a9d917a4f3cf3b6d95b352a (diff)
downloadgdb-45d44768556c7da4643e8d2b496fd465b793ed92.tar.gz
* 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/elflink.c')
-rw-r--r--bfd/elflink.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 93155b11af7..c30915be5db 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;