[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/12669] New: Suspected bug in calculation of gp-relative offsets

From: jakub at jermar dot eu
Subject: [Bug ld/12669] New: Suspected bug in calculation of gp-relative offsets for ia64 target
Date: Wed, 13 Apr 2011 13:21:31 +0000


           Summary: Suspected bug in calculation of gp-relative offsets
                    for ia64 target
           Product: binutils
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden

Starting with ld from binutils 2.21, we are observing a change in ld's behavior
when cross-linking HelenOS for ia64-pc-linux-gnu. Instructions that compute the
gp-relative offset like the following:

        addl r36 = @ltoff(@fptr(__entry#)), gp

are linked with a large bias which was not previously there. For example:

ld 2.20:

   20246:      40 02 04 00 48 20                   addl r36=0,r1

ld 2.21:

   20246:      40 62 07 8c 48 20                   addl r36=9068,r1

Note that the only thing which changed is ld, as can be seen in the attached
testcase. The compiler, assembler and linker script remained the same (gcc 4.6
and as 2.21).

The bias is causing the application to crash and the resulting address is
beyond the end of the program's data segment. When linked with 2.20 ld, the
application works as expected. Thus we are suspecting the offset computed by ld
2.21 is wrong. However, we cannot simply rule out a problem in our linker
script either thanks to the complexity of the issue.

I am attaching a testcase which can easily demonstrate the problem provided
that both versions of ld are available (just edit the Makefile). It contains
our libc.a and libsoftint.a plus a dummy .s containing symbol main. Attached is
also the linker script which we use to generate ia64 binaries on HelenOS and a
Makefile. I tried to come up with a smaller testcase, but unfortunately was not
successful. If there is a desire, I can attach also the binaries generated by
the testcase Makefile.

The testcase produces two binaries, testcase-2.20 and testcase-2.21,
corresponding map files and disassembler files. Finally, testcase.diff shows
that the difference is only in instructions like the above.

Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]