This is the mail archive of the binutils@sources.redhat.com 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: [PATCH] x86: adjust relocation overflow complaint types


>>> "H. J. Lu" <hjl@lucon.org> 16.06.05 15:31:19 >>>
>On Thu, Jun 16, 2005 at 07:14:52AM -0600, Jan Beulich wrote:
>> This fixes the overflow complaint types for three x86-64 and one
i386
>> relocation types.
>> 
>
>Do you have a testcase?

Including tests this time (for the 8- and 16-bit relocs, the dtpoff one
as mentioned before implicitly gets tested by a test to be added with
the got-style relocation patch also updated earlier today).

Built and tested on i686-pc-linux-gnu and x86_64-unknown-linux-gnu.

Jan

bfd/
2005-07-05  Jan Beulich  <jbeulich@novell.com>

	* elf32-i386.c (elf_howto_table): Adjust overflow complaint
handler
	for R_386_PC16.
	* elf64-x86-64.c (x86_64_elf_howto_table): Adjust overflow
complaint
	handler for R_X86_64_PC16, R_X86_64_8, and R_X86_64_DTPOFF.

ld/testsuite/
2005-07-05  Jan Beulich  <jbeulich@novell.com>

	* ld-i386/abs.s, ld-i386/zero.s, ld-i386/abs.d,
ld-x86-64/abs.d,
	ld-i386/pcrel16.s, ld-i386/pcrel16.d, ld-x86-64/pcrel16.d,
	ld-i386/pcrel8.s, ld-i386/pcrel8.d, ld-x86-64/pcrel8.d: New.
	* ld-i386/i386.exp, ld-x86-64/x86-64.exp: Run new tests.

---
/home/jbeulich/src/binutils/mainline/2005-07-05/bfd/elf32-i386.c	2005-06-27
09:22:53.000000000 +0200
+++ 2005-07-05/bfd/elf32-i386.c	2005-07-05 10:22:41.788623216
+0200
@@ -95,7 +95,7 @@ static reloc_howto_type elf_howto_table[
   HOWTO(R_386_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_386_16",
 	TRUE, 0xffff, 0xffff, FALSE),
-  HOWTO(R_386_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
+  HOWTO(R_386_PC16, 0, 1, 16, TRUE, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_386_PC16",
 	TRUE, 0xffff, 0xffff, TRUE),
   HOWTO(R_386_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
---
/home/jbeulich/src/binutils/mainline/2005-07-05/bfd/elf64-x86-64.c	2005-06-27
09:22:54.000000000 +0200
+++ 2005-07-05/bfd/elf64-x86-64.c	2005-07-05 10:22:41.794622304
+0200
@@ -73,9 +73,9 @@ static reloc_howto_type x86_64_elf_howto
 	FALSE),
   HOWTO(R_X86_64_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_X86_64_16", FALSE, 0xffff, 0xffff,
FALSE),
-  HOWTO(R_X86_64_PC16,0, 1, 16, TRUE, 0, complain_overflow_bitfield,
+  HOWTO(R_X86_64_PC16,0, 1, 16, TRUE, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_PC16", FALSE, 0xffff, 0xffff,
TRUE),
-  HOWTO(R_X86_64_8, 0, 0, 8, FALSE, 0, complain_overflow_signed,
+  HOWTO(R_X86_64_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_X86_64_8", FALSE, 0xff, 0xff, FALSE),
   HOWTO(R_X86_64_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_PC8", FALSE, 0xff, 0xff,
TRUE),
@@ -94,7 +94,7 @@ static reloc_howto_type x86_64_elf_howto
   HOWTO(R_X86_64_TLSLD, 0, 2, 32, TRUE, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_TLSLD", FALSE, 0xffffffff,
 	0xffffffff, TRUE),
-  HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, FALSE, 0,
complain_overflow_bitfield,
+  HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, FALSE, 0,
complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_DTPOFF32", FALSE, 0xffffffff,
 	0xffffffff, FALSE),
   HOWTO(R_X86_64_GOTTPOFF, 0, 2, 32, TRUE, 0,
complain_overflow_signed,
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/abs.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-i386/abs.d	2005-07-05
11:58:27.000000000 +0200
@@ -0,0 +1,10 @@
+#name: Absolute non-overflowing relocs
+#source: abs.s
+#source: zero.s
+#ld:
+#objdump: -rs
+
+.*:     file format .*
+
+Contents of section \.text:
+[ 	][0-9a-f]+ c800fff0 c8000110 c9c3.*
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/abs.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-i386/abs.s	2005-07-05
11:55:11.000000000 +0200
@@ -0,0 +1,8 @@
+ .text
+ .global _start
+_start:
+	enter	$zero + 0xff00, $zero + 0xf0
+	enter	$zero - 0xff00, $zero - 0xf0
+	leave
+	ret
+ .p2align 4,0x90
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/i386.exp	2005-05-13
12:17:14.000000000 +0200
+++ 2005-07-05/ld/testsuite/ld-i386/i386.exp	2005-07-05
12:13:38.145703128 +0200
@@ -64,3 +64,7 @@ set i386tests {
 }
 
 run_ld_link_tests $i386tests
+
+run_dump_test "abs"
+run_dump_test "pcrel8"
+run_dump_test "pcrel16"
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/pcrel16.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-i386/pcrel16.d	2005-07-05
11:33:54.000000000 +0200
@@ -0,0 +1,3 @@
+#name: PCREL16 overflow
+#ld:
+#error: .*relocation truncated to fit: R_386_PC16 .*
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/pcrel16.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-i386/pcrel16.s	2005-07-05
11:35:02.000000000 +0200
@@ -0,0 +1,11 @@
+ .text
+ .code16
+ .global _start, fwd
+_start:
+	jpo	fwd
+ .rept 2500
+	testl $0x12345678, %ss:0x76543210(,%eax,4)
+ .endr
+fwd:
+	leave
+	ret
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/pcrel8.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-i386/pcrel8.d	2005-07-05
11:33:46.000000000 +0200
@@ -0,0 +1,3 @@
+#name: PCREL8 overflow
+#ld:
+#error: .*relocation truncated to fit: R_386_PC8 .*
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/pcrel8.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-i386/pcrel8.s	2005-07-05
11:30:56.000000000 +0200
@@ -0,0 +1,11 @@
+ .text
+ .code16
+ .global _start, fwd
+_start:
+	jcxz	fwd
+ .rept 10
+	testl $0x12345678, %ss:0x76543210(,%eax,4)
+ .endr
+fwd:
+	leave
+	ret
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-i386/zero.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-i386/zero.s	2005-07-05
11:06:08.000000000 +0200
@@ -0,0 +1,2 @@
+ .global zero
+ .equiv zero, 0
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-x86-64/abs.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-x86-64/abs.d	2005-07-05
12:10:34.000000000 +0200
@@ -0,0 +1,10 @@
+#name: Absolute non-overflowing relocs
+#source: ../ld-i386/abs.s
+#source: ../ld-i386/zero.s
+#ld:
+#objdump: -rs
+
+.*:     file format .*
+
+Contents of section \.text:
+[ 	][0-9a-f]+ c800fff0 c8000110 c9c3.*
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-x86-64/pcrel16.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-x86-64/pcrel16.d	2005-07-05
12:09:53.000000000 +0200
@@ -0,0 +1,4 @@
+#name: PCREL16 overflow
+#source: ../ld-i386/pcrel16.s
+#ld:
+#error: .*relocation truncated to fit: R_X86_64_PC16 .*
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-x86-64/pcrel8.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-05/ld/testsuite/ld-x86-64/pcrel8.d	2005-07-05
12:10:00.000000000 +0200
@@ -0,0 +1,4 @@
+#name: PCREL8 overflow
+#source: ../ld-i386/pcrel8.s
+#ld:
+#error: .*relocation truncated to fit: R_X86_64_PC8 .*
---
/home/jbeulich/src/binutils/mainline/2005-07-05/ld/testsuite/ld-x86-64/x86-64.exp	2005-05-13
12:17:15.000000000 +0200
+++ 2005-07-05/ld/testsuite/ld-x86-64/x86-64.exp	2005-07-05
12:12:54.777296128 +0200
@@ -52,3 +52,7 @@ set x86_64tests {
 }
 
 run_ld_link_tests $x86_64tests
+
+run_dump_test "abs"
+run_dump_test "pcrel8"
+run_dump_test "pcrel16"

Attachment: binutils-mainline-x86-reloc-ovfl.patch
Description: Text document


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