Skip to main content
Associate
July 9, 2024
Solved

Elf file and relative paths

  • July 9, 2024
  • 4 replies
  • 4072 views

I'm working on the STM32WL55 Nucleo-64, starting from the LoRaWAN_End_Node.

I performed a hexdump and noticed that the ELF file generated at the end of the compilation process contains a significant recurrence of absolute paths, as shown in the picture below.

Feanoer_0-1720519174226.png

 

I tried using the menu "Properties->Path and Symbols->Includes" to include all the paths through the workspace to avoid the absolute paths.

 

Feanoer_1-1720520553204.png

 

What did I do wrong? How can I generate an ELF file containing only relative paths?

Thank you in advance.

Best answer by Pavel A.

You can strip all debug information from ELF file (but it will be awkward to debug). The first 4 include directories come from the .spec file of the compiler.

 

4 replies

STTwo-32
Technical Moderator
July 10, 2024

Hello @Feanoer 

I suggest you take a look at this post.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Pavel A.
Super User
July 10, 2024

@Feanoer In your screenshot the paths are actually absolute. Because, "/${ProjName}" is a "workspace path".

If these absolute paths are not contained in binary image (are debug information only) - not a problem at all.

 

FeanoerAuthor
Associate
July 11, 2024

Ok, thank you. I have corrected the paths in the figure, and now they are indeed no longer called in the .ELF file. The only absolute references still present refer to the Debug folder

Feanoer_0-1720700901673.png

 and the first 4 external includes, 

Feanoer_3-1720701427462.png

 

which actually do not appear in 'Path and Symbol.'

Feanoer_2-1720701149348.png

Is there a way to remove these last references?"

 

Pavel A.
Pavel A.Best answer
Super User
July 11, 2024

You can strip all debug information from ELF file (but it will be awkward to debug). The first 4 include directories come from the .spec file of the compiler.

 

FeanoerAuthor
Associate
July 18, 2024

What is a way to remove those absolute paths that refer to the debug folders? I'm looking in the project properties, but I still can't avoid them.

Pavel A.
Super User
July 18, 2024

If the absolute paths indeed are in the debug information of the .elf - just run strip --strip-debug on it.

If the paths are in strings (like due to using __FILE__ macro), it will be more complicated.