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]

[PATCH] Check overflows for R_390_GOT12 relocs


Hi!

Following proglet:
#define X0(n) int var##n; int *fn##n(void) { return &var##n; }
#define X1(n) X0(n##0) X0(n##1) X0(n##2) X0(n##3) X0(n##4)
#define X2(n) X1(n##0) X1(n##1) X1(n##2) X1(n##3) X1(n##4)
#define X3(n) X2(n##0) X2(n##1) X2(n##2) X2(n##3) X2(n##4)
#define X4(n) X3(n##0) X3(n##1) X3(n##2) X3(n##3) X3(n##4)
X4(0) X4(1) X4(2) X4(3)
compiles/links with -shared -O2 -m{31,64} -fpic without a single
error, yet the resulting shared binary is of course buggy because
more than half (way more with -m64) relocs overflowed.
Any reason why linker does not check this?

2003-07-04  Jakub Jelinek  <jakub@redhat.com>

	* elf32-s390.c (elf_howto_table): Change R_390_GOT12 to
	complain_overflow_bitfield.
	* elf64-s390.c (elf_howto_table): Change R_390_GOT12 to
	complain_overflow_bitfield.
	
--- bfd/elf64-s390.c.jj	2003-07-04 09:52:07.000000000 -0400
+++ bfd/elf64-s390.c	2003-07-04 12:29:02.000000000 -0400
@@ -122,7 +122,7 @@ static reloc_howto_type elf_howto_table[
 	bfd_elf_generic_reloc, "R_390_32",       FALSE, 0,0xffffffff, FALSE),
   HOWTO(R_390_PC32,	 0, 2, 32,  TRUE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_PC32",     FALSE, 0,0xffffffff, TRUE),
-  HOWTO(R_390_GOT12,	 0, 1, 12, FALSE, 0, complain_overflow_dont,
+  HOWTO(R_390_GOT12,	 0, 1, 12, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_GOT12",    FALSE, 0,0x00000fff, FALSE),
   HOWTO(R_390_GOT32,	 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_GOT32",    FALSE, 0,0xffffffff, FALSE),
--- bfd/elf32-s390.c.jj	2003-07-04 09:52:07.000000000 -0400
+++ bfd/elf32-s390.c	2003-07-04 12:29:23.000000000 -0400
@@ -121,7 +121,7 @@ static reloc_howto_type elf_howto_table[
 	bfd_elf_generic_reloc, "R_390_32",       FALSE, 0,0xffffffff, FALSE),
   HOWTO(R_390_PC32,	 0, 2, 32,  TRUE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_PC32",     FALSE, 0,0xffffffff, TRUE),
-  HOWTO(R_390_GOT12,	 0, 1, 12, FALSE, 0, complain_overflow_dont,
+  HOWTO(R_390_GOT12,	 0, 1, 12, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_GOT12",    FALSE, 0,0x00000fff, FALSE),
   HOWTO(R_390_GOT32,	 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_GOT32",    FALSE, 0,0xffffffff, FALSE),

	Jakub


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