Weak function definition in assembly is prefered over strong c function
- arm-none-eabi-gcc version 10.3-2021.10 20210824
- open source project affected: [REMOVED LINK AS IT TURNS OUT IT IS NOT OPEN SOURCE]
- device: nordic nRF52840/
- library affected: Nordic NRF5 SDK 17.1.0 - custom build system (CMake)
Introduction
I am compiling the project with CMake. My company has their own HardFault_c_handler (lib/NordicAL/
So the source files are in the same library (nrf5_sdk), the hardfault_
Relevant code in the assembly file:
__isr_vector:
.long __StackTop /* Top of Stack */
.long Reset_Handler
.long NMI_Handler
.long HardFault_Handler
.
.
.
.weak HardFault_Handler
.type HardFault_Handler, %function
b .
.size HardFault_Handler, . - HardFault_Handler
Useful information
- Moving the code from hardfault_
- separating the files into separate libraries does not resolve the problem,
- reordering the files in the sources does not affect the issue,
- I am not using -flto (I saw an issue with it),
- using -Wl,-trace-
- separating the definition of the function from the .S file in another .S file resolves the problem, but it must be before the .c file in the sources,
- I also asked this question here: https:/
This problem does not happen when the project is compiled with the included makefile system, the makefile system does not create the static library before linking.
Does this occur because the definition is in the same file it is defined in?
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: