objcopy and ld: problem embedding string resource in executable
Jeffrey Walton
noloader@gmail.com
Sun Nov 18 04:26:00 GMT 2012
Hi All,
I'm having a problem with objcopy and embedding a string resource in
an executable.
$ cat makefile
...
OBJS = $(SRCS:.cpp=.o) help-text.o
...
help-text.o:
objcopy --input binary help-text.txt help-text.o
$ make
...
/usr/bin/ld:help-text.o: file format not recognized; treating as linker script
/usr/bin/ld:help-text.o:2: syntax error
collect2: ld returned 1 exit status
I know I'm not using all arguments that objcopy needs
(http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967).
The following are missing: --output elf32-i386 --binary-architecture
i386 (or elf32-x86_64 andx86_64). I did this because I want objcopy to
use the native format (either x86 or x64). I guess I was wrong in
hoping objcopy would deduce proper flags.
Any ideas how I can get objcopy to use sane values for --output and
--binary-architecture? Is the a 'native' flag, such a -march=native?
Jeff
More information about the Binutils
mailing list