-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functions / symbols defined in sketch may override framework .a #8710
Comments
Linking happens like this right now
With a sketch c/p from the issue, lets add our own crc32 func uint32_t crc32 (const void* data, size_t length, uint32_t crc /*= 0xffffffff*/) {
return 0;
} Resulting .elf has our function and not the original one, crc32 returning 0. > xtensa-lx106-elf-gdb --batch --ex "disassemble crc32" .pio/build/d1_mini/firmware.elf
Dump of assembler code for function crc32(void const*, size_t, uint32_t):
0x4020d0f0 <+0>: movi.n a2, 0
0x4020d0f2 <+2>: ret.n
End of assembler dump. Moving main .o to the back of the 'library group' seems to help /home/runner/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pio/build/d1_mini/src/main.cpp.o: in function `crc32':
/home/runner/dev/arduino7651/src/main.cpp:8: multiple definition of `crc32'; .pio/build/d1_mini/libFrameworkArduino.a(crc32.cpp.o):/home/runner/.platformio/packages/framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910/cores/esp8266/crc32.cpp:39: first defined here
collect2: error: ld returned 1 exit status Not sure if that has any more side-effects, or whether this feature is used by any sketches. |
Is it possible to add a warning when a (global) function is redefined? Maybe even better to stop further compilation. I rather would have a build to fail compared to nearly impossible to find issues which may appear and disappear nearly random on new builds. |
Originally posted by @kamran00f in #7651 (comment)
The text was updated successfully, but these errors were encountered: