[llvm-bugs] [Bug 48109] New: Clang does not pass `-pie` to the linker when using `-fPIE`

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Nov 7 17:41:19 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48109

            Bug ID: 48109
           Summary: Clang does not pass `-pie` to the linker when using
                    `-fPIE`
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: harley.paterson at postgrad.otago.ac.nz
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Clang does not pass the `-pie` argument to the linker implicitly when `-fPIE`
is used.

This is not strictly a bug, but a difference in the default behavior of Clang
and GCC which can cause some programs to be unexpectedly linked as classic
position dependent excutables (`PT_EXEC` for ELFs), rather than a position
independent executable (`PT_DYN` for ELFs)

See LLD bug report [48035](https://bugs.llvm.org/show_bug.cgi?id=48035)for a
detailed discussion.

I suggest modifying Clang's default behavior to match GCC: Implicitly pass
`-pie` when `-fPIE` or `-fpie` is used.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201108/7dbdea49/attachment.html>


More information about the llvm-bugs mailing list