[PATCH] Copy symbol flags when doing an assignment with a ternary operator.

Simon Dardis Simon.Dardis@imgtec.com
Mon Oct 19 10:15:00 GMT 2015


Hello,

My apologies, I should have supplied a testcase. Testcase below, passes
on mips-img-elf, mips-mti-elf, mips-img-linux-gnu, sparc-linux-gnu and 
x86_64-linux-gnu.


Thanks,
Simon

ld/testsuite/
	* ld-elf/attributes.d: New test for symbol attribute copying.
	* ld-elf/attributes.ld: Part of above.
	* ld-elf/attributes.s: Likewise.

diff --git a/ld/testsuite/ld-elf/attributes.d b/ld/testsuite/ld-elf/attributes.d
new file mode 100644
index 0000000..6356bbe
--- /dev/null
+++ b/ld/testsuite/ld-elf/attributes.d
@@ -0,0 +1,8 @@
+#name: Symbol flags copy
+#ld: -T attributes.ld
+#objdump: -t
+
+#...
+0+0000000 g     F .text	0+0000000 __start
+0+0000000 g     F .text	0+0000000 start
+#pass
diff --git a/ld/testsuite/ld-elf/attributes.ld b/ld/testsuite/ld-elf/attributes.ld
new file mode 100644
index 0000000..f6cfe4a
--- /dev/null
+++ b/ld/testsuite/ld-elf/attributes.ld
@@ -0,0 +1,9 @@
+PROVIDE ( __start = DEFINED(start) ? start : 0xbfc00000);
+ENTRY (__start)
+SECTIONS
+{
+  .text :
+  {
+    *(.text)
+  }
+}
diff --git a/ld/testsuite/ld-elf/attributes.s b/ld/testsuite/ld-elf/attributes.s
new file mode 100644
index 0000000..bb47536
--- /dev/null
+++ b/ld/testsuite/ld-elf/attributes.s
@@ -0,0 +1,5 @@
+	.text
+	.globl	start
+	.type	start, %function
+start:
+	.byte 0
-- 
2.1.0

-----Original Message-----
From: binutils-owner@sourceware.org [mailto:binutils-owner@sourceware.org] On Behalf Of H.J. Lu
Sent: 15 October 2015 13:35
To: Nick Clifton
Cc: Simon Dardis; binutils@sourceware.org
Subject: Re: [PATCH] Copy symbol flags when doing an assignment with a ternary operator.

On Thu, Oct 15, 2015 at 5:30 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Simon,
>
>> ld/ChangeLog
>>         * ld/ldexp.c:   (try_copy_symbol_flags): New. Factored out from..
>>                         (exp_fold_tree_1): Here. Cope with ternary 
>> operator
>>                         in assignments. Use new helper.
>
>
> Approved and applied - thanks for the patch!

Do we have a testcase to very it even works as expected?

--
H.J.


More information about the Binutils mailing list