This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
objcopy and ld: problem embedding string resource in executable
- From: Jeffrey Walton <noloader at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sat, 17 Nov 2012 23:26:17 -0500
- Subject: objcopy and ld: problem embedding string resource in executable
- Reply-to: noloader at gmail dot com
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