Questions tagged [objcopy]

142 questions
0
votes
0 answers

S-record files output by objcopy are smaller than the original binaries

After using arm-none-eabi-gcc to build a file in ELF format, I am using arm-none-eabi-objcopy to create an S-record file. The command that my makefile runs is: $(TOOLCHAIN)-objcopy --srec-len 10 -O srec "$<" "$@" The makefile can build with various…
AJM
  • 1,317
  • 2
  • 15
  • 30
0
votes
1 answer

Make a C static library that only exposes the API

I have an old static library that includes some functions produced by a C auto-coder (Mathworks/Simulink). I have just made a new static library (that does totally different things from the old library) that uses a newer version of the auto-coder. I…
user3856370
  • 199
  • 9
0
votes
1 answer

dynamic file compilation with gcc in c

I'm trying to find a method to, from a program, check the presence of one or more ".c" files and load one or more functions of it. Basically, I would have a "main" program which will check if the "script.c" file exists, and will launch (if it…
Kryk
  • 11
  • 1
0
votes
0 answers

What does .L.str mean in objcopy command?

I am reading my build scripts of my project and found a place where it is written the following command objcopy --redefine-sym =.L.str before.a after.a Could somebody please explain me what does .L.str mean here?
Pendyala
  • 585
  • 1
  • 6
  • 17
0
votes
1 answer

How to remove useless empty space between ELF sections after removing section?

I try to reduce the binary size by objcopy with --remove-section option. After the section is removed, it remains some empty space at the original position of deleted section. Is there any way to adjust the section's offset to avoid these empty…
Cache
  • 45
  • 7
0
votes
1 answer

binary file generated by gcc objcopy has a size much larger than sum of 'text' and 'data' in gcc size output

I use objcopy -S -g -O binary test.elf test.bin to get a .bin file from .elf. $ ll test.bin -rwxr-xr-x 1 hongzhuwang md_psw 1472320 Oct 28 19:07 test.bin $ size test.elf text data bss dec hex filename 173062 6328 6605424…
Wanghz
  • 305
  • 2
  • 12
0
votes
0 answers

Remove or Weaken private methods in module

I'm trying to use cmocka to test a private function in a module. The method under testing also calls other private methods in that same module. /** @file foo.c */ void foo_private(); void foo_under_test() { foo_private(); } void foo_private()…
gnac
  • 1,573
  • 15
  • 17
0
votes
1 answer

Where do addresses in S-Record files come from?

I am developing a freestanding application for an ARM Cortex-M microcontroller and while researching the structure of an S-Record file I found that I have some kind of misunderstanding in how the addresses are represented in the S-Record format. I…
Shane Snover
  • 47
  • 2
  • 5
0
votes
1 answer

How to set PE header Characteristics flags

I'm trying to make an UEFI-bootable PE32+ file for UEFI in 64bit-mode with gcc. First I'm compiling the source. cc -nostartfiles -o bootx64.o bootx64.c Then I'm throwing away everything except the .text and .data section and renaming the…
0
votes
1 answer

Merge elf sections

I have an elf file with this sections: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .rtc.text …
Skallwar
  • 73
  • 2
  • 5
0
votes
0 answers

Separate debug symbol file(s) for Linux kernel

I know that when compiling a program with debug symbols (e.g. using gcc -g), I can separate the debug symbols into their own file using objcopy. Later, the file of debug symbols can be used to debug the stripped binary, e.g. using gdb. My question…
onetyone
  • 457
  • 4
  • 15
0
votes
1 answer

Is it possible to make a hardcoding with the help of the command objcopy

I'm working on Linux and I've just heard that there was a command objcopy, I've found the relative command on my x86_64 PC: x86_64-linux-gnu-objcopy. With its help, I can convert a file into an obj file: x86_64-linux-gnu-objcopy -I binary -O…
Yves
  • 11,597
  • 17
  • 83
  • 180
0
votes
0 answers

objcopy given sections from elf to hex file

I'm trying to objcopy some elf file to ihex with following command: arm-none-eabi-objcopy -j .flash_vectors -j .isr_vector \ -j .text -j .rodata ./app.elf -O ihex ./app.hex and I'm trying to copy four sections to ihex. The problem is that…
user2699113
  • 4,262
  • 3
  • 25
  • 43
0
votes
0 answers

Meaning of Endianess in "objcopy -O ..."? Does binary data get mangled?

after reading this answer I immediately thought to myself: Why exactly do I have to tell whether it's Little or Big Endian? Does it mean that instead of simply copying my binary input data, objcopy mangles the data in some way, depending on the…
0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
0
votes
1 answer

Extra data appearing in binary after objcopy... Where is it coming from?

I have an STM32 project involving a linkerscript which is designed to cap off the end of the image with a ".firmware_header" section. The idea is that this header contains the crc of the image, and there should be no content after this point.…
chris12892
  • 1,634
  • 2
  • 18
  • 36