Subject: Re: how to start a statically linked Linux program
To: None <netbsd-users@NetBSD.org>
From: Klaus Heinz <k.heinz.dez.sechs@kh-22.de>
List: netbsd-users
Date: 12/28/2006 19:20:38
Martin Husemann wrote:

> Your linux binary obviously is missing the necessary .note section.
> I think there is a "branding" tool out there to add it belatedly.

"readelf" has this to say:

  assertion "string_table != NULL" failed: file
  "/home/builds/ab/netbsd-3-0-RELEASE/src/gnu/dist/binutils/binutils/readelf.c", line 3122, function
  "process_program_headers"
  ELF Header:
    Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
    Class:                             ELF32
    Data:                              2's complement, little endian
    Version:                           1 (current)
    OS/ABI:                            UNIX - System V
    ABI Version:                       0
    Type:                              EXEC (Executable file)
    Machine:                           Intel 80386
    Version:                           0x1
    Entry point address:               0x805ccb0
    Start of program headers:          52 (bytes into file)
    Start of section headers:          148 (bytes into file)
    Flags:                             0x0
    Size of this header:               52 (bytes)
    Size of program headers:           32 (bytes)
    Number of program headers:         3
    Size of section headers:           40 (bytes)
    Number of section headers:         1
    Section header string table index: 0

  Section Header:
    [Nr] Name              Type          Addr     Off    Size   ES Flg Lk Inf Al
    [ 0] <corrupt>         NULL          00000000 000000 000000 00     0   0  0
  Key to Flags:
    W (write), A (alloc), X (execute), M (merge), S (strings)
    I (info), L (link order), G (group), x (unknown)
    O (extra OS processing required) o (OS specific), p (processor specific)

  Program Headers:
    Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
    LOAD           0x0000c0 0x080480c0 0x080480c0 0x4248f 0x4248f R E 0x4
    LOAD           0x043000 0x0808b000 0x0808b000 0x01b68 0x01b68 RW  0x4
    LOAD           0x045000 0x0808d000 0x0808d000 0x049bc 0x049bc R   0x4

   Section to Segment mapping:
    Segment Sections...

The .note sections of /rescue/ls (only .note.netbsd.ident) and
/emul/linux/sbin/ldconfig (.note.ABI-tag and .note) are different.
Which kind of .note should be added by whatever tool can do this?

ciao
     Klaus