flat assembler
Message board for the users of flat assembler.
Index
> Linux > .o for linking with gcc? |
Author |
|
revolution 10 Jul 2015, 12:51
I expect you need ELF format, not COFF.
|
|||
10 Jul 2015, 12:51 |
|
alkap 10 Jul 2015, 16:25
roxaz wrote: Can fasm produce .o for linking it with gcc on linux? I am not sure how COFF is different from MS COFF but neither works. Im writing hoping i missed something in docs. The 'examples/elfobj' directory of the fasm distribution has instructions on how to generate '.o' files: Code: /path/to/fasm/examples/elfobj/msgdemo.asm:4,7 ; compile the program using commands like: ; fasm msgdemo.asm msgdemo.o ; fasm writemsg.asm writemsg.o ; ld msgdemo.o writemsg.o -o msgdemo |
|||
10 Jul 2015, 16:25 |
|
cod3b453 10 Jul 2015, 20:23
Without more information, it's tricky to determine the cause. In addition to above, you may need to match your architecture if the default is 64bit by using "format ELF64". There's also the issue of linking: C style is basically just name matching but C++ style requires a matching prototype "hash", which you will have to adapt according to your particular compilation. i.e.
Code: public my_function Code: public my_function as '?my_fuction1@@YAXPAD@Z' Agner Fog's volume 5 here: http://www.agner.org/optimize/ details both the hashing and general ABI (if you were seeing run time failures it could suggest a calling mismatch) |
|||
10 Jul 2015, 20:23 |
|
redsock 10 Jul 2015, 21:40
I just did a recent post about integrating my fasm library with gcc, with x86_64 at least, all that is required is
Code: format ELF64 section '.text' executable align 16 public somesymbol somesymbol: See https://2ton.com.au/rants_and_musings/gcc_integration.html for working examples of this. Cheers |
|||
10 Jul 2015, 21:40 |
|
roxaz 11 Jul 2015, 06:52
indeed "format ELF64 " is exactly what i needed. i got confused thinking ELF64 must be .so while ELF64 executable must be.. executable.
thank you! |
|||
11 Jul 2015, 06:52 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.