Date: Sat, 08 Jul 2006 06:08:13 +0200 From: Victor Roman Archidona <daijo@unixevil.info> To: freebsd-hackers@freebsd.org, flameeyes@gentoo.org, spb@gentoo.org Subject: Static built binaries having unknown ELF binary types Message-ID: <44AF2FAD.5020205@unixevil.info>
next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, at first I should mention that this post is about Gentoo/FreeBSD for amd64 port, using the Gentoo portage system with FreeBSD sources, library and so on. If you're not interested in this you can stop reading now :-). I'm compiling "make" (usr.bin/make), but when I try to execute it I got the following results: root@localhost ~ # /usr/bin/make ELF binary type "0" not known. - -su: /usr/bin/make: cannot execute binary file root@localhost ~ # I must say that this *only* happends when "make" is built statically (if you want it compiled dynamically change the Makefile). This is the file information about it: root@localhost ~ # file /usr/bin/make /usr/bin/make: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for FreeBSD 6.1, statically linked, for FreeBSD 6.1, stripped root@localhost ~ # Doing some research I found that every static binary has the same issue, so consider the following example as trust of this: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { printf("it works!\n"); exit(EXIT_SUCCESS); } Compile it statically: root@localhost ~ # gcc -static test.c -o test root@localhost ~ # file test test: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for FreeBSD 6.1, statically linked, for FreeBSD 6.1, not stripped root@localhost ~ # Then run it: root@localhost ~ # ./test ELF binary type "0" not known. - -su: ./test: cannot execute binary file root@localhost ~ # Now it's time to do the same as dinamically: root@localhost ~ # gcc test.c -o test root@localhost ~ # file test test: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for FreeBSD 6.1, dynamically linked (uses shared libs), for FreeBSD 6.1, not stripped root@localhost ~ # ./test it works! root@localhost ~ # Can anyone point me a possible solution to fix this? I tried doing: "sysctl kern.default_elf_branding=9" but it's a hack and I think it should have a more elegant solution. For some system information, I have the following: binutils (version 2.17), available BFDs: elf64-x86-64 elf32-i386 elf32-i386-freebsd coff-i386 efi-app-ia32 elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex binary ihex binutils (version 2.16), available emulations: elf_x86_64_fbsd elf_i386_fbsd elf_x86_64 elf_i386 gcc: gcc (GCC) 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9) system: athlon64 3500+ freebsd sources used: 6.1-RELEASE Thanks for any input in advance, - -- Victor Roman Archidona -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (MingW32) iD8DBQFEry+sQ/ddYKMfqaARAqUeAJ9TTWBLAJCLxQ7pkNOZHWoc0qFkpQCfY9WT HO1N6kfSIgmROAFT1fxMp9o= =4vZz -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44AF2FAD.5020205>