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]

Commit: Add test for linking mixed 32-bit and 64-bit object files.


Hi Guys,

  I am checking in the attached patch to add a linker test for the
  x86_64-* toolchain that used to trigger a segmentation fault.  The
  linker itself was fixed back in 2010, but at the time no test was
  added to the testsuite.  Now, going through a bit of spring cleaning,
  I have found a test in my local sources.  So for future proofing sake,
  I am checking the test in.

Cheers
  Nick

ld/ChangeLog
2012-01-05  Nick Clifton  <nickc@redhat.com>

	* ld-x86-64/x86-64.exp: Add test of linking mixed 32-bit and
	64-bit objects when the 32-bit object (loaded first) contains 32+
	local symbols, all referenced by relocs and the 64-bit object
	contains a reloc that uses a symbol in the 32-bit object.
	* 32bit.s: New source file.
	* 64bit.s: New source file.
	* incompatible.l: New expected linker output file.

diff -cpN ../binutils-2.20.51.0.2/ld/testsuite/ld-x86-64/32bit.s ld/testsuite/ld-x86-64/32bit.s
*** ../binutils-2.20.51.0.2/ld/testsuite/ld-x86-64/32bit.s	1970-01-01 01:00:00.000000000 +0100
--- ld/testsuite/ld-x86-64/32bit.s	2012-01-03 15:23:17.406456080 +0000
***************
*** 0 ****
--- 1,78 ----
+ 
+ 	.section	.rodata.str1.1,"aMS",@progbits,1
+ 
+ .LC0:	.word 1
+ .LC1:	.word 2
+ .LC2:	.word 3
+ .LC3:	.word 4
+ .LC4:	.word 5
+ .LC5:	.word 6
+ .LC6:	.word 7
+ .LC7:	.word 8
+ .LC8:	.word 9
+ .LC9:	.word 10
+ .LC10:	.word 11
+ .LC11:	.word 12
+ .LC12:	.word 13
+ .LC13:	.word 14
+ .LC14:	.word 15
+ .LC15:	.word 16
+ .LC16:	.word 17
+ .LC17:	.word 18
+ .LC18:	.word 19
+ .LC19:	.word 20
+ .LC20:	.word 21
+ .LC21:	.word 22
+ .LC22:	.word 23
+ .LC23:	.word 24
+ .LC24:	.word 25
+ .LC25:	.word 26
+ .LC26:	.word 27
+ .LC27:	.word 28
+ .LC28:	.word 29
+ .LC29:	.word 30
+ .LC30:	.word 31
+ .LC31:	.word 32
+ .LC32:	.word 33
+ .LC33:	.word 34
+ 
+ 	.text
+ 	.p2align 4,,15
+ 	.globl	foo
+ 	.type	foo, @function
+ foo:
+ 
+ 	leal	.LC0@GOTOFF(%ecx), %eax
+ 	leal	.LC1@GOTOFF(%ecx), %eax
+ 	leal	.LC2@GOTOFF(%ecx), %eax
+ 	leal	.LC3@GOTOFF(%ecx), %eax
+ 	leal	.LC4@GOTOFF(%ecx), %eax
+ 	leal	.LC5@GOTOFF(%ecx), %eax
+ 	leal	.LC6@GOTOFF(%ecx), %eax
+ 	leal	.LC7@GOTOFF(%ecx), %eax
+ 	leal	.LC8@GOTOFF(%ecx), %eax
+ 	leal	.LC9@GOTOFF(%ecx), %eax
+ 	leal	.LC10@GOTOFF(%ecx), %eax
+ 	leal	.LC11@GOTOFF(%ecx), %eax
+ 	leal	.LC12@GOTOFF(%ecx), %eax
+ 	leal	.LC13@GOTOFF(%ecx), %eax
+ 	leal	.LC14@GOTOFF(%ecx), %eax
+ 	leal	.LC15@GOTOFF(%ecx), %eax
+ 	leal	.LC16@GOTOFF(%ecx), %eax
+ 	leal	.LC17@GOTOFF(%ecx), %eax
+ 	leal	.LC18@GOTOFF(%ecx), %eax
+ 	leal	.LC19@GOTOFF(%ecx), %eax
+ 	leal	.LC20@GOTOFF(%ecx), %eax
+ 	leal	.LC21@GOTOFF(%ecx), %eax
+ 	leal	.LC22@GOTOFF(%ecx), %eax
+ 	leal	.LC23@GOTOFF(%ecx), %eax
+ 	leal	.LC24@GOTOFF(%ecx), %eax
+ 	leal	.LC25@GOTOFF(%ecx), %eax
+ 	leal	.LC26@GOTOFF(%ecx), %eax
+ 	leal	.LC27@GOTOFF(%ecx), %eax
+ 	leal	.LC28@GOTOFF(%ecx), %eax
+ 	leal	.LC29@GOTOFF(%ecx), %eax
+ 	leal	.LC30@GOTOFF(%ecx), %eax
+ 	leal	.LC31@GOTOFF(%ecx), %eax
+ 	leal	.LC32@GOTOFF(%ecx), %eax
+ 	leal	.LC33@GOTOFF(%ecx), %eax
diff -cpN ../binutils-2.20.51.0.2/ld/testsuite/ld-x86-64/64bit.s ld/testsuite/ld-x86-64/64bit.s
*** ../binutils-2.20.51.0.2/ld/testsuite/ld-x86-64/64bit.s	1970-01-01 01:00:00.000000000 +0100
--- ld/testsuite/ld-x86-64/64bit.s	2012-01-03 15:23:53.215458927 +0000
***************
*** 0 ****
--- 1,4 ----
+ 	.text
+ bar:
+ 	call foo
+ 
diff -cpN ../binutils-2.20.51.0.2/ld/testsuite/ld-x86-64/incompatible.l ld/testsuite/ld-x86-64/incompatible.l
*** ../binutils-2.20.51.0.2/ld/testsuite/ld-x86-64/incompatible.l	1970-01-01 01:00:00.000000000 +0100
--- ld/testsuite/ld-x86-64/incompatible.l	2012-01-03 15:24:14.142460592 +0000
***************
*** 0 ****
--- 1 ----
+ .*incompatible.*
diff -cpN ../binutils-2.20.51.0.2/ld/testsuite/ld-x86-64/x86-64.exp ld/testsuite/ld-x86-64/x86-64.exp
Index: ld/testsuite/ld-x86-64/x86-64.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-x86-64/x86-64.exp,v
retrieving revision 1.37
diff -u -3 -p -r1.37 x86-64.exp
--- ld/testsuite/ld-x86-64/x86-64.exp	12 Aug 2011 19:42:39 -0000	1.37
+++ ld/testsuite/ld-x86-64/x86-64.exp	5 Jan 2012 14:55:04 -0000
@@ -111,6 +111,10 @@ set x86_64tests {
     {"TLS X32 LD->LE transition" "-melf32_x86_64"
      "--x32" {tlsld2.s}
      {{objdump -dwr tlsld2.dd}} "tlsld2"}
+ 
+     {"build 32-bit object with 33 locals" "-e 0" "--32" {32bit.s} {{ ld incompatible.l }} "dummy" }
+     {"build 64-bit object" "-e 0 --defsym foo=1" "--64" {64bit.s} {} "dummy" }
+     {"link mixed objects"  "-e 0 tmpdir/32bit.o tmpdir/64bit.o" "" {} { { ld incompatible.l } } "mixed"}
 }
 
 run_ld_link_tests $x86_64tests


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