cpu/esp: treat undefined reference as errors#11246
cpu/esp: treat undefined reference as errors#11246cladmi wants to merge 7 commits intoRIOT-OS:masterfrom
Conversation
That is because the dependency is kinda optional. xtimer is only needed for the functions providing a timeout. Adding xtimer as a hard dependency would include it unnecessarily in many cases. |
|
It should just be in a different module "isrpipe_with_timeout" and "at" would depend on this one. |
|
List of found errors reported by the compilation. They would need to be solved in separate pull requests: |
c040264 to
9beb107
Compare
9beb107 to
5d2d2fa
Compare
|
@cladmi but not in On the other side, the compilation of succeeds even though shows that they are also undefined there ??? |
|
@gschorcht sorry, I was not clear in my wording about this. The missing symbols are indeed not caused by the In that case the fact that it is even stricter than the others is good as it helps find these inconsistencies :) What I do not understand, is why the other linker tolerates this. It must be part of the garbage collection for unused functions. If we manage to enable the same behavior, it would allow being strict on undefined references without requiring to fix the undefined functions. And then, fixing the inconsistencies would be separate tasks that could be done after instead of before. |
Indeed, it seems that the only functions that use give no result. Obviously, the linker does not complain about undefined symbols for functions that are not used. Makes sense. Why the ESP32 version of |
|
@cladmi The compilation for the following application now succeeds How do we manage the changes. Should I open a separate PR or should I contribute to your branch? |
|
Concerning the undefined symbol |
|
@cladmi which places each function in its own section seems to solve the Thus the ESP32 linker behavior seems to be similar to that of other architectures. |
|
@gschorcht nice find I will enable it. Maybe some things need to be retested though. It also means I have a way to reproduce it with any platform I think. |
|
I enabled it and added you as co-author, I will still need to change the commits order but I am interested in seeing the build results with this one. |
|
For the |
|
@cladmi I pushed my changes directly into your branch. I hope thats ok. |
| CFLAGS += -Wno-unused-parameter -Wformat=0 | ||
| CFLAGS += -mlongcalls -mtext-section-literals -fstrict-volatile-bitfields | ||
| CFLAGS += -fdata-sections -fzero-initialized-in-bss | ||
| CFLAGS += -ffunction-sections |
There was a problem hiding this comment.
I would prefer to place it in front of -fdata-sections in the line above.
|
@gschorcht no problem with pushing the changes here |
|
@cladmi This changes are only for fixing the undefined reference to The problem with The reason seemed to be that the system libraries were not in the same linker group as the other modules. However, placing them in the same linker group required to override some system functions defined in Finally, I would claim that it is not a fix of an undefined symbol but a fix of the make system (only for ESP32 at the moment). IMO, it should be part of this PR. |
This is why I would prefer to merge them before this one :) My changes only rely on "it does not provide compilation error" or maybe checking some build size. Your fixes are more about reviewing the defined symbols so easier for me to review on their own as I am not sure about the consequences of my changes :D However, putting the -ffunctions-sections did not solve the |
It was silently ignoring compilation errors.
It was silently ignoring compilation errors.
Place each function item into its own section in the output file. This will allow removing missing reference errors in unused functions. Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Place each function item into its own section in the output file. This will allow removing missing reference errors in unused functions. Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
To be able to resolve all symbols and to avoid multiple definition during linking, the system libraries have to be added to the same group as all modules.
Due to changed linker groups, some system functions have to be redefined as wrappers.
The removed module dependency is not longer needed.
4526805 to
5f75e83
Compare
I will take a look.
Using option |
|
@cladmi The question for me is now, should I provide my changes as a separate PR even though they fix the linker problem (at least for ESP32) after removing |
The following change in --- a/cpu/esp8266/Makefile.include
+++ b/cpu/esp8266/Makefile.include
@@ -56,6 +56,7 @@ PSEUDOMODULES += esp_spiffs
USEMODULE += esp
USEMODULE += mtd
+USEMODULE += newlib_syscalls_default
USEMODULE += periph
USEMODULE += periph_common
USEMODULE += ps |
|
@gschorcht I think it should be in separate pull requests. No need to rush anythings. I prefer that we understand why it fails and if the issue is in the esp or more in riot. For |
|
However, as everybody is already doing Lines 377 to 386 in 299a190 You could maybe also say https://github.com/RIOT-OS/RIOT/blob/master/makefiles/libc/newlib.mk Not sure if it is an issue or not with the current implementation. |
|
Is this still waiting for another PR? |
|
I will rebase at least to see the current state. |
|
I think all these have been fixed by #11967 and #12133 The both removed the "-Wl,--warn-unresolved-symbols" that I wanted to get rid of with this one. @gschorcht thank you for handling it :) |
Contribution description
For the esp cpus, treat undefined reference as errors.
It was silently ignoring compilation errors.
Cleanup needed
This pull request should show compilation issues that are currently present and should be fixed to have this one merged.
I noticed that currently
stdio_uartneedsisrpipethat needsxtimerbut without saying the dependency. This should show this issue when building everything and need to be handled in separate pull requests.Testing procedure
Just define an
extern void lala(void);function in an application and call it.The compilation works in master and ignores the issue.
With this pull request it will correctly complain about it.
Issues/PRs references
Found while working on running tests with the
esp32no open pull request yet.