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: ld-x86-64/ilp32-11 failure for x86_64-*-nacl*


On Tue, May 22, 2012 at 10:50 AM, Roland McGrath <mcgrathr@google.com> wrote:
> On x86_64-*-nacl* the .text section is placed at address 0. ?So it makes
> sense that there is no error, as 0 + 0x7fffffff does not overflow.
>
> I tried adding a little content to .text before "func:". ?That doesn't
> produce the error you expect. ?For one byte, so "func" is at .text+0x1,
> it produces a sign-extended value in .data (0xffffffff80000000) and a
> dynamic reloc with r_addend of INT32_MIN.

You need to make func global and hidden.  Otherwise, assembler
will generate negative addend.

> So I think there is a bona fide bug in your overflow detection code. ?I
> think you should adjust the test case to ensure "func" can never be at 0
> even if .text is placed at 0, and then debug it in the target=x86_64-nacl
> case.
>

I checked in this patch to adjust ld-x86-64/ilp32-11.s for
NACL.

Thanks.


-- 
H.J.
---
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 75b2089..895e19b 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* ld-x86-64/ilp32-11.s Add ".space 0x1000" before func.
+	(func): Make it global and hidden.
+	* ld-x86-64/ilp32-11.d: Updated.
+
 2012-05-22  Roland McGrath  <mcgrathr@google.com>

 	* ld-elf/eh4.d: Revert last change.
diff --git a/ld/testsuite/ld-x86-64/ilp32-11.d
b/ld/testsuite/ld-x86-64/ilp32-11.d
index 56bb8b3..f6fc86c 100644
--- a/ld/testsuite/ld-x86-64/ilp32-11.d
+++ b/ld/testsuite/ld-x86-64/ilp32-11.d
@@ -1,3 +1,3 @@
 #as: --x32
 #ld: -shared -melf32_x86_64
-#error: .*addend 0x7fffffff in relocation R_X86_64_64 against symbol
`.text' at 0x0 in section `.data.rel.local' is out of range
+#error: .*addend 0x7fffffff in relocation R_X86_64_64 against symbol
`func' at 0x0 in section `.data.rel.local' is out of range
diff --git a/ld/testsuite/ld-x86-64/ilp32-11.s
b/ld/testsuite/ld-x86-64/ilp32-11.s
index 2c85385..438f094 100644
--- a/ld/testsuite/ld-x86-64/ilp32-11.s
+++ b/ld/testsuite/ld-x86-64/ilp32-11.s
@@ -4,6 +4,9 @@
 	.quad	func + 0x7fffffff

 	.text
+	.space	0x1000
 	.type	func, @function
+	.global	func
+	.hidden	func
 func:
 	ret


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