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

            Bug ID: 18289
           Summary: Support copy relocation in PIE
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
            Target: i386-elf

This

main:
    call    __x86.get_pc_thunk.ax
    addl    $_GLOBAL_OFFSET_TABLE_, %eax
    movl    $4, optopt@GOTOFF(%eax)
    xorl    %eax, %eax
    ret

should work with copy relocation in PIE.  But we get

[hjl@gnu-tools-1 copyreloc]$ gcc -pie -m32 x.s
/usr/local/bin/ld: /tmp/ccCk6nT6.o: relocation R_386_GOTOFF against undefined
symbol `optopt@@GLIBC_2.0' can not be used when making a shared object
/usr/local/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
[hjl@gnu-tools-1 copyreloc]$ 

We need to implement x86-64 commit 631d040f80d99b7b993abd77c9d064fa8bccd711
on i386 and handle cases similar to PRs 17689/17827/17847 if needed.

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