Questions tagged [objcopy]
142 questions
1
vote
0 answers
Cross compiling for windows. Objcopy appears to be giving bad object file
I have a program I originally wrote in linux which uses objcopy to embed some images within the executable to be used at runtime. I have no problems with this in linux at all and it runs fine.
However when I try and cross compile the program for…

Scott
- 438
- 6
- 18
1
vote
1 answer
Error while relocating binary code (gcc -> objdata -> load binary code -> and execute)
I'm implementing a genetic algorithm, the creatures are functions that have three pointers as input and output.
All have the form:
// No need for global variables
void _start (float *i, float *o, float *m)
{
...
...
...
}
The creatures…

Alberto Boldrini
- 148
- 1
- 4
1
vote
1 answer
Do I need to use objcopy before flashing my ARM microcontroller with OpenOCD?
"Normal" ARM cross-compilation for ARM microncontrollers generally consists of three or four steps:
Use an assembler to assemble the startup code (if it is assembly) into an object file
Use a compiler to compile any source code into object…

Mark
- 11,257
- 11
- 61
- 97
1
vote
1 answer
Use objcopy --gap-fill only for special section
Is it possible to use the objcopy-parameter --gap-fill only for some specific sections? I don't want to fill up everything with e.g. 0xAA because I want to preserv some old section in my existing EEPROM. It is bad when they are overwritten with e.g.…

MKFein
- 79
- 1
- 7
1
vote
1 answer
How do I get the real position of a section in an ELF archive file?
I want to extract a binary section fron a .a ELF archive file in Linux.
When I run objdump -h on an archive file, it lists the object files it contains, and the section headers for each section. However, the File Offset column appears to be relative…

ACyclic
- 5,904
- 6
- 26
- 28
1
vote
0 answers
How to use absolute symbols in position independent code
I created an elf file using the following commend:
objcopy -F elf64-x86-64 -B i386 -I binary binary_file output_file.o
The elf has 3 absolute symbols (binary_start, binray_end, binary_size)
I tried to compile this elf into a shared library.
The…

Jah
- 1,019
- 1
- 11
- 25
0
votes
1 answer
Which parts of ELF format does objcopy parameter --strip-all remove?
I did compile and link my program and i get a format in ELF32 little endian which is build like this:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: …

71GA
- 1,132
- 6
- 36
- 69
0
votes
2 answers
Automake: embedding text files in binary target
I need to embed several text files in a binary. It's currently done with two lines added in configure.in script that do "clean" and perform objcopy to the $target.o files. Don't ask WHY it's required, in this app, it just is.
What I want to do is…

Jacek Krysztofik
- 1,266
- 1
- 13
- 29
0
votes
0 answers
gcc:linker: set section size to 8 bytes
I am running arm-none-eabi-objcopy -O verilog -S --reverse-bytes=4 --verilog-data-width 8 -R .comment --gap-fill 0 --pad-to 0x2000 bin/main.elf bin/main.verilog
To convert my code in a format suitable for loading in simulation memory via…

vijayvithal
- 551
- 1
- 5
- 13
0
votes
1 answer
SDCC produces elf output with sections of NULL type
I am using SDCC to produce an ELF file. I then convert this ELF file to a binary file. Sadly the output is not as expected. The output is not positioned correctly and there are strange zero length sections in the elf.
The Questions(s)
How do I get…

Maximilian
- 76
- 5
0
votes
0 answers
Record break in avr-objcopy using gap-fill
I'm using avr-objcopy to join multple sections to get one binary, that will be programmed to flash.
avr-objcopy --gap-fill 0xFF -j .section1 -j .section2 -O ihex main.elf main.hex
I get HEX file that contains such lines (spaces added for…

NevaDA
- 128
- 6
0
votes
0 answers
How to avoid CMake writting full path of objects to the static library?
The original issue is here.
After a few days, I find the problem is here.
I tried to use the following CMakeLists.txt to build tcmalloc_minimal_static.lib:
#...
# https://github.com/gperftools/gperftools/blob/master/CMakeLists.txt#L593
if(MINGW OR…

Duke M
- 1
0
votes
1 answer
Why does objcopy remove my section from binary?
I'm trying to link my tiny bare-metal educational project for ARM. I have one simple assembly source and linker script. There is a special separate section for exception vectors and startup code:
.section STARTUP_SECTION, "x"
_reset:
b…

ardabro
- 1,907
- 16
- 31
0
votes
1 answer
.rodata section breaks after moving an object out of the function scope
I'm building a simple payload to execute on an ARM64 system that will print a "Hello, world!" string over UART.
hello-world-payload.c:
#include
typedef uint32_t u32;
int _start() {
const char* txt = "Hello, world!\n";
volatile…

kupper.m
- 3
- 2
0
votes
0 answers
How to generate an EFI file with objcopy in riscv-gnu-toolchain?
On x86, my system's default objcopy has a target pei-x86-64 that can be used to convert a shared object file to an EFI application. However, the list of supported targets in the riscv-gnu-toolchain I recently built (riscv64-unknown-linux-gnu-gcc)…