flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > ELF64 PLT operator seems broken (bug?)

Author
Thread Post new topic Reply to topic
icktoofay



Joined: 18 Sep 2016
Posts: 2
icktoofay 18 Sep 2016, 09:12
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



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 18 Sep 2016, 11:08
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
icktoofay 18 Sep 2016, 22:02
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



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 19 Sep 2016, 07:45
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


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

Website powered by rwasa.