bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/25749] New: PC relocation against SHN_ABS symbol in PIE or share


From: hjl.tools at gmail dot com
Subject: [Bug ld/25749] New: PC relocation against SHN_ABS symbol in PIE or shared library should be disallowed
Date: Mon, 30 Mar 2020 12:42:16 +0000

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

            Bug ID: 25749
           Summary: PC relocation against SHN_ABS symbol in PIE or shared
                    library should be disallowed
           Product: binutils
           Version: 2.35 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

[hjl@gnu-cfl-2 pr94391]$ cat a.c 
extern unsigned long _binary_a_c_size __attribute__ ((visibility ("hidden")));
unsigned long
foo (void)
{
  return (unsigned long) &_binary_a_c_size;
}
[hjl@gnu-cfl-2 pr94391]$ make
gcc -B./ -g -fpic   -c -o a.o a.c
objcopy -B i386:x86-64 -I binary -O elf64-x86-64 a.c x.o
./ld -shared -o liba.so a.o x.o
[hjl@gnu-cfl-2 pr94391]$ 

There is no way to correctly resolve PC relocation against SHN_ABS symbol
in PIE or shared library without introducing new special PC relocation.

[hjl@gnu-cfl-2 pr94391]$ ld.lld -shared -o liba.so a.o x.o
ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol:
_binary_a_c_size
>>> defined in x.o
>>> referenced by a.c:5
>>>               a.o:(foo)
[hjl@gnu-cfl-2 pr94391]$

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