Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Dec 2010 15:24:44 +0000
From:      bug zilla <bugzilla@hotmail.fr>
To:        <freebsd-i386@freebsd.org>
Subject:   [dev-asm] rtld don't find a strtab
Message-ID:  <BLU155-w9C1BAAC87CA0A2807C565B8150@phx.gbl>

next in thread | raw e-mail | index | archive | help

Hello=2C



I'm trying to code a tiny elf under freebsd=2C that means I'm writing its=20
header in full assembler. But I've a little problem=2C this message=2C=20
"Shared object has no run-time symbol table" appears when I'm trying to=20
execute it.

The piece of code in the freebsd src is (/usr/src/libexec/rtld-elf/rtld.c:1=
771):

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
if (obj->nbuckets =3D=3D 0 || obj->nchains =3D=3D 0 || obj->buckets =3D=3D =
NULL ||
    obj->symtab =3D=3D NULL || obj->strtab =3D=3D NULL) {
    _rtld_error("%s: Shared object has no run-time symbol table"=2C
      obj->path)=3B
    return -1=3B
}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Weirdly=2C my elf contains a strtab section.

Here is my code (sorry for the GAS syntax ): http://pastebin.com/3hdXT2ha

And here is the result of readelf -a main:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
readelf -a main
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 09 00 00 00 00 00 00 00 00=20
  Class:                             ELF32
  Data:                              2's complement=2C little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - FreeBSD
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x80481a8
  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:         4
  Section header string table index: 1

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk I=
nf Al
  [ 0] .text             PROGBITS        08048000 000000 0001b1 00  AX  0  =
 0 16
  [ 1] .strtab           STRTAB          08048159 000159 00001f 00   A  0  =
 0  1
  [ 2] .interp           PROGBITS        08048144 000144 000015 00   A  0  =
 0  1
  [ 3] .dynsym           DYNSYM          08048134 000134 000010 10   A  5  =
 0  1
Key to Flags:
  W (write)=2C A (alloc)=2C X (execute)=2C M (merge)=2C S (strings)
  I (info)=2C L (link order)=2C G (group)=2C x (unknown)
  O (extra OS processing required) o (OS specific)=2C p (processor specific=
)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  INTERP         0x000144 0x08048144 0x00000000 0x00015 0x00015 R   0x1
      [Requesting program interpreter: /libexec/ld-elf.so.1]
  LOAD           0x000000 0x08048000 0x00000000 0x001ad 0x001b1 RWE 0x1000
  DYNAMIC        0x000184 0x08048184 0x00000000 0x00024 0x00024 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     .interp=20
   01     .text .strtab .interp=20
   02    =20

Dynamic segment at offset 0x184 contains 5 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libX11.so.6]
 0x00000005 (STRTAB)                     0x8048159
 0x00000006 (SYMTAB)                     0x0
 0x00000015 (DEBUG)                      0x0
 0x00000000 (NULL)                       0x0

There are no relocations in this file.

There are no unwind sections in this file.

Symbol table '.dynsym' contains 1 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND (null)

No version information found in this file.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

We can clearly see the strtab.. So why the rtld don't find it.

PS: my code works perfectly under Linux
 		 	   		  =



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BLU155-w9C1BAAC87CA0A2807C565B8150>