bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Embedding ELFs, Using objcopy and/or xdd


From: mondialeeer
Subject: Embedding ELFs, Using objcopy and/or xdd
Date: Tue, 18 Nov 2008 12:14:01 -0800 (PST)

I am currently trying to embed an ELF into a larger ELF that will manage this
ELF (boostrap it and execute it).

Extra information is inserted when trying to embed an ELF into a larger ELF. 
This extra info makes the "start" and "end" labels useless if code in the
larger ELF would like to jump to the beginning of the code section in the
embedded ELF.

For instance:
> xdd -i small_elf.o small_elf.c

Results in...

unsigned char executable_elf[] = {
   2   0x7f, 0x45, 0x4c, 0x46, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00,
   3   0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xba, 0xab, 0x00, 0x00, 0x00,
0x01,
   4   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x47,
0xac,
   5   0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x20, 0x00, 0x07, 0x00,
0x28,

Whereas the first instruction in this ELF is :

 00000000 <_start>:
   7    0:   b8080050    brai    80  // 50 <_TEXT_START_ADDR>
   8 Disassembly of section .vectors.sw_exception:

Which is located on line 25 of the .c file generated by xdd (or 25*3 words
deep from the start label of the .o file generated by objcopy).

Is this extra information the binary encoded symbol table of the ELF?  Is
there a method to find out how much data will be inserted, so that the
correct offset into the program can be found?  Any help/suggestions would be
greatly appreciated.

Thanks,



-- 
View this message in context: 
http://www.nabble.com/Embedding-ELFs%2C-Using-objcopy-and-or-xdd-tp20567343p20567343.html
Sent from the Gnu - Binutils - Bugs mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]