What is the “right” way to determine the purpose and architecture of GNU binutils?

In my build chain, I need to do this:

objcopy -I binary -O $BFDNAME -B $BFDARCH <this> <that>

to get the binary in library form. Since I want other people to be able to use this, I need to know how to get $ BFDNAME and $ BFDARCH from their toolchain when they run the build. I can get the values ​​locally by running objdump -f against the file I’ve already built, but is there a better way that won’t leave me compiling disposable files just to get the configuration value?

+3
source share
2 answers

Thanks for pointing this out regularly! Your answer helped me find another solution that works without specifying architecture in general:

ld -r -b binary -o data.o data.txt

(Ubuntu Linux, binutils 2.22) objcopy ld .

: http://stupefydeveloper.blogspot.de/2008/08/cc-embed-binary-data-into-elf.html

+3

: objdump -i , .

+1

All Articles