From owner-freebsd-hackers Thu Apr 3 09:42:44 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id JAA04867 for hackers-outgoing; Thu, 3 Apr 1997 09:42:44 -0800 (PST) Received: from mexico.brainstorm.eu.org (mexico.brainstorm.fr [193.56.58.253]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id JAA04859 for ; Thu, 3 Apr 1997 09:42:38 -0800 (PST) Received: from brasil.brainstorm.eu.org (brasil.brainstorm.fr [193.56.58.33]) by mexico.brainstorm.eu.org (8.8.4/8.8.4) with ESMTP id TAA30390; Thu, 3 Apr 1997 19:42:25 +0200 Received: (from uucp@localhost) by brasil.brainstorm.eu.org (8.8.4/8.6.12) with UUCP id TAA06758; Thu, 3 Apr 1997 19:42:24 +0200 Received: (from roberto@localhost) by keltia.freenix.fr (8.8.5/keltia-uucp-2.9) id TAA29827; Thu, 3 Apr 1997 19:12:10 +0200 (CEST) Message-ID: <19970403191209.52889@keltia.freenix.fr> Date: Thu, 3 Apr 1997 19:12:09 +0200 From: Ollivier Robert To: "Nickolay N. Dudorov" Cc: "FreeBSD Hackers' list" Subject: Re: FreeBSD Elf-Kit and dynamic loading References: <5i0j1d$jtk@news.itfs.nsk.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.67 In-Reply-To: <5i0j1d$jtk@news.itfs.nsk.su>; from Nickolay N. Dudorov on Thu, Apr 03, 1997 at 03:40:29PM +0000 X-Operating-System: FreeBSD 3.0-CURRENT ctm#3153 Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk According to Nickolay N. Dudorov: > And after that I discovered that 'file hello' > says: > hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD) > > and file 'hello' is 47761 bytes long. > > So, there is a question - is there any possibility to > build "dynamic ELF" program ? My elf-gcc produce identical results > with and without '-static' flag. Are you sure you have the right naming for the libraries ? 258 [19:05] roberto@keltia:/tmp> cat foo.c main(){} 260 [19:06] roberto@keltia:/tmp> cc foo.c -o foo -v Reading specs from /usr/local/elf/lib/gcc-lib/i386-unknown-freebsdelf/2.7.2.1/specs gcc version 2.7.2.1 /usr/local/elf/lib/gcc-lib/i386-unknown-freebsdelf/2.7.2.1/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -Dunix -Di386 -D__ELF__ -D__FreeBSD__=2 -D__unix__ -D__i386__ -D__ELF__ -D__FreeBSD__=2 -D__unix -D__i386 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386) foo.c /tmp/cc029804.i GNU CPP version 2.7.2.1 (i386 FreeBSD/ELF) #include "..." search starts here: #include <...> search starts here: /usr/local/elf/lib/gcc-lib/i386-unknown-freebsdelf/2.7.2.1/include /usr/local/elf/lib/gcc-lib/i386-unknown-freebsdelf/2.7.2.1/sys-include /usr/local/elf/i386-unknown-freebsdelf/include End of search list. /usr/local/elf/lib/gcc-lib/i386-unknown-freebsdelf/2.7.2.1/cc1 /tmp/cc029804.i -quiet -dumpbase foo.c -version -o /tmp/cc029804.s GNU C version 2.7.2.1 (i386 FreeBSD/ELF) compiled by GNU C version 2.7.2.1. /usr/local/elf/i386-unknown-freebsdelf/bin/as -V -Qy -o /tmp/cc0298041.o /tmp/cc029804.s GNU assembler version 2.7 (i386-unknown-freebsdelf), using BFD version 2.7 /usr/local/elf/i386-unknown-freebsdelf/bin/ld -m elf_i386 -dynamic-linker /usr/libexec/ld-elf.so.1 -o foo /usr/local/elf/i386-unknown-freebsdelf/lib/crt1.o /usr/local/elf/i386-unknown-freebsdelf/lib/crti.o /usr/local/elf/i386-unknown-freebsdelf/lib/crtbegin.o -L/usr/local/elf/lib/gcc-lib/i386-unknown-freebsdelf/2.7.2.1 -L/usr/local/elf/i386-unknown-freebsdelf/lib /tmp/cc0298041.o -lgcc -lc -lgcc /usr/local/elf/i386-unknown-freebsdelf/lib/crtend.o /usr/local/elf/i386-unknown-freebsdelf/lib/crtn.o 261 [19:06] roberto@keltia:/tmp> ll foo -rwxr-xr-x 1 roberto wheel 4124 Apr 3 19:06 foo 262 [19:07] roberto@keltia:/tmp> size foo text data bss dec hex filename 652 811 8 1471 5bf foo In /usr/local/elf/lib: -r--r--r-- 1 bin bin 939192 Apr 3 19:01 libc.a -r--r--r-- 2 bin bin 465883 Apr 3 18:59 libc.so -r--r--r-- 2 bin bin 465883 Apr 3 18:59 libc.so.1 -r--r--r-- 1 bin bin 1009454 Apr 3 19:01 libc_pic.a With -static the executable is -rwxr-xr-x 1 roberto wheel 44788 Apr 3 19:11 foo objdump --all-headers gives: foo: file format elf32-i386 foo architecture: i386, flags 0x00000112: EXEC_P, HAS_SYMS, D_PAGED start address 0x080482e0 ... Dynamic Section: NEEDED libc.so.1 INIT 0x8048294 FINI 0x8048520 ... Sections: Idx Name Size VMA LMA File off Algn 0 .interp 00000019 080480d4 080480d4 000000d4 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .hash 00000048 080480f0 080480f0 000000f0 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .dynsym 000000d0 08048138 08048138 00000138 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .dynstr 00000071 08048208 08048208 00000208 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 4 .rel.plt 00000018 0804827c 0804827c 0000027c 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA ... -- Ollivier ROBERT -=- FreeBSD: There are no limits -=- roberto@keltia.freenix.fr Usenet Canal Historique