[BSD] OFF: mips

Potoczky Andras andras-ml at wertz.hu
2013. Ápr. 25., Cs, 14:43:16 CEST


Megtalaltam a little endian forditasi opciot es itt a hello readelf es 
az sh readelf:

root at mips64:/home/andras/mips# readelf -h hello; readelf -h sh
ELF Header:
   Magic:   7f 45 4c 46 01 01 01 00 01 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:                       1
   Type:                              EXEC (Executable file)
   Machine:                           MIPS R3000
   Version:                           0x1
   Entry point address:               0x400220
   Start of program headers:          52 (bytes into file)
   Start of section headers:          2553788 (bytes into file)
   Flags:                             0x70001005, noreorder, cpic, o32, 
mips32r2
   Size of this header:               52 (bytes)
   Size of program headers:           32 (bytes)
   Number of program headers:         5
   Size of section headers:           40 (bytes)
   Number of section headers:         41
   Section header string table index: 38
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:                              EXEC (Executable file)
   Machine:                           MIPS R3000
   Version:                           0x1
   Entry point address:               0x403bd0
   Start of program headers:          52 (bytes into file)
   Start of section headers:          781968 (bytes into file)
   Flags:                             0x50001007, noreorder, pic, cpic, 
o32, mips32
   Size of this header:               52 (bytes)
   Size of program headers:           32 (bytes)
   Number of program headers:         8
   Size of section headers:           40 (bytes)
   Number of section headers:         30
   Section header string table index: 29


Most mar csak az ABI version elteres, de azt hiaba allitom. Lefordul, 
de 1-es marad.

A gcc verzio egyebkent 4.4.6

Feltoltottem a boxra a hello-t little endiannal. Most a hibauzenet:

#./hello
Illegal instruction

Valtozott valamit.

Andras



2013-04-25 14:33 időpontban Bukuli Norbert ezt írta:
> Mi a fordito verzioja?
>
> 2013/4/25 Potoczky Andras <andras-ml at wertz.hu>
>
>> Lassuk:
>>
>> root at mips64:/home/andras/mips# readelf -h hello
>> ELF Header:
>>   Magic:   7f 45 4c 46 01 02 01 00 01 00 00 00 00 00 00 00
>>
>>   Class:                             ELF32
>>   Data:                              2's complement, big endian
>>   Version:                           1 (current)
>>   OS/ABI:                            UNIX - System V
>>   ABI Version:                       1
>>   Type:                              EXEC (Executable file)
>>   Machine:                           MIPS R3000
>>   Version:                           0x1
>>   Entry point address:               0x400220
>>
>>   Start of program headers:          52 (bytes into file)
>>   Start of section headers:          2547360 (bytes into file)
>>   Flags:                             0x70001005, noreorder, cpic, 
>> o32, mips32r2
>>
>>   Size of this header:               52 (bytes)
>>   Size of program headers:           32 (bytes)
>>   Number of program headers:         5
>>   Size of section headers:           40 (bytes)
>>   Number of section headers:         41
>>   Section header string table index: 38
>> root at mips64:/home/andras/mips# readelf -h sh
>> 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:                              EXEC (Executable file)
>>   Machine:                           MIPS R3000
>>   Version:                           0x1
>>   Entry point address:               0x403bd0
>>
>>   Start of program headers:          52 (bytes into file)
>>   Start of section headers:          781968 (bytes into file)
>>   Flags:                             0x50001007, noreorder, pic, 
>> cpic, o32, mips32
>>
>>   Size of this header:               52 (bytes)
>>   Size of program headers:           32 (bytes)
>>   Number of program headers:         8
>>   Size of section headers:           40 (bytes)
>>   Number of section headers:         30
>>   Section header string table index: 29
>>
>> Latom, big endian es little endian elteres van.
>>
>> Gyorasan utannaneztem, marha egyszeru mbig-endian mlittle-endian 
>> optiokat kene hasznalni, csak a compiler ezeket nem ismeri.
>>
>> Turom meg, hatha ez lesz a jo irany.
>>
>> Andras
>>
>> 2013-04-25 14:00 időpontban Bukuli Norbert ezt írta:
>>
>>> Hasznos lehet a readelf is. Pl:
>>>
>>> $ readelf -h my_powerpc_program
>>>
>>> ELF Header:
>>>   Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 
>>>   Class:                             ELF32
>>>   Data:                              2's complement, big endian
>>>   Version:                           1 (current)
>>>   OS/ABI:                            UNIX - System V
>>>   ABI Version:                       0
>>>   Type:                              EXEC (Executable file)
>>>   Machine:                           PowerPC
>>>   Version:                           0x1
>>>   Entry point address:               0x10001cb8
>>>   Start of program headers:          52 (bytes into file)
>>>   Start of section headers:          23156 (bytes into file)
>>>   Flags:                             0x0
>>>   Size of this header:               52 (bytes)
>>>   Size of program headers:           32 (bytes)
>>>   Number of program headers:         8
>>>   Size of section headers:           40 (bytes)
>>>   Number of section headers:         40
>>>   Section header string table index: 37
>>>
>>> $ readelf -h /bin/bash
>>>
>>> ELF Header:
>>>   Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
>>>   Class:                             ELF64
>>>   Data:                              2's complement, little endian
>>>   Version:                           1 (current)
>>>   OS/ABI:                            UNIX - System V
>>>   ABI Version:                       0
>>>   Type:                              EXEC (Executable file)
>>>   Machine:                           Advanced Micro Devices X86-64
>>>   Version:                           0x1
>>>   Entry point address:               0x419490
>>>   Start of program headers:          64 (bytes into file)
>>>   Start of section headers:          719608 (bytes into file)
>>>   Flags:                             0x0
>>>   Size of this header:               64 (bytes)
>>>   Size of program headers:           56 (bytes)
>>>   Number of program headers:         10
>>>   Size of section headers:           64 (bytes)
>>>   Number of section headers:         27
>>>   Section header string table index: 26
>>>
>>> 2013. április 25. 13:49 írta, <gabor at zahemszky.hu>:
>>>
>>>> 2013-04-25 13:48 időpontban Potoczky Andras ezt írta:
>>>>
>>>>> A boxon nem tudom kiadni, mert nincs file, de elozo emailben pont
>>>>> elkuldtem, a fordito gepen a file kimenetet. Valami ilyen hiba 
>>>>> lesz
>>>>> amit irsz, nem ertelmezi, csak meg nem jottem ra mitol fogja
>>>>> ertelmezni.
>>>>
>>>> De azt is írtam, hogy egy a dobozról származó binárist (/bin/sh) 
>>>> is
>>>> nézzél meg a fejlesztői gépeden és hasonlítsd össze őket.




További információk a(z) BSD levelezőlistáról