We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Bug founded on the new ARM Compiler 6.11 release, not before.
a.cpp:
[[gnu::weak]] int var_a = 0; int main(int argc, char const *argv[]) { return var_a; }
b.cpp:
int var_a = 1;
build with command:
armclang.exe --target=arm-arm-none-eabi -mcpu=Cortex-M3 -g a.cpp b.cpp
then output:
Error: L6743E: Relocation #REL:7 in a-a2e9fa.o(.debug_info) with respect to var_a that has an alternate def. Internal consistency check failed Finished: 0 information, 0 warning and 1 error messages. armclang: error: linker command failed with exit code 1 (use -v to see invocation)
using '__attribute__((weak)) instead of '[[gnu::weak]]' gets same result.
Only build without '-g' flag:
armclang.exe --target=arm-arm-none-eabi -mcpu=Cortex-M3 a.cpp b.cpp
then no error happens.