Fix seg-fault when linking mixed x86 and x86_64 binaries. (BZ 487472)

This commit is contained in:
Nicholas Clifton 2010-02-02 13:34:50 +00:00
parent 17167ab951
commit eb2c3474d5
2 changed files with 99 additions and 2 deletions

View File

@ -0,0 +1,92 @@
diff -rup ../binutils-2.20.51.0.2.original/bfd/elf32-i386.c ./bfd/elf32-i386.c
--- ../binutils-2.20.51.0.2.original/bfd/elf32-i386.c 2010-01-13 16:01:28.000000000 +0000
+++ ./bfd/elf32-i386.c 2010-02-02 13:07:58.000000000 +0000
@@ -653,19 +653,8 @@ struct elf_i386_link_hash_table
asection *sdynbss;
asection *srelbss;
- /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
- asection *srelplt2;
-
- /* True if the target system is VxWorks. */
- int is_vxworks;
-
- /* Value used to fill the last word of the first plt entry. */
- bfd_byte plt0_pad_byte;
-
- /* The index of the next unused R_386_TLS_DESC slot in .rel.plt. */
- bfd_vma next_tls_desc_index;
-
- union {
+ union
+ {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ldm_got;
@@ -682,10 +671,22 @@ struct elf_i386_link_hash_table
/* Used by local STT_GNU_IFUNC symbols. */
htab_t loc_hash_table;
- void *loc_hash_memory;
+ void * loc_hash_memory;
asection *sdynsharablebss;
asection *srelsharablebss;
+
+ /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
+ asection *srelplt2;
+
+ /* True if the target system is VxWorks. */
+ int is_vxworks;
+
+ /* The index of the next unused R_386_TLS_DESC slot in .rel.plt. */
+ bfd_vma next_tls_desc_index;
+
+ /* Value used to fill the last word of the first PLT entry. */
+ bfd_byte plt0_pad_byte;
};
/* Get the i386 ELF linker hash table from a link_info structure. */
diff -rup ../binutils-2.20.51.0.2.original/bfd/elf64-x86-64.c ./bfd/elf64-x86-64.c
--- ../binutils-2.20.51.0.2.original/bfd/elf64-x86-64.c 2010-01-13 16:01:27.000000000 +0000
+++ ./bfd/elf64-x86-64.c 2010-02-02 13:15:52.000000000 +0000
@@ -470,16 +470,8 @@ struct elf64_x86_64_link_hash_table
asection *sdynbss;
asection *srelbss;
- /* The offset into splt of the PLT entry for the TLS descriptor
- resolver. Special values are 0, if not necessary (or not found
- to be necessary yet), and -1 if needed but not determined
- yet. */
- bfd_vma tlsdesc_plt;
- /* The offset into sgot of the GOT entry used by the PLT entry
- above. */
- bfd_vma tlsdesc_got;
-
- union {
+ union
+ {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ld_got;
@@ -495,10 +487,19 @@ struct elf64_x86_64_link_hash_table
/* Used by local STT_GNU_IFUNC symbols. */
htab_t loc_hash_table;
- void *loc_hash_memory;
+ void * loc_hash_memory;
asection *sdynsharablebss;
asection *srelsharablebss;
+
+ /* The offset into splt of the PLT entry for the TLS descriptor
+ resolver. Special values are 0, if not necessary (or not found
+ to be necessary yet), and -1 if needed but not determined
+ yet. */
+ bfd_vma tlsdesc_plt;
+ /* The offset into sgot of the GOT entry used by the PLT entry
+ above. */
+ bfd_vma tlsdesc_got;
};
/* Get the x86-64 ELF linker hash table from a link_info structure. */

View File

@ -17,7 +17,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.20.51.0.2
Release: 13%{?dist}
Release: 14%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -36,6 +36,7 @@ Patch10: binutils-2.20.51.0.2-lwp.patch
Patch11: binutils-2.20.51.0.2-enable-gold.patch
Patch12: binutils-2.20.51.0.2-gas-expr.patch
Patch13: binutils-2.20.51.0.2-ppc-hidden-plt-relocs.patch
Patch14: binutils-2.20.51.0.2-x86-hash-table.patch
%define gold_arches %ix86 x86_64
@ -131,6 +132,7 @@ to consider using libelf instead of BFD.
%patch11 -p0 -b .enable-gold~
%patch12 -p0 -b .gas-expr~
%patch13 -p0 -b .hidden-plt~
%patch14 -p0 -b .hash-table~
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -428,8 +430,11 @@ exit 0
%endif # %{isnative}
%changelog
* Tue Feb 2 2010 Nick Clifton <nickc@redhat.com> - 2.20.51.0.2-14
- Fix seg-fault when linking mixed x86 and x86_64 binaries. (BZ 487472)
* Fri Jan 22 2010 Nick Clifton <nickc@redhat.com> - 2.20.51.0.2-13
- Add a requirement for the coreutils. (BZ557006)
- Add a requirement for the coreutils. (BZ 557006)
* Wed Jan 20 2010 Nick Clifton <nickc@redhat.com> - 2.20.51.0.2-12
- Fix --no-copy-dt-needed so that it will not complain about weak references.