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] Check overflows for R_390_GOT12 relocs


On Mon, Jul 07, 2003 at 12:24:59PM +0200, Martin Schwidefsky wrote:
> 
> Hi Jakub,
> 
> > 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?
> 
> The reason to use complain_overflow_dont was that I couldn't get
> complain_overflow_bitfield to work with the unsigned 12 bit displacement
> on 2.10. The linker started complaining if the displacement was bigger
> then 2047. I never found the time to fix this in the common code parts.
> If this works with never versions of binutils then this fix is very
> welcomed.

With the patch in I can without problems
gcc -c -fpic -O2 -m31 test.c
ld-new -shared -o test.so test.c

where test.c is:
#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) X3(10) X3(11) X3(12) X1(70) X1(71) X1(72) X1(73) X0(80)

(which is 1021 GOT12 relocs) while if I append X0(81) to it
(ie. another GOT12 relocs) I get already 1 relocation truncated to fit
error (which is what I expect, there are 3 reserved .got entries
and in the former case the shared library has .got sh_size 0x1000).

	Jakub


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