I have been using -r
(relocatable) flag of arm-none-eabi-ld
to combine a bunch of object files in a specific folder (using wildcard *.o). It gets one object file as I was expecting but I am having an issue.
In particular, after combining the files together I used Ghidra and loaded the assembly of the combined object file and a few individual object files that the combined file composed of. Upon inspecting the functions, I find functions from the individual object files that are having exactly same mnemonics with the (i.e there mnemonics and function size is same) functions from the combined object file and also there are some functions that having differences among the combined object file and the individual files. For example, there is a function called HAL_FLASH_ERASE
which was having 630 bytes in the flash.o
file while the same function was having the size of 396 in the combined.o
file and the underline assembly instructions are different.
I had used this flag during the past and it was perfect and the functions were exactly similar and had one to one match between the combined object file with the individual object files. However, this time my directory contains large number of files in contrast to just few object files. I am thinking whether there is a possibility to linker to overwrite the different parts with the use of -relocatble
flag. Other than this method, is there any other way that I could try to combine multiple object files without loosing the one to one mapping between them? Thanks for the time.