Questions tagged [objcopy]
142 questions
3
votes
0 answers
Remove unused section using objcopy
Suppose I have the following source file:
// file.c:
void f() {}
void g() {}
I compile it into object file using gcc -ffunction-sections:
$ gcc -c -ffunction-sections file.c -o file.o
# It now has at least two sections: `.text.f' (with `f'),…

Sasha
- 3,599
- 1
- 31
- 52
3
votes
1 answer
Width of symbols created by gcc's objectcopy
I am using objcopy to remove some necessary scripting to embed a resource file (zip file) in flash memory (ARM embedded thingy).
I am using objcopy like this:
arm-none-eabi-objcopy.exe -I binary -O elf32-littlearm -B arm --rename-section…

Daan Timmer
- 14,771
- 6
- 34
- 66
3
votes
2 answers
Why I am getting this output when run readelf -s
I have Linux Kernel with me and trying to generate ELF Header on it using objcopy tool,
Below is the first step
objcopy -I binary -B i386 -O elf32-i386 --rename-section .data=.text linux_kernel.bin main.o
And after this I wanted to read…

Amit Singh Tomar
- 8,380
- 27
- 120
- 199
3
votes
0 answers
ARM objcopy results in empty binary file
How can I get arm-none-eabi-objcopy to copy/translate my .axf file into a .bin suitable for flashing to the device with lm4tools?
I have a ~20KB .axf file compiled and linked with arm-none-eabi-*. For anyone interested, this is with the Stellaris…

Bojangles
- 99,427
- 50
- 170
- 208
3
votes
1 answer
Including binary blob from objcopy in both MinGW 32 and 64
I'm using objcopy to convert a text file into an object file for linking with my DLL using MinGW and MinGW-64. With MinGW, everything works fine, but with MinGW-64 I get errors of the form "undefined reference to…

chippies
- 1,595
- 10
- 20
2
votes
1 answer
How to link Data in ELF file to show up during run time? STM32
I am stuck trying to have my FW version show up at run-time.
I have tried using the example from
Does gcc have any options to add version info in ELF binary file?
But with no luck. Here is what i have so far.
Using STM32L462 on STM32CubeIDE…

Almog Stern
- 66
- 6
2
votes
0 answers
How to use LLVM-objcopy rename symbols in IOS ARM64
I got symbol collision problems when compiling IOS APP.
I have already read solutions like changing names, using libtool(ld).
And I have tried several schemes:
Use the command
ld -arch arm64 -r libMyOrig.a -o libMyNew.a -alias_list…

S.Abbe
- 21
- 2
2
votes
1 answer
How to get an entry point address in binary image file generated by objcopy?
I am building an emulator of the Risk-V CPU for own educational purposes. I have small POC working and want to build example programs and test them on the emulator.
I'm trying to build example program in Rust and seems like I made some decent…

Tom Kris
- 1,227
- 1
- 8
- 15
2
votes
0 answers
How to add ARM_ATTRIBUTES section to a binary with objcopy
I'm trying to move a section from a proprietary binary into my own object file so that I can link against it. However the ARM architecture data is not being properly added to the generated object file, so it does not link into the final…

TheBat
- 1,006
- 7
- 25
2
votes
1 answer
Merge additional code into executable (arm-linux)
I'm trying to merge some extra logging code into a statically linked (android arm linux) executable.
(Normal tracing methods don't seem to work, as it's a daemon process that clone()s just before doing anything interesting - telling strace to…

Chris Stratton
- 39,853
- 6
- 84
- 117
2
votes
1 answer
obj-copy ignores some padding
I have come across a strange problem in the arm obj-copy. Am I doing something wrong or have I come across a bug?
I want to pad my image with zeroes up to 0x1000 (4096) alignment and I do this padding via the below link script. The problem is that…

ria
- 339
- 2
- 9
2
votes
1 answer
How to invoke CROSSTOOL tools from Bazel macros / rules?
I'm building ARM Cortex-M firmware from Bazel with a custom CROSSTOOL. I'm successfully building elf files and manually objcopying them to binary files with the usual:
path/to/my/objcopy -o binary hello.elf hello.bin
I want to make a Bazel macro or…

Charles Nicholson
- 888
- 1
- 8
- 21
2
votes
2 answers
objdump and objcopy as a c/c++ library
I need to perform objdump on an ELF to get address and/or sizes of specific functions and variables as well objcopy to convert it to a different format for operations performed later. Especially with the first part, some of the operations done on…

J_S
- 2,985
- 3
- 15
- 38
2
votes
1 answer
Why does objcopy exclude one section but not another?
Background
I'm attempting to utilize a special section of SRAM on my STM32 device which is located at address 0x40006000. One way of doing this which I saw in ST's example code was just to simply create pointers whose value happened to live inside…

Los Frijoles
- 4,771
- 5
- 30
- 49
2
votes
1 answer
Adding text files to binaries with objcopy, but objcopy complains about architecture
I've read about embedding text files (or any other resource for that matter) into binaries, and I'm doing it like so:
objcopy -I binary -O elf32-littlearm --binary-architecture arm myfile.txt myfile.txt.o
However, unlike in the tutorial, I get the…

Chris Watts
- 6,197
- 7
- 49
- 98