This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM Compiler 6.11 bug: weak variable debug info error

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.