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: [PATCH] x86: adjust relocation overflow complaint types


On Tue, Aug 02, 2005 at 12:52:31PM +0930, Alan Modra wrote:
> On Mon, Aug 01, 2005 at 11:36:24AM -0700, H. J. Lu wrote:
> > On Mon, Aug 01, 2005 at 10:14:35AM -0700, H. J. Lu wrote:
> > > I'd like to restricts those relocations to 16bit code. Jan, what do
> > > you think?
> > 
> > If we want to use R_xxx_16/R_xxx_8 in 32bit/64bit codes, we should use
> > differet numbers so that we can proper check overflows in 16bit code. 
> 
> No, just revert back to the old behaviour on these relocs.  The warning
> on the dosemu code is wrong and I don't think it is worth adding new
> relocs just for correct overflow checking.
> 
> -- 

I checked in the folllowing patch to fix it.


H.J.
----
bfd/

2005-08-03  H.J. Lu  <hongjiu.lu@intel.com>

	* elf32-i386.c (elf_howto_table): Undo the overflow change for
	R_386_PC16 made on 2005-07-18.

	* elf64-x86-64.c (x86_64_elf_howto_table): Undo the overflow
	change for R_X86_64_PC16 made on 2005-07-18.

ld/testsuite/

2005-08-03  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-i386/pcrel16.d: Updated.
	* ld-i386/pcrel16.s: Likewise.
	* ld-x86-64/pcrel16.d: Likewise.

--- binutils/bfd/elf32-i386.c.16	2005-07-18 09:51:56.000000000 -0700
+++ binutils/bfd/elf32-i386.c	2005-08-03 09:07:23.793061154 -0700
@@ -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_signed,
+  HOWTO(R_386_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_386_PC16",
 	TRUE, 0xffff, 0xffff, TRUE),
   HOWTO(R_386_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
--- binutils/bfd/elf64-x86-64.c.16	2005-07-27 08:41:14.000000000 -0700
+++ binutils/bfd/elf64-x86-64.c	2005-08-03 09:07:32.982549502 -0700
@@ -73,7 +73,7 @@ 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_signed,
+  HOWTO(R_X86_64_PC16,0, 1, 16, TRUE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_X86_64_PC16", FALSE, 0xffff, 0xffff, TRUE),
   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),
--- binutils/ld/testsuite/ld-i386/pcrel16.d.16	2005-07-17 23:23:40.000000000 -0700
+++ binutils/ld/testsuite/ld-i386/pcrel16.d	2005-08-03 09:22:37.464763984 -0700
@@ -1,3 +1,14 @@
 #name: PCREL16 overflow
-#ld:
-#error: .*relocation truncated to fit: R_386_PC16 .*
+#ld: -Ttext 0x0
+#objdump: -drj.text -m i8086
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+0+ <_start>:
+	...
+     420:	cd 42[ 	]+int    \$0x42
+     422:	ca 02 00[ 	]+lret   \$0x2
+	...
+    f065:	e9 b8 13[ 	]+jmp    420 <_start\+0x420>
--- binutils/ld/testsuite/ld-i386/pcrel16.s.16	2005-07-17 23:23:40.000000000 -0700
+++ binutils/ld/testsuite/ld-i386/pcrel16.s	2005-08-03 09:01:28.215552944 -0700
@@ -1,11 +1,9 @@
- .text
- .code16
- .global _start, fwd
+	.code16
+	.text
+	.globl _start
 _start:
-	jpo	fwd
- .rept 2500
-	testl $0x12345678, %ss:0x76543210(,%eax,4)
- .endr
-fwd:
-	leave
-	ret
+	.org 0x420
+	int $0x42
+	lret $2
+	.org 0xf065
+	jmp _start+((0x42) << 4)
--- binutils/ld/testsuite/ld-x86-64/pcrel16.d.16	2005-07-17 23:23:40.000000000 -0700
+++ binutils/ld/testsuite/ld-x86-64/pcrel16.d	2005-08-03 09:21:53.618976529 -0700
@@ -1,4 +1,15 @@
 #name: PCREL16 overflow
 #source: ../ld-i386/pcrel16.s
-#ld:
-#error: .*relocation truncated to fit: R_X86_64_PC16 .*
+#ld: -Ttext 0x0
+#objdump: -drj.text -m i8086
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+ <_start>:
+	...
+     420:	cd 42[ 	]+int    \$0x42
+     422:	ca 02 00[ 	]+lret   \$0x2
+	...
+    f065:	e9 b8 13[ 	]+jmp    420 <_start\+0x420>


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