FWIW, I get the same result if using GCC.

On 28 Mar 2022, at 16:43, Ron Olson wrote:

Hey all-

I’m unable to build Swift on Fedora 36 and Rawhide while it does build on F35. I’ve been able to condense the entire issue down to the following sample code that demonstrates the problem:

nothing.S:

#define ASM_TYPE_FUNCTION(symbol) .type symbol, %function
#define ASM_SIZE(symbol) .size symbol, .-symbol
#define ASM_SYMBOL(symbol) symbol
#define ASM_WRAPPER_NAME(symbol) __interceptor_##symbol

.comm _ZN14__interception10real_vforkE,8,8
.globl ASM_WRAPPER_NAME(vfork)
ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
ASM_WRAPPER_NAME(vfork):
        // Commenting out the line below makes it work
        call    *_ZN14__interception10real_vforkE(%rip)
ASM_SIZE(vfork)

And compiling this code with:

clang++ -fPIC -shared ./nothing.S

Results in the error:

/usr/bin/ld: /tmp/fun-1b3a0d.o: warning: relocation against `_ZN14__interception10real_vforkE' in read-only section `.text' /usr/bin/ld: /tmp/fun-1b3a0d.o: relocation R_X86_64_PC32 against symbol `_ZN14__interception10real_vforkE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value

The issue is that I’m explicitly passing -fPIC but it seems to either be ignored or overridden somehow. I’m not well versed on assembly to make any kind of educated guess about what might be the problem/solution so I’m hoping someone more familiar might be able to shed some light on the issue.

Thanks!

Ron
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to