2024-10-02 03:47 AM
I have recently picked up an old project which was build by a developer who has left the company. For various security and compliance reasons, I need to know which specific libraries are linked to the project. I can see from the project properties and the makefile, that it is using arm-gnu-toolchain 13.1, but this contains a lot of libraries and my customer needs to know which specific libraries are linked into the binary. Can anyone point me towards how I can find this information?
I am using STMCubeIDE 1.16.0. Though I do not believe that this was the original version used to build the project. (To say that documentation is a bit sparse would be generous!)
Solved! Go to Solution.
2024-10-02 05:12 AM - edited 2024-10-02 05:19 AM
Go to:
# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> Libraries
For all third party libraries that are explicitly linked.
In my case it was only ":libtouchgfx-float-abi-hard.a"
It also links against the standard library for C and/or C++.
Go to
# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> General
And check "Verbose". The clean and build.
It should list all O-files that are linked by the linker.
attempt to open PATH_TO_o_FILE.o succeeded
...
attempt to open PATH_TO_a_FILE.a succeeded
...
Of course there could be C/C++ code or macros inside header files that are compiled inside all your source files. Those don't show up in the linker.
Using regex I was able to extract this list of linked external libraries from my project:
crt0.o
crtbegin.o
crtend.o
crti.o
crtn.o
libc.a
libc_nano.a
libgcc.a
libm.a
libnosys.a
libstdc++_nano.a
libsupc++_nano.a
You can also check your .map file in your build folder. In it you can see which function from which library gets put at which address.
2024-10-02 05:09 AM
If you have the makefile, it should list which libraries are linked in at the linker stage. Use google to search for them by name.
2024-10-02 05:12 AM - edited 2024-10-02 05:19 AM
Go to:
# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> Libraries
For all third party libraries that are explicitly linked.
In my case it was only ":libtouchgfx-float-abi-hard.a"
It also links against the standard library for C and/or C++.
Go to
# Project Properties -> C/C++ Build -> Settings -> MCU G++ Linker -> General
And check "Verbose". The clean and build.
It should list all O-files that are linked by the linker.
attempt to open PATH_TO_o_FILE.o succeeded
...
attempt to open PATH_TO_a_FILE.a succeeded
...
Of course there could be C/C++ code or macros inside header files that are compiled inside all your source files. Those don't show up in the linker.
Using regex I was able to extract this list of linked external libraries from my project:
crt0.o
crtbegin.o
crtend.o
crti.o
crtn.o
libc.a
libc_nano.a
libgcc.a
libm.a
libnosys.a
libstdc++_nano.a
libsupc++_nano.a
You can also check your .map file in your build folder. In it you can see which function from which library gets put at which address.
2024-10-02 05:32 AM
Hi, thanks for the response.
I did consider this myself, but the "LIBS = " statement in the makefile is blank
Is there another statement in the makefile that you think would be relevant?
2024-10-02 05:48 AM
You can also check your .map file in your build folder. In it you can see which function from which library gets put at which address.
Great idea, thanks. This worked for me!