View previous topic :: View next topic |
Author |
Message |
Alberto Santini Tux's lil' helper
Joined: 03 Jul 2005 Posts: 88 Location: Italy->Sicily->Caltanissetta
|
Posted: Mon Jan 23, 2006 5:42 pm Post subject: [RISOLTO] Non posso piu' eseguire file di tipo a.out |
|
|
Da ieri a oggi, senza emergere niente, o modificare niente di significativo, non posso piu' eseguire file appena compilati...
Un esempio (con un file che *e' impossibile non fare* funzionare):
Il sorgente
Code: |
#include <stdio.h>
int main() {
printf("Testing compiler\n");
return 0;
}
|
Compiliamolo
gcc -Wall -o wawa -c wawa.c
Diamogli sufficienti permessi
chown `whoami`:users wawa
chmod 755 wawa
Eseguiamolo
./wawa
bash: ./wawa: cannot execute binary file
Visto con less
less wawa
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: REL (Relocatable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 264 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 40 (bytes)
Number of section headers: 11
Section header string table index: 8
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 000034 00002f 00 AX 0 0 4
[ 2] .rel.text REL 00000000 000374 000010 08 9 1 4
[ 3] .data PROGBITS 00000000 000064 000000 00 WA 0 0 4
[ 4] .bss NOBITS 00000000 000064 000000 00 WA 0 0 4
[ 5] .rodata PROGBITS 00000000 000064 000012 00 A 0 0 1
[ 6] .note.GNU-stack PROGBITS 00000000 000076 000000 00 0 0 1
[ 7] .comment PROGBITS 00000000 000076 00003e 00 0 0 1
[ 8] .shstrtab STRTAB 00000000 0000b4 000051 00 0 0 1
[ 9] .symtab SYMTAB 00000000 0002c0 0000a0 10 10 8 4
[10] .strtab STRTAB 00000000 000360 000014 00 0 0 1
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)
There are no section groups in this file.
There are no program headers in this file.
Relocation section '.rel.text' at offset 0x374 contains 2 entries:
Offset Info Type Sym.Value Sym. Name
0000001f 00000501 R_386_32 00000000 .rodata
00000024 00000902 R_386_PC32 00000000 printf
There are no unwind sections in this file.
Symbol table '.symtab' contains 10 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 FILE LOCAL DEFAULT ABS wawa.c
2: 00000000 0 SECTION LOCAL DEFAULT 1
3: 00000000 0 SECTION LOCAL DEFAULT 3
4: 00000000 0 SECTION LOCAL DEFAULT 4
5: 00000000 0 SECTION LOCAL DEFAULT 5
6: 00000000 0 SECTION LOCAL DEFAULT 6
7: 00000000 0 SECTION LOCAL DEFAULT 7
8: 00000000 47 FUNC GLOBAL DEFAULT 1 main
9: 00000000 0 NOTYPE GLOBAL DEFAULT UND printf
No version information found in this file.
E' un problema di gcc che compila bestialità... o cos'altro? E' abbastanza inquietante....
Ciao e grazie
Last edited by Alberto Santini on Mon Jan 23, 2006 6:53 pm; edited 1 time in total |
|
Back to top |
|
|
Nuitari Apprentice
Joined: 15 May 2005 Posts: 245
|
Posted: Mon Jan 23, 2006 6:26 pm Post subject: |
|
|
incredibile oggi pom e' successo anche a me :O |
|
Back to top |
|
|
Alberto Santini Tux's lil' helper
Joined: 03 Jul 2005 Posts: 88 Location: Italy->Sicily->Caltanissetta
|
Posted: Mon Jan 23, 2006 6:40 pm Post subject: |
|
|
Sara' l'energia malefica dello spirito di Redmond |
|
Back to top |
|
|
silian87 Advocate
Joined: 06 Oct 2003 Posts: 2318 Location: Treviso, Italy
|
|
Back to top |
|
|
Alberto Santini Tux's lil' helper
Joined: 03 Jul 2005 Posts: 88 Location: Italy->Sicily->Caltanissetta
|
Posted: Mon Jan 23, 2006 6:48 pm Post subject: |
|
|
Individuato il problema:
Tracciamo le syscall
strace ./wawa
execve("./src/c/wawa", ["./src/c/wawa"], [/* 55 vars */]) = -1 ENOEXEC (Exec format error)
dup(2) = 3
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f97000
_llseek(3, 0, 0xbf9a7d50, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: Exec format error\n", 32strace: exec: Exec format error
) = 32
close(3) = 0
munmap(0xb7f97000, 4096) = 0
exit_group(1) = ?
"Exec format error" ma.. da cos'e' causato? da gcc.. se si, come emergo un gcc funzionante avendo a disposizione un gcc fasullo? Usare un gcc binario potrebbe essere un'idea, ma dove trovo il pacchetto binario per gentoo?
Ciao! |
|
Back to top |
|
|
silian87 Advocate
Joined: 06 Oct 2003 Posts: 2318 Location: Treviso, Italy
|
Posted: Mon Jan 23, 2006 6:50 pm Post subject: |
|
|
Non sono un esperto di gcc... anzi... ma facendo delle prove sembrerebbe che il problema sia l'opzione "-c", che a vedere dal man fa:
Quote: | For example, the -c option says not
to run the linker. |
Infatti se lancio tutto cosi':
Code: | silian87@DarkThunder ~ $ gcc -Wall -o lol lol.c
silian87@DarkThunder ~ $ ./lol
Testing compiler
|
Funziona.
Non e' che hai messo quell'opzione per sbaglio? _________________ Musica che ascolto: http://www.last.fm/user/silian87/
Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt
GTalk: silian87@gmail.com |
|
Back to top |
|
|
Alberto Santini Tux's lil' helper
Joined: 03 Jul 2005 Posts: 88 Location: Italy->Sicily->Caltanissetta
|
Posted: Mon Jan 23, 2006 6:50 pm Post subject: |
|
|
Ecco.. non era niente di esoterico... solo una ****** del genere
ho usato "gcc !* wawa.c" e mi sono restate tutte le opzioni del precedente utilizzo
ok.. risolto! |
|
Back to top |
|
|
Nuitari Apprentice
Joined: 15 May 2005 Posts: 245
|
Posted: Tue Jan 24, 2006 10:08 am Post subject: |
|
|
ok sono un mongolo crocifiggetemi pure....
nei miei appunti di sistemi operativi non avevo letto che dopo dovevo anche linkare il file -__-
*si va a nascondere in un angolino* |
|
Back to top |
|
|
silian87 Advocate
Joined: 06 Oct 2003 Posts: 2318 Location: Treviso, Italy
|
|
Back to top |
|
|
|