elf

How to extract all functions out of a compiled elf file,even the function has no symbol [closed]

一世执手 提交于 2019-12-13 11:14:36
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 12 months ago . IDA can do this:some function with no symbol will named with 'sub_address'. How can I do this at runtime. enter image description here 回答1: How to extract all functions out of a compiled elf file,even the function has no symbol You don't define what is a function for you (and you really should).

How to determine which glibc function is called from binary?

半城伤御伤魂 提交于 2019-12-13 07:39:46
问题 Is there any way we could say which glibc function is called from ARM elf binary? For example, consider the following diassembly: 8300 <printf@plt-0x40>: .... 8320: e28fc600 add ip, pc, #0, 12 8324: e28cca08 add ip, ip, #8, 20 ; 0x8000 8328: e5bcf344 ldr pc, [ip, #836]! ; 0x344 .... 83fc <main>: ... 8424:ebffffbd bl 8320 <_init+0x2c> Here, how we can say that bl 8320 is a call to printf? Is this information stored in ELF binary somewhere? 回答1: Is there any way we could say which glibc

GCC-Assemby Error: Relocation R_X86_64_32S against '.data'

社会主义新天地 提交于 2019-12-13 05:59:26
问题 Situation Enviroment Arch Linux x86-64 (4.2.3-1-ARCH) GCC gcc (GCC) 5.2.0 Command gcc -Wall -g -o asm_printf asm_printf.s Error /usr/bin/ld: /tmp/cct4fa.o: Relocation R_X86_64_32S against '.data' can not be used when making a shared object; recompile with -fPIC /tmp/cct4fa.o:err adding symbols: Bad value collect2: error: ld returned 1 exit status Code .section .data msg: .asciz "Printf In Assembly!!\n" .section .text .globl main main: pushq $msg call printf addq $8 %esp pushq $0 call exit

Additional data present in flash after last loaded section of elf

感情迁移 提交于 2019-12-13 05:24:07
问题 I have a STM32 project which involves a bootloader. The bootloader CRCs the entire application region of flash and then compares this value against a firmware header stored just after the application image region in flash. I wrote a python script which runs after the binary is built. The script takes the elf file resulting from the build, and loads each section into a "virtual flash" image, which represents what should be exactly what is present on the mcu after the elf would be normally

Contiki: Error if ELF File contains calculation with several unsinged int

被刻印的时光 ゝ 提交于 2019-12-13 05:19:55
问题 I encountered some problems while working with the contiki ELF-loader and hope that someone would be so kind to provide me more insight or some hints to solve these problems. In the following I try to keep the problem description short. My aim is to: Execute an ELF file on a T-Mote-Sky. This ELF file contains a contiki process with a computation (linear regression of data samples over time). Using "cooja" for simulation Code specific information: ELF file size about 2000 bytes quite large

examining text segment in a statically linked executable

泪湿孤枕 提交于 2019-12-13 02:39:39
问题 I have a statically linked application binary that links against multiple user libraries and the pthread library. The application only uses a limited set of functions from each of these libraries. From a previous post Size of a library and the executable and from my experiments I realize that the linker only includes functions(in the executable) that are used/needed and not the entire contents of library. I want to find out which functions from each of the respective libraries are linked to

How to get a pointer to a specific executable file's section of a program from within itself? (Maybe with libelf)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 02:14:53
问题 I'm on a Linux environment and I need to make a program that retrieves some data that is placed in one of the sections of its executable file. So, how to get a pointer to a section of a program (by its name) from within itself? I know it's possible to use elf_getdata() passing the index of the section as argument to get and Elf_Data struct and one of the fields of this struct is d_buf , which is a pointer to the actual data. However, it seems the elf_getdata() function makes a copy of the

How set set entry point in a elf target using ld script

孤街浪徒 提交于 2019-12-13 01:17:23
问题 I want to specify the entry point to my ELF file using the linker script. I already defined some sections in my ELF, so want to set an entry point also withit. Can anyone tell me how to do it? 回答1: There's a special (GNU) linker script command that sets entry point to given symbol's address ENTRY(symbol) . Refer to official documentation. 回答2: First get the current linker script to a file with: ld --verbose a.o | sed '/======/,/======/!d;//d' > myscript Here we filtered the lines between ====

how can i get the source code path && file names from an ELF file(compired with -g)?

本秂侑毒 提交于 2019-12-12 21:23:43
问题 I want to get the source code path && source names just through the ELF file, the .debug_str section contains what i need, but how can i filter them out? 回答1: I suggest to use this command and tools like sed or grep. $ readelf --string-dump=.debug_str YOUR_PROGRAM this show path and source file name: $ readelf --string-dump=.debug_str YOUR_PROGRAM | sed -n '/\/\|\.c/{s/.*\] //p}' 回答2: $ readelf --string-dump=.debug_str YOUR_PROGRAM works fine. However, make sure your_program is not stripped

What sections are required for a usable ELF executable?

限于喜欢 提交于 2019-12-12 17:15:13
问题 I'm creating an ELF executable file and I need to know what sections are required by the operating system in order to load and execute it. Details: OS: Ubuntu 10.04 (64-bit) Kernel version: 2.6.32-24 Architecture: i386 I realize that the following would probably be necessary: .text .symtab .rel.text Are there others? 回答1: "A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux " has information on how to (ab)use the various ELF sections to make an executable as small as