Depending on the other thread https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1333895/mcu-plus-sdk-am243x-ccs-refuses-to-locate-the-correct-source-file-for-a-function/5108241#5108241
I noticed that if I use the weak-attribute on a function in parallel to the section-attribute it seems that the linker does notice the weak-attribute and uses another function with the same name if it is available, but it won't drop the previous weak-declared definition. We are compiling with tiarmclang LTS 3.2.0 and the -fdata-sections and -ffunction-sections options.
It looks the following:
The weak-declared function:
our function (it's guarded with extern "C"{} in a cpp-file):
I noticed that since the compiler produces the assembly code for it, but without a symbol in disassembly:
and for our function:
the map file only contains a symbol for our function:
also the space does seem to be available in the map-file:
tiarmreadelf also only shows our symbol, not the weak-one.
could it be that the section-attribute always tells the linker to place it inside a section even if it is declared weak and thus overwritten? I couldn't find any explanation for this in the compiler-manual. My guess is the linker just leaves it there and only corrects the call later on. what bugs a me a bit is that CCS finds that not-used function when there is not even a definition and I can even set a breakpoint into it. But it's never called.
PS: I removed the interrupt-attribute since it shouldn't be needed for a function directly called out of an interrupt-function, which is in this case the HwiP_data_abort_handler in the asm-file. The interrupt-attribute would lead to the behaviour that a warning would be generated with all follow-up called functions that it could clobber the interruptees VFP and setting the interrupt-attribute for all follow-up called fucntions would be a problem since the attribute generates a different function-return PC and so sets the PC 4 bytes back which means the function is called again instead of proceeding.
Best regards
Felix