flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Compiler Internals > ELF64 PLT operator seems broken (bug?)

Author
Thread Post new topic Reply to topic
icktoofay



Joined: 18 Sep 2016
Posts: 2
ELF64 PLT operator seems broken (bug?)

Code:
format ELF64
extrn func
call plt func

creates an object file where "readelf -r test.o" indicates a R_X86_64_PC32 relocation, whereas I'd expect a R_X86_64_PLT32 relocation instead.

"format ELF" seems to get this right, generating a R_386_PLT32 (rather than R_386_PC32) relocation, but ELF64 seems to forget that I put the PLT operator there.
Post 18 Sep 2016, 09:12
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
Thank you for the report. It's fixed in 1.71.55.

At the same time I have also updated the ELF formatting macros in fasmg package so that they support PLT with ELF64 format. There is a slight difference in syntax, EXTRN simply defines additional symbols in PLT namespace (having PLT as an operator does not make much sense, since it can only be applied to unmodified external symbol, but in fasm it was easier to implement it as such, with fasmg it is the other way). The same example assembled with fasmg would look like:

Code:
include 'format/format.inc'

format ELF64
extrn func 
call plt.func

If you have any more troubles with fasm's ELF formatter, please give fasmg macros a try - it is much easier to tweak and extend them.
Post 18 Sep 2016, 11:08
View user's profile Send private message Visit poster's website Reply with quote
icktoofay



Joined: 18 Sep 2016
Posts: 2
Thanks, I can confirm that 1.71.55 fixes it. Thanks for the tip about fasmg as well -- I wasn't sure how far it had progressed.
Post 18 Sep 2016, 22:02
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland

icktoofay wrote:
Thanks for the tip about fasmg as well -- I wasn't sure how far it had progressed.

It still does not have macros for instruction sets from AVX up and for COFF output formatting, but I plan to add them sooner or later. You can already assemble a lot of things the same as with fasm, the only problem being that when macros do absolutely everything from ground up, it is of course slow (for instance, on my tablet fasmg needs almost 10 seconds to self-assemble through macros).
Post 19 Sep 2016, 07:45
View user's profile Send private message Visit poster's website 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.