Questions tagged [objcopy]
142 questions
26
votes
3 answers
An objcopy equivalent for Mac / iPhone?
I would like to rename symbols inside object files (.o) with something that would be the Mac equivalent of binutils' objcopy --redefine-syms tool.
I found no arm-apple-darwin10-objcopy. I tried the MacPorts' arm-elf-binutils port and also tried to…

Gregory Pakosz
- 69,011
- 20
- 139
- 164
24
votes
2 answers
How to reverse the objcopy's strip with only-keep-debug?
In modern linux almost all objects are stripped and splitted in two parts (two files). First is executable itself and second is debug symbols, stripped out from original ELF. Such files are created with
objcopy --only-keep-debug original.elf…

osgx
- 90,338
- 53
- 357
- 513
22
votes
1 answer
How to remove a specific ELF section, without stripping other symbols?
I have an ELF 32-bit x86 file which contains an .eh_frame section, despite my attempts1 to remove it.
I'd like to remove the .eh_frame section, without touching any symbols in other sections, including unused ones.
strip does not seem to have an…

anol
- 8,264
- 3
- 34
- 78
19
votes
1 answer
How do I add contents of text file as a section in an ELF file?
I have a NASM assembly file that I am assembling and linking (on Intel-64 Linux).
There is a text file, and I want the contents of the text file to appear in the resulting binary (as a string, basically). The binary is an ELF executable.
My plan is…

David Jones
- 4,766
- 3
- 32
- 45
15
votes
3 answers
GCC: how to tell GCC to put the 'main' function at the start of the .text section?
I've just started learning some ARM programming and I've got stuck in a slightly annoying problem. The toolchain I'm using to compile my sources is Sourcery CodeBench Lite 2013.05-23 (can be found here:…

Zuzu Corneliu
- 1,594
- 2
- 15
- 27
14
votes
1 answer
Binding failure with objcopy --redefine-syms
Preconditions
A third-party has provided a C++ executable fooapp that uses a shared object libfoo.so. The library also comes with a header foo.hpp so developers can build other applications:
/* foo.hpp */
namespace foo {
void bar(int a, int b);
…

BrianTheLion
- 2,618
- 2
- 29
- 46
13
votes
1 answer
Separating out symbols and stripping unneeded symbols at the same time
I am interested in creating an external symbol file which I reference from my ELF file using objcopy --add-gnu-debuglink=....
Now I know how to extract only the debug symbols (objcopy --only-keep-debug) and how to only strip the debug symbols…

0xC0000022L
- 20,597
- 9
- 86
- 152
13
votes
5 answers
objcopy prepends directory pathname to symbol name
I am tying to use objcopy to include a binary form of a text file into an executable. (At runtime I need the file as a string). This works fine until the linker needs to find the references from the symbol names. The problem is that objcopy prepends…

ritter
- 7,447
- 7
- 51
- 84
10
votes
1 answer
CMake save stripped debug information
It's a usual practice to compile with debug symbols and then separate the binary using objcopy into the release executable and the file with debug information (then wrap that into separate packages or store on the symbol server).
How to separate…

Velkan
- 7,067
- 6
- 43
- 87
9
votes
3 answers
Is it possible to override static functions in an object module (gcc, ld, x86, objcopy)?
Is there a way to override functions with static scope
within an object module?
If I start with something like this, a module
with global symbol "foo" is a function that calls
local symbol "bar," that calls local symbol "baz"
[scameron@localhost…

smcameron
- 1,307
- 8
- 8
9
votes
2 answers
Objcopy elf to bin file
I have STM32F404 board and I am trying to flash it. I am following this tutorial.
In the project Makefile
$(PROJ_NAME).elf: $(SRCS)
$(CC) $(CFLAGS) $^ -o $@
$(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
$(OBJCOPY) -O binary…

Mouin
- 1,025
- 4
- 19
- 33
8
votes
1 answer
What are the intel hex records type 03 or 05 doing in iHex program for ARM?
What are the intel hex records type 03 or 05 doing in iHex program?
Record type 03: Start Segment Address For 80x86 processors, specifies the initial content of the CS:IP registers. The address field is 0000, the byte count is 04, the first two…

SF.
- 13,549
- 14
- 71
- 107
7
votes
2 answers
How do I embed the contents of a binary file in an executable on Mac OS X?
My command-line program's build process generates a binary file (over 500KB) that currently has to be referenced by path from argv. I would like to embed this file in the executable instead.
On Linux, it appears possible to use objcopy to make an…

zneak
- 134,922
- 42
- 253
- 328
7
votes
2 answers
How to create a executable hex from elf file format
I am very very new to this, I have elf file input.out and need to create hex executable from it. I am using objcopy to create executable in intel hex format as follows
objcopy -O ihex input.out out.hex
by this out.hex contains data from all…

DevC
- 7,055
- 9
- 39
- 58
6
votes
2 answers
How to understand this?
It's from this question.
gcc -c test.s
objcopy -O binary test.o test.bin
What's the difference between test.o and test.bin?
.text
call start
str:
.string "test\n"
start:
movl $4, %eax
movl $1, %ebx
pop …

compile-fan
- 16,885
- 22
- 59
- 73