elf2flt questions

Denys Vlasenko vda.linux at googlemail.com
Thu Jun 5 00:38:00 UTC 2008


On Thursday 05 June 2008 02:13, Denys Vlasenko wrote:
> Can you write up a small explanation what elf2flt does, how to produce
> a flat executable with it? Let's say in my situation - I seem to have
> correctly built static elf bfin busybox, can I make a flat one out of it?

Straightforward approach suggested by "elf2flt --help" doesn't work:

# ./elf2flt busybox_unstripped -a -o busybox_unstripped.flat
busybox_unstripped: Input file contains no relocation info

Obviously, input file should be something different than
static elf binary... heeeeelp :)


Sanity check: is it really an elf blackfin? Looks like it:

# bfin-linux-uclibc-objdump -xrd busybox_unstripped

busybox_unstripped:     file format elf32-bfinfdpic
busybox_unstripped
architecture: bfin, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x000000b0

Program Header:
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
         filesz 0x000bd4e4 memsz 0x000bd4e4 flags r-x
    LOAD off    0x000bd4e4 vaddr 0x000c14e4 paddr 0x000c14e4 align 2**12
         filesz 0x0000879c memsz 0x00009f84 flags rw-
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**3
         filesz 0x00000000 memsz 0x00020000 flags rwx
private flags = 2: -mfdpic

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .init         0000001a  00000094  00000094  00000094  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .text         00094d40  000000b0  000000b0  000000b0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
...
...
...
00001cec g     F .text  00000028 .hidden _xopen3
000855d0 g     F .text  00000358 _strptime
000782f4 g     F .text  000000ba _encrypt


Disassembly of section .init:

00000094 <__init>:
  94:   4b 01           [--SP] = P3;
  96:   00 e8 03 00     LINK 0xc;               /* (12) */
  9a:   73 ad           P3 = [SP + 0x14];
  9c:   00 e3 dc 00     CALL 0x254 <_frame_dummy>;
  a0:   73 ad           P3 = [SP + 0x14];
  a2:   04 e3 95 a6     CALL 0x94dcc <___do_global_ctors_aux>;
  a6:   01 e8 00 00     UNLINK;
  aa:   73 90           P3 = [SP++];
  ac:   10 00           RTS;
Disassembly of section .text:

000000b0 <__start>:
      b0:       00 e3 02 00     CALL 0xb4 <__start+0x4>;
      b4:       27 31           R4 = RETS;
      b6:       a6 6f           SP += -0xc;             /* (-12) */
...

--
vda



More information about the uClibc mailing list