Open llvmbot opened 3 years ago
This is more likely to be a difference in behavior between the gnu binutils assembler and the LLVM MC assembler. (llvm-mc vs as)
Does the problem go away if you add -fno-integrated-as?
I'm currently looking at how we may integrate this into the build for the affected components. Atleast for the test case itself it appears to work however using the switch wholesale in our build causes other breakage earlier.
Ok this also doesn't work for us in practice. Adding it to the necessary flags for the modules results in other failure (.s
files processed using the compiler with -x assembler-with-cpp
now have problems).
This is more likely to be a difference in behavior between the gnu binutils assembler and the LLVM MC assembler. (llvm-mc vs as)
Does the problem go away if you add -fno-integrated-as?
I'm currently looking at how we may integrate this into the build for the affected components. Atleast for the test case itself it appears to work however using the switch wholesale in our build causes other breakage earlier.
As an alternative workaround, can you replace the module level assembly with an alias attribute, like so? void foo () attribute ((weak, alias ("bar"))); I'm not 100% confident that the above is equivalent, but the idea of a weak alias > is surely representable without asm
I don't think I cant get it to work this way, atleast not with my attempts so far. The code where this is predominantly used may or may not include prototypes for either of the aliased function, or the function itself - or both, which causes various errors in my attempts so far.
This is more likely to be a difference in behavior between the gnu binutils assembler and the LLVM MC assembler. (llvm-mc
vs as) Does the problem go away if you add -fno-integrated-as
?
As an alternative workaround, can you replace the module level assembly with an alias attribute, like so?
void foo () __attribute__ ((weak, alias ("bar")));
I'm not 100% confident that the above is equivalent, but the idea of a weak alias is surely representable without asm.
Extended Description
We use an ASM macro to create an Alias extensively in our operating system, however under LLVM/Clang it does not work, preventing us using the LLVM toolchain from compiling the Operating System (www.aros.org).
The following is a simplified testcase showing the behaviour -:
When this is compiled with GNU/GCC, we only have 2 symbols exposed -
bar
, andfunctable
, however with LLVM/Clang - there is also a weak reference forfoo
exposed, which then is not resolved during linking.