aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-08-04 14:49:55 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-08-04 14:49:55 +0000
commit0049299953014f4607e46f148f9c2f0008475a20 (patch)
tree408443c296eca4a507908cf4ddb59c5ccd797946 /bfd
parent046183de0ebe379c1ec11188000bb6e0f64a9e0e (diff)
downloadgdb-0049299953014f4607e46f148f9c2f0008475a20.zip
gdb-0049299953014f4607e46f148f9c2f0008475a20.tar.gz
gdb-0049299953014f4607e46f148f9c2f0008475a20.tar.bz2
2005-08-04 H.J. Lu <hongjiu.lu@intel.com>
* elf64-x86-64.c (elf64_x86_64_merge_symbol): When mixing a large common symbol and a normal common symbol, always turn the large common symbol into a normal one.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf64-x86-64.c27
2 files changed, 21 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3854c21..db023c9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (elf64_x86_64_merge_symbol): When mixing a
+ large common symbol and a normal common symbol, always turn
+ the large common symbol into a normal one.
+
2005-08-04 Alan Modra <amodra@bigpond.net.au>
* elf32-ppc.c (struct elf_linker_section): Replace sym_val field
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 196b237..7b06ef4 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3014,7 +3014,7 @@ elf64_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct elf_link_hash_entry **sym_hash ATTRIBUTE_UNUSED,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym,
- asection **psec ATTRIBUTE_UNUSED,
+ asection **psec,
bfd_vma *pvalue ATTRIBUTE_UNUSED,
unsigned int *pold_alignment ATTRIBUTE_UNUSED,
bfd_boolean *skip ATTRIBUTE_UNUSED,
@@ -3031,25 +3031,28 @@ elf64_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
bfd_boolean *olddyn,
bfd_boolean *olddyncommon ATTRIBUTE_UNUSED,
bfd_boolean *oldweak ATTRIBUTE_UNUSED,
- bfd *oldbfd ATTRIBUTE_UNUSED,
+ bfd *oldbfd,
asection **oldsec)
{
/* A normal common symbol and a large common symbol result in a
- normal common symbol. If we see the normal symbol first, we
- do nothing since the first one will be used. If we see the
- large common symbol first, we need to change the large common
- symbol to the normal common symbol. */
+ normal common symbol. We turn the large common symbol into a
+ normal one. */
if (!*olddyn
&& h->root.type == bfd_link_hash_common
&& !*newdyn
&& bfd_is_com_section (*sec)
- && *oldsec != *sec
- && sym->st_shndx == SHN_COMMON
- && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) != 0)
+ && *oldsec != *sec)
{
- h->root.u.c.p->section = bfd_make_section_old_way (abfd,
- "COMMON");
- h->root.u.c.p->section->flags = SEC_ALLOC;
+ if (sym->st_shndx == SHN_COMMON
+ && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) != 0)
+ {
+ h->root.u.c.p->section
+ = bfd_make_section_old_way (oldbfd, "COMMON");
+ h->root.u.c.p->section->flags = SEC_ALLOC;
+ }
+ else if (sym->st_shndx == SHN_X86_64_LCOMMON
+ && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) == 0)
+ *psec = *sec = bfd_com_section_ptr;
}
return TRUE;