flat assembler
Message board for the users of flat assembler.

Index > Linux > Error when linking fasm.o to create fasm

Author
Thread Post new topic Reply to topic
stevenyhw



Joined: 17 Oct 2015
Posts: 4
stevenyhw 17 Oct 2015, 20:20
I just downloaded "flat assembler 1.71.39 for Unix/libc". I tried to link fasm.o to create the fasm executable with gcc but I got an error:

fasm.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status


The command I used was:
gcc fasm.o -o fasm

My operating system is CentOS 6.6 (x86_64) with gcc 4.4.7. Can anyone give me some pointer on how to fix this issue? Thanks.
Post 17 Oct 2015, 20:20
View user's profile Send private message Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP 17 Oct 2015, 22:59
Aren't you using x64 gcc? The fasm.o file is 32-bit ELF. You may need to install gcc for x86.
Post 17 Oct 2015, 22:59
View user's profile Send private message Reply with quote
stevenyhw



Joined: 17 Oct 2015
Posts: 4
stevenyhw 17 Oct 2015, 23:31
Yes, I think the gcc bundled with CentOS is x64 gcc. Is there a way to generate an fasm.o in 64-bit ELF format? Thanks.
Post 17 Oct 2015, 23:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20361
Location: In your JS exploiting you and your system
revolution 18 Oct 2015, 00:01
Code:
format elf64 ...    
Post 18 Oct 2015, 00:01
View user's profile Send private message Visit poster's website Reply with quote
stevenyhw



Joined: 17 Oct 2015
Posts: 4
stevenyhw 18 Oct 2015, 01:00
Thanks. I changed that line and I also tried to convert "esp" to "rsp" and "ebp" to "rbp" in the file libc/fasm.asm, but then I got a further error "pushd arg error: illegal instruction". I have never learned assembly before, so this is really challenging for me. I guess I have to read the manual and figure what how to covert a 32-bit assembly code to the 64bit version.
Post 18 Oct 2015, 01:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20361
Location: In your JS exploiting you and your system
revolution 18 Oct 2015, 01:11
If you are trying to convert fasm (the entire source) to 64-bit then you are in for a lot of work.

Perhaps better if you can get your system to run 32-bit executables first.
Post 18 Oct 2015, 01:11
View user's profile Send private message Visit poster's website Reply with quote
stevenyhw



Joined: 17 Oct 2015
Posts: 4
stevenyhw 18 Oct 2015, 01:22
Okay. Thanks for the advice.
Post 18 Oct 2015, 01:22
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 18 Oct 2015, 07:32
revolution wrote:
Perhaps better if you can get your system to run 32-bit executables first.


AFAIK, every 64 bit Linux can run 32 bit executables. The problem is with the missing libraries. But FASM for Linux uses only system calls, so it should work like a charm. But yes, linking the libc version will need 32 bit compiler and 32 bit libraries.

Anyway, it is very strange, why one will need to link FASM for libc on Linux? There is normally working version FASM for Linux. IMO, the libc version is only for systems different than Linux. A fall-back, that gives additional level of portability.

_________________
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9
Post 18 Oct 2015, 07:32
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
alkap



Joined: 18 Feb 2015
Posts: 44
Location: Dnipro, Ukraine
alkap 18 Oct 2015, 08:03
Do you have the package below installed?
Quote:

glibc.i686

If not, you may want to try installing it. The folks on the CentOS forum suggest installing it. See the link below.

https://www.centos.org/forums/viewtopic.php?t=14169
Post 18 Oct 2015, 08:03
View user's profile Send private message Send e-mail Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 18 Oct 2015, 15:49
After you have installed the i386 development environment just issue
Code:
gcc -m32 fasm.o -o fasm    


Edit: I forgot to mention that although it works for me in this way, but I'm on Linux Mint 17.2.
Post 18 Oct 2015, 15:49
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.