Questions tagged [objcopy]

142 questions
2
votes
1 answer

powerpc-eabi-objcopy creates 1GByte file

my elf-file is about 1MByte with all debug symbols. As I try to create a binary file with "powerpc-eabi-objcopy -O binary out.elf out.bin" the out.bin is 1GByte huge. The build script looks like…
Friedrich
  • 645
  • 11
  • 26
2
votes
1 answer

Does breakpad's dump_syms tool handle gnu_debuglink sections?

I'm having a hard time generating breakpad symbols on Linux from stripped binaries. I compile with: gcc-4.4 -c -I../include -D_LINUX -m64 -fPIC -D__LP64__ -D_GNU_SOURCE -Wno-switch -Wno-missing-braces -fno-strict-aliasing -Wreturn-type -Wall…
Artfunkel
  • 1,832
  • 17
  • 23
2
votes
3 answers

Objcopy --writable-text not making elf binary text section writable?

I was trying to make the .text section of an elf binary writable using objcopy --writable-text executable_name. The command executes normally without any errors. On checking the section permission through readelf I can see that the text section is…
abhi
  • 3,476
  • 5
  • 41
  • 58
1
vote
0 answers

Is it legal to use --rename-section and --add-symbol with objdump at the same time?

I am using following command: echo 'SOME_DATA' > data.file \ && objcopy \ --input-target binary \ --output-target=elf64-x86-64 \ --rename-section .data=.my_data_section \ --add-symbol DATA_SECTION_START=.my_data_section:0 \ …
lol lol
  • 319
  • 3
  • 18
1
vote
1 answer

--localize-symbol does not work on windows with mingw-w64

I have two files foo_var.c int global_var = 1; foo_print.c #include extern int global_var; void print_foo(void) { printf("print_foo = %d\n", global_var); } that compile and link into foo.o and localize global_var gcc -c foo.c…
Liarsenic
  • 36
  • 6
1
vote
1 answer

How to specify architecture for sde-objcopy?

I need to convert an picture to an object file(.o) use sde-objcopy, then I can use this picture in our no-os system. I had test the objcopy command, it works well on my PC(Fedora 12). For example, the command below will convert test.jpg to…
Serval
  • 153
  • 1
  • 8
1
vote
0 answers

objcopy breaks shared library alignment on libgfortran-2e0d59d6.so.5.0.0

I'm trying to add a new section to the dynamic library(libgfortran-2e0d59d6.so.5.0.0) using an objcopy tool, but looks like it breaks file alignment, which is checked by python during a library load. Probably it is true for many other libraries, but…
1
vote
1 answer

Elegant way to get text section (.cmdline) from efi stub

I want to read the .cmdline section of a systemd efi stub (where initramfs, kernel and cmdline was inserted). $ cp linux.efi x.efi $ objcopy --dump-section .cmdline=/dev/stdout x.efi root=UUID=a6a7b817-0979-46f2-a6f7-dfa191f9fea4 rw $ cmp linux.efi…
Alai
  • 123
  • 1
  • 8
1
vote
1 answer

ELF-Editing: Replacing function in it's own section with different function

I have a .o object file which has a function that other functions in that same file are calling. That function is in it's own section and not exported. I need to replace this function with my own implementation. My own implementation needs external…
J. Doe
  • 53
  • 4
1
vote
2 answers

How can I hook a static function?

I'm trying to mock a static function without modifying the source code. This is because we have a large legacy base of code and we would like to add test code without requiring developers to go through and change a bunch of the original code. Using…
Maxthecat
  • 1,250
  • 17
  • 37
1
vote
2 answers

Redefining symbols from shared library

I have a requirement on changing certain symbols from shared library (.so) files like below example: i need to rename symbol abc in .so file to symbol xyz. I have a tool to replace it in header files, only challenge i am facing for changing in my…
praveen
  • 21
  • 3
1
vote
0 answers

redefine symbols for arm64 macOS

I have two static third-party libraries which have same exported symbol, and all of symbols I what to use in my shared library. objcopy can redefine symbols from library. After install binutils package from brew, extract all *.o files from static…
Fesss
  • 25
  • 5
1
vote
0 answers

Relocate files in .debug_line section

Is it possible to change the file paths in a .debug_line section in an ELF file? I'm trying to set up Debug Fission, so far I have my_library.so (in release mode, with no debug info) and my_library.so.dbg (with debug symbols). I've linked the two…
dogman288
  • 613
  • 3
  • 9
1
vote
1 answer

Converting an ELF binary into an .o file

The question is as stated in the title: Is it possible to convert an ELF binary file hello_world into an object file hello_world.o, which can be used to generate a new binary hello_world_2 which is a replica of hello_world? So from my searching, it…
Jay
  • 373
  • 1
  • 10
1
vote
1 answer

How to call a renamed symbol in an external object file?

I am trying to fuzz a particular piece of code using LLVM libFuzzer that only exposes its main() function externally. I have access to the source of the target code, but cannot change it. If I try to directly include the object file, it conflicts…
matoro
  • 181
  • 1
  • 13