bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/28192] New: powerpc64le: gold generates wrong address with a r


From: tuliom at ascii dot art.br
Subject: [Bug gold/28192] New: powerpc64le: gold generates wrong address with a relocation of symbol+offset@got@pcrel
Date: Wed, 04 Aug 2021 19:42:00 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=28192

            Bug ID: 28192
           Summary: powerpc64le: gold generates wrong address with a
                    relocation of symbol+offset@got@pcrel
           Product: binutils
           Version: 2.36.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: tuliom at ascii dot art.br
                CC: ian at airs dot com
  Target Milestone: ---

I can reproduce this issue with the following:

$ cat test.c
/* Build with: gcc -shared -fuse-ld=gold -mcpu=power10 test.c  -o libtest.so*/
#include <stdio.h>

int
foo (int a, int b)
{
  return a + b;
}

int
bar ()
{
  void *p;
  asm volatile ("pld %0,foo+16@got@pcrel" : "=r" (p));
  printf ("foo() is at address    %p\n", &foo);
  printf ("foo()+16 is at address %p\n", p);
  return 0;
}

$ cat main.c
/* Build with: gcc main.c -o main -L. -ltest
   Run with: LD_LIBRARY_PATH=$(pwd) ./main  */

extern int bar();

int
main ()
{
  return bar();
}

Then we get:

$ LD_LIBRARY_PATH=$(pwd) ./main 
foo() is at address    0x7ffff7f40780
foo()+16 is at address 0x7ffff7f40780

We get the expected output when ld.bfd is used to link libtest.so:

$ LD_LIBRARY_PATH=$(pwd) ./main 
foo() is at address    0x7ffff7f40740
foo()+16 is at address 0x7ffff7f40750

-- 
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]