From owner-freebsd-i386@FreeBSD.ORG Thu Dec 16 15:36:46 2010 Return-Path: Delivered-To: freebsd-i386@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45965106566C for ; Thu, 16 Dec 2010 15:36:46 +0000 (UTC) (envelope-from bugzilla@hotmail.fr) Received: from blu0-omc1-s30.blu0.hotmail.com (blu0-omc1-s30.blu0.hotmail.com [65.55.116.41]) by mx1.freebsd.org (Postfix) with ESMTP id 048418FC1B for ; Thu, 16 Dec 2010 15:36:45 +0000 (UTC) Received: from BLU155-W9 ([65.55.116.9]) by blu0-omc1-s30.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 16 Dec 2010 07:24:43 -0800 Message-ID: X-Originating-IP: [109.213.145.191] From: bug zilla To: Date: Thu, 16 Dec 2010 15:24:44 +0000 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 16 Dec 2010 15:24:43.0758 (UTC) FILETIME=[5D7E58E0:01CB9D35] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: [dev-asm] rtld don't find a strtab X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Dec 2010 15:36:46 -0000 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 =