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

            Bug ID: 19818
           Summary: Absolute symbol is handled incorrectly in PIE
           Product: binutils
           Version: 2.27 (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-skl-1 tmp]$ cat foo.c
#include <stdio.h>

extern char foo;
void *p = &foo;

int
main ()
{
  printf ("%p\n", p);
  return 0;
}
[hjl@gnu-skl-1 tmp]$ gcc -fPIE foo.c -c   
[hjl@gnu-skl-1 tmp]$ gcc foo.o -Wl,--defsym,foo=0x1000     
[hjl@gnu-skl-1 tmp]$ ./a.out
0x1000
[hjl@gnu-skl-1 tmp]$ gcc foo.o -Wl,--defsym,foo=0x1000 -pie
[hjl@gnu-skl-1 tmp]$ ./a.out
0x562ddcc19000
[hjl@gnu-skl-1 tmp]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to