Open nickdesaulniers opened 1 year ago
@llvm/issue-subscribers-backend-x86
@MaskRay mentions that gas has -mshared
and will produce the relocation with that flag.
Perhaps clang is missing -Wa,-mno-shared
, and should default to that behavior.
This might be x86 specific behavior of gas.
I think suppressing R_X86_64_PLT32
is actually an odd behavior in binutils's x86 port in its default -mno-shared
mode (gas/config/tc-i386.c:shared
): https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b084df0b8d1262fb1e969c74bcc5c61e262a6199. I think most other ports of GNU assembler generate a branch relocation.
This behavior requires quite a few heuristics and it's difficult to get right. For example, GRP_COMDAT section groups can discard STB_GLOBAL
symbols. Suppressing R_X86_64_PLT32
can lead to an odd jump destination. There may be other corner cases.
I don't think -Wa,-mno-shared
is a useful feature for LLVM integrated assembler. Hmm, gas i386 added the option -mno-relax
but then reverted it in 2015.
Consider the following test case:
compare that with GNU as
I don't think we need to emit the relocation.