elf

Packing a file into an ELF executable

Hello, I'm currently looking for a way to add data to an already compiled ELF executable, i.e. embedding a file into the executable without recompiling it. I could easily do that by using cat myexe mydata > myexe_with_mydata, but I couldn't access the data from the executable because I don't know the size of the original executable. D...

libxml-ruby failed to load at x86_64

We are having problem with libxml-ruby gem at the server side Possible because it uses x86_64 architecture: $ uname -a Linux ip-10-228-171-64 2.6.21.7-2.fc8xen-ec2-v1.0 #1 SMP Tue Sep 1 10:25:30 EDT 2009 x86_64 GNU/Linux require 'libxml' LoadError: /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml_ruby.so: ...

Flush ELF section from RAM after library initialization

I have a lot of code in an ELF shared library that is only used during library initialization (it's called from static initializers). If I put this code in its own section (or perhaps it can go in the .init section), which I can do using __attribute__((section(".mysection"))), is there a way to force this section to be paged out after t...

Access ELF string table section header

Assume the following: Elf_Section_Header *sectionHeaderTable //points to the start of a ELF section header table Elf_Section_Header *symtabHeader //points to the start of the symtab section header Why doesn't the following point me to the associated string table section header? Elf_Section_Header *strTabSectionHeader = (Elf_Section_...

Building elf within Eclipse within Windows

Hey guys, I'm having trouble building an Elf file within Eclipse within Windows. It seems that everytime I build, a PE / portable executable for windows is created. I've gone into the Binary Parser section and checked Elf Parser while making sure that everything else is unchecked. However, I continue to end up with a PE which I cannot r...

Why do virtual memory addresses for linux binaries start at 0x8048000?

Disassembling an ELF binary on a Ubuntu x86 system I couldn't help but notice that the code(.text) section starts from the virtual address 0x8048000 and all lower memory addresses seem to be unused. This seems to be rather wasteful and all Google turns up is either folklore involving STACK_TOP or protection against null-pointer derefer...

How can I find the size of a ELF file/image with Header information?

I need to find the size of an elf image for some computation. I have tried with the readelf utility on linux which gives the informations about the headers and section. I need to have the exact file size of the elf(on the whole). How do I find the size of the ELF from the header information or Is there any other means to find the size o...

How to hook a function for a particular shared ELF library?

LD_PRELOAD hooks some functions for the entire process, but I need to hook a particular function for only one dynamically linked library by its name. ...

readelf coloumns

Could someone explain me the column headers when you display the symbol table using readelf ? ...

Any libraries of reading & writing binary file formats (PE & ELF)?

HellO, I want to write a binary file format viewer for windows which can operate on both PE & ELF files. Similar to the ones already there: PE Explorer http://www.pe-explorer.com/ PE VIew: http://www.magma.ca/~wjr/ PEBrowse Professional http://www.smidgeonsoft.prohosting.com/pebrowse-pro-file-viewer.html I've reasons why I want to ...

Question about the ELF file format - sh_addr always equals sh_offset ?

Hey, recently (yay no more school) I've been teaching myself about the ELF file format. I've largely been following the documentation here: http://www.skyfree.org/linux/references/ELF_Format.pdf. It was all going great, and I wrote this program to give me info about an ELF file's sections: #include <stdio.h> #include <stdlib.h> #inclu...

ELF File Format

I'm attempting to manually load the hexdump of an elf file that I compiled using g++ into a processor simulation I designed. There are 30 sections to a standard elf file and I am loading all 30 segments with their proper memory location offset taken into account. I then start my program counter at the beginning of the .text section (0040...

Should I use ELF or CLF for logs?

Obviously ELF was written as a more flexible alternative to CLF, but are there any cases where it is preferable to use CLF? For new projects should I just use ELF off the bat? In general I'm mostly logging HTTP request/responses. However these may include logging cookies, HTTP params, and other specific fields, etc. ...

Difference in position-independent code: x86 vs x86-64

I was recently building a certain shared library (ELF) targeting x86-64 architecture, like this: g++ -o binary.so -shared --no-undefined ... -lfoo -lbar This failed with the following error: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC Of course, it means I nee...

Change SONAME of an existing shared library?

Is it possible to change SONAME of a shared library without rebuilding it? I've found hints pointing out that it's hard, but it does not say it's outright impossible. ...

Tool for modifying dynamic section of an ELF binary

Is there a tool for modifying the shared library entries in the dynamic section of an ELF binary? I would like to explicitly modify the shared library dependencies in my binary (i.e. replace path to existing library with a custom path) ...

How does a compiled C++ class look like?

Hi all, With some background in assemble instructions and C programs, I can visualize how a compiled function would look like, but it's funny I have never so carefully thought about how a compiled C++ class would look like. bash$ cat class.cpp #include<iostream> class Base { int i; float f; }; bash$ g++ -c class.cpp I ran: bash$obj...

How does a compiled definition of struct look like in C?

Possible Duplicate: How does a compiled C++ class look like? Hi all, bash$cat struct.c struct test { int i; float f; }; bash$gcc -c struct.c The object file struct.o is of elf format. I am trying to understand what does this object file contain. The source code is just a definition of a struct. There is nothing executable...

Modifying Shared Libraries in Linux

Is it possible to modify a shared library (.so) in Linux without getting its source code??? I know about LD_PRELOAD, but is that useful for functions that are used IN the shared library itself??? Is there a way to decompile/disassemble and then recompile/reassemble binary ELF files? ...

Stack, Frame, Global Pointer and ELF files

How do I determine where the stack, global, and frame pointers are in my ELF file? ...