This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR binutils/16317: Add SHF_INFO_LINK to SHT_RELA/SHT_REL sections


Hi,

This patch adds SHF_INFO_LINK to SHT_RELA/SHT_REL sections generated
by ld.  It makes ld behaves the same as gold.  OK to install?

Thanks.


H.J.
---
 ChangeLog.pr16317               | 19 +++++++++++++++++++
 bfd/elf.c                       |  6 +++---
 ld/testsuite/ld-elf/linkinfo.s  |  2 ++
 ld/testsuite/ld-elf/linkinfo1.d |  8 ++++++++
 ld/testsuite/ld-elf/linkinfo2.d |  9 +++++++++
 5 files changed, 41 insertions(+), 3 deletions(-)
 create mode 100644 ld/testsuite/ld-elf/linkinfo.s
 create mode 100644 ld/testsuite/ld-elf/linkinfo1.d
 create mode 100644 ld/testsuite/ld-elf/linkinfo2.d

diff --git a/ChangeLog.pr16317 b/ChangeLog.pr16317
index cc1d863..5eb179c 100644
--- a/ChangeLog.pr16317
+++ b/ChangeLog.pr16317
@@ -3,5 +3,24 @@ bfd/
 2013-12-11  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR binutils/16317
+	* elf.c (special_sections_g): Add SHF_INFO_LINK to .gnu.conflict
+	section.
+	(special_sections_r): Add SHF_INFO_LINK to .rela and .rel
+	sections.
+
+ld/testsuite/
+
+2013-12-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/16317
+	* ld-elf/linkinfo.s: New file.
+	* ld-elf/linkinfo1.d: Likewise.
+	* ld-elf/linkinfo2.d: Likewise.
+
+bfd/
+
+2013-12-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/16317
 	* elf.c (_bfd_elf_init_private_section_data): Preserve
 	SHF_INFO_LINK.
diff --git a/bfd/elf.c b/bfd/elf.c
index d177e29..5e2a354 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2100,7 +2100,7 @@ static const struct bfd_elf_special_section special_sections_g[] =
   { STRING_COMMA_LEN (".gnu.version_d"),   0, SHT_GNU_verdef,  0 },
   { STRING_COMMA_LEN (".gnu.version_r"),   0, SHT_GNU_verneed, 0 },
   { STRING_COMMA_LEN (".gnu.liblist"),     0, SHT_GNU_LIBLIST, SHF_ALLOC },
-  { STRING_COMMA_LEN (".gnu.conflict"),    0, SHT_RELA,        SHF_ALLOC },
+  { STRING_COMMA_LEN (".gnu.conflict"),    0, SHT_RELA,        SHF_ALLOC + SHF_INFO_LINK },
   { STRING_COMMA_LEN (".gnu.hash"),        0, SHT_GNU_HASH,    SHF_ALLOC },
   { NULL,                        0,        0, 0,               0 }
 };
@@ -2143,8 +2143,8 @@ static const struct bfd_elf_special_section special_sections_r[] =
 {
   { STRING_COMMA_LEN (".rodata"), -2, SHT_PROGBITS, SHF_ALLOC },
   { STRING_COMMA_LEN (".rodata1"), 0, SHT_PROGBITS, SHF_ALLOC },
-  { STRING_COMMA_LEN (".rela"),   -1, SHT_RELA,     0 },
-  { STRING_COMMA_LEN (".rel"),    -1, SHT_REL,      0 },
+  { STRING_COMMA_LEN (".rela"),   -1, SHT_RELA,     SHF_INFO_LINK },
+  { STRING_COMMA_LEN (".rel"),    -1, SHT_REL,      SHF_INFO_LINK },
   { NULL,                   0,     0, 0,            0 }
 };
 
diff --git a/ld/testsuite/ld-elf/linkinfo.s b/ld/testsuite/ld-elf/linkinfo.s
new file mode 100644
index 0000000..23f187a
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkinfo.s
@@ -0,0 +1,2 @@
+	.data
+	.dc.a	foo
diff --git a/ld/testsuite/ld-elf/linkinfo1.d b/ld/testsuite/ld-elf/linkinfo1.d
new file mode 100644
index 0000000..d4e81c8
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkinfo1.d
@@ -0,0 +1,8 @@
+#source: linkinfo.s
+#ld: -shared
+#readelf: -SW
+#target: *-*-linux* *-*-gnu*
+
+#...
+  \[[ 0-9]+\] \.rel[a]?\..*[ \t]+REL[A]+[ \t][ \t0-9a-f]+AI[ \t0-9a-f]+
+#pass
diff --git a/ld/testsuite/ld-elf/linkinfo2.d b/ld/testsuite/ld-elf/linkinfo2.d
new file mode 100644
index 0000000..1bca7d0
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkinfo2.d
@@ -0,0 +1,9 @@
+#source: linkinfo.s
+#ld: -shared
+#objcopy_linked_file: --strip-debug
+#readelf: -SW
+#target: *-*-linux* *-*-gnu*
+
+#...
+  \[[ 0-9]+\] \.rel[a]?\..*[ \t]+REL[A]+[ \t][ \t0-9a-f]+AI[ \t0-9a-f]+
+#pass
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]