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]

Re: PR21529, internal error in linker.c


On Mon, Jun 5, 2017 at 1:25 AM, Alan Modra <amodra@gmail.com> wrote:
>         PR 21529
>         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
>
> diff --git a/bfd/ChangeLog b/bfd/ChangeLog
> index 27a1e8c..f4a6afa 100644
> --- a/bfd/ChangeLog
> +++ b/bfd/ChangeLog
> @@ -1,3 +1,8 @@
> +2017-06-05  Alan Modra  <amodra@gmail.com>
> +
> +       PR 21529
> +       * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
> +
>  2017-06-01  John Baldwin  <jhb@FreeBSD.org>
>
>         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
> diff --git a/bfd/linker.c b/bfd/linker.c
> index 9861259..f94d2f8 100644
> --- a/bfd/linker.c
> +++ b/bfd/linker.c
> @@ -2091,7 +2091,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
>               && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
>                                   FALSE, FALSE) == NULL))
>         output = FALSE;
> -      else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
> +      else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
>         {
>           /* If this symbol is marked as occurring now, rather
>              than at the end, output it now.  This is used for
>

I checked in this to add a testcase.

-- 
H.J.
From d9409498813c75c1a9e9287ac6e5100ed3130390 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 5 Jun 2017 14:54:12 -0700
Subject: [PATCH] Add a testcase for PR ld/21529

	PR ld/21529
	* testsuite/ld-unique/pr21529.d: New file.
	* testsuite/ld-unique/pr21529.s: Likewise.
	* testsuite/ld-unique/unique.exp: Run *.d.
---
 ld/ChangeLog                      | 7 +++++++
 ld/testsuite/ld-unique/pr21529.d  | 8 ++++++++
 ld/testsuite/ld-unique/pr21529.s  | 8 ++++++++
 ld/testsuite/ld-unique/unique.exp | 7 ++++++-
 4 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 ld/testsuite/ld-unique/pr21529.d
 create mode 100644 ld/testsuite/ld-unique/pr21529.s

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8a22862..0e52c27 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2017-06-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/21529
+	* testsuite/ld-unique/pr21529.d: New file.
+	* testsuite/ld-unique/pr21529.s: Likewise.
+	* testsuite/ld-unique/unique.exp: Run *.d.
+
 2017-06-05  Alan Modra  <amodra@gmail.com>
 
 	* ldmain.c (main): Correct setting of link_indo.new_dtags.
diff --git a/ld/testsuite/ld-unique/pr21529.d b/ld/testsuite/ld-unique/pr21529.d
new file mode 100644
index 0000000..9a75a6a
--- /dev/null
+++ b/ld/testsuite/ld-unique/pr21529.d
@@ -0,0 +1,8 @@
+#ld: --oformat binary -e main
+#objdump: -s -b binary
+
+.*:     file format binary
+
+Contents of section \.data:
+ 0000 .*
+#pass
diff --git a/ld/testsuite/ld-unique/pr21529.s b/ld/testsuite/ld-unique/pr21529.s
new file mode 100644
index 0000000..4570635
--- /dev/null
+++ b/ld/testsuite/ld-unique/pr21529.s
@@ -0,0 +1,8 @@
+	.type a, %gnu_unique_object
+a:	.long 0
+	.size a, .-a
+
+        .type main,"function"
+        .global main
+main:
+        .dc.a a
diff --git a/ld/testsuite/ld-unique/unique.exp b/ld/testsuite/ld-unique/unique.exp
index 61c070a..49d7925 100644
--- a/ld/testsuite/ld-unique/unique.exp
+++ b/ld/testsuite/ld-unique/unique.exp
@@ -35,7 +35,12 @@ if { ![supports_gnu_unique] } {
     return
 }
 
-run_dump_test "unique"
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+    # We need to strip the ".d", but can leave the dirname.
+    verbose [file rootname $t]
+    run_dump_test [file rootname $t]
+}
 
 # We need a working compiler.  (Strictly speaking this is
 # not true, we could use target specific assembler files).
-- 
2.9.4


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