elf

Is there a standard encoding for NEEDED entries in ELF?

I'm trying to make some of my code a bit more friendly to non-pure-ascii systems and was wondering if there was a particular character encoding used for NEEDED entries in ELF binaries, or is it rather unstandard and based on the creating system's filesystem encoding (or even just directly the bytes that were passed to whatever created th...

Convert memory address range in running Linux process to symbols in object file?

Here is a snippet of the file /proc/self/smaps: 00af8000-00b14000 r-xp 00000000 fd:00 16417 /lib/ld-2.8.so Size: 112 kB Rss: 88 kB Pss: 1 kB Shared_Clean: 88 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 0 kB Referenced: 88 kB Sw...

GCC/ELF - from where comes my symbol ?

There is an executable that is dynamically linked to number of shared objects. How can I determine, to which of them some symbol (imported into executable) belongs ? If there are more than one possibility, could I silmulate ld and see from where it is being taken ? ...

How the basic link process works for ELF and PE

I've always been confused about how the linker works, and it's a difficult subject to search for. To demonstrate my question and to provide a framework for an answer, I'll put down what I know (or think I know) so far. I may be very wrong. :) First, each .cpp file is built into an intermediate file (.o for Posix/ELF and .obj for Win/PE...

Relocatable symbols in ELF format (assembly language)

We are developing a port of the GNU Assembler for a client architecture. Now the problem being faced is that: If an immediate operand to an instruction is an expression involving more than one relocatable symbols, how is it handled in output file in elf format. What will be the relocation information produced in such a case? For exampl...

Code injection - Solaris & Linux

I have an executable module created by third party. I would like to "inject" my code (kind of watchdog running in separate thread) into this process. So far there are two possible ways - one is to run my code as executable and dynamically load a proess on top of it (seems to be very hard and tricky) or to make my code a shared object, ...

Pack shared libraries into the elf

Is there a utility that can take ALL the SO's that an Elf needs turn them into static then converts the Elf to be SO's free? ...

write-protected virtual pages, catch write

Does there exist a way to catch a write into write-protected page? I plan doing a self -like object system where you copy the object to instantiate it. (because it sounds simple and compact thing compared to the rest) Obviously, the objects created for this purpose ought be write-protected some way. I've seen there's a way to flag somet...

C++ ctor question (linux)

environment: linux, userspace-application created via g++ from a couple of C++ files (result is an ELF) there is a problem (SIGSEGV) when traversing the constructor list ( __CTOR_LIST__ ) (note: code called via this list is a kind of system initialisation for every class, not the constructor-code I wrote) when I understan...

ELF file versions

Hi guys, I'm working on a clone of the elfdump command. My program works fine when running 'elfdump -ecps file` on all executables. However, when I run my program on a library file, say libc.so, it prints out an incorrect version number for all symbols in the .symtab section (specifically they are all zero). I've looked over the documen...

How can I best pass a Global Offset Table (GOT) for my language on x86?

I'm writing a small program loader for my language because I gave up on understanding ELF format (and while doing this, I may eventually understand it better). I mmap the files on the memory and tux rejoices whatever.. I don't want to hinder the sharing of the program by doing any changes on it. Therefore I end up doing the same as C an...

.bss section in elf file

If I understand correctly, the .bss section in ELF files is used to allocate space for zero-initialized variables. Our tool chain produces ELF files, hence my question: does the .bss section actually have to contain all those zeroes? It seems such an awful waste of spaces that when, say, I allocate a global ten megabyte array, it results...

in Java: programmatically determining addresses of C/C++ variables given a COFF/ELF/DWARF executable

This is a situation I run into now and then: For an embedded system which does not use virtual addressing, I have an executable file that was compiled from C or C++ code with debugging information included. It's usually in COFF or ELF/DWARF (I get those two mixed up) format. At runtime, on a PC, I would like to determine the address of...

Converting kernel image from ELF to PE

I am using Msys to build a home brew kernel that I wrote under Linux. Linux used ELF for its binary format and Msys uses PE. I have the source setup to allow it to be booted by Grub using the Multiboot spec. At the end of the build, I get some undefined symbols: init.o:init.S:(.text+0x14): undefined reference to `edata' main.o:main....

Is there a system where executing a program and calling a function is unified?

I would like to be able to do one or more of the following from the shell: - call any function from the program not only the main - pass parameters that are not only strings (not only argv) - have a program return not only int (the return code from main) - assign returned values to shell-level variables to be able to pass them to oth...

compile AMR-nb codec with RVCT for WinCE/Window Mobile

Hello everybody, I'm working on amr speech codec (porting/optimization) I have an arm (for WinCE) optimized version from voiceage and I use it as a reference in performance testing. So far, binary produced with my lib beats the other one by around 20-30%! I use Vs2008 and I have limited access to ARM instruction set I can generate with M...

Modifying elf file

Hi I would like to add a new flag to an elf file. This flag should then be available to the kernel in the process descriptor. My first idea was to use libelf, but unfortunately there seems to be a bug with it on Ubuntu. Elfedit would have probably been a nice tool but I have not found a version for Linux, in particular Ubuntu. So, I am...

Article/book: from source code to executable program?

I'm looking for a "human readable" article which describes, with examples, if possible, the transition from source code, say C, to an executable program. Ideally, the article shall contain descriptions about the object file format, how different sections of the code maps to to that of object files et.al. That hypothetical article would a...

Adding section to ELF file

I need to be able to add an arbitrary section to an ELF file. I cannot use GPL code in this program, so BFD is out of the question. I can use libelf/gelf to read sections, but the documentation is fairly sparse for these, and I cannot figure out how to add a section. Does anybody know how to do this? I would rather not write my own ELF c...

Library to read ELF file DWARF debug information

Any recommendations for a good cross-platform library for reading ELF file debug information in DWARF format? I'd like to read the DWARF debug info in a Python program. ...