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 > ELF section header alignment

Author
Thread Post new topic Reply to topic
incertia



Joined: 21 Jun 2017
Posts: 2
ELF section header alignment
With the rising popularity of the LLVM toolchain nowadays, I believe it would be beneficial to align data in a way that behaves nicely with with the LLVM linker. Most notably, LLVM will fail when e_shoff is not a multiple of two.

Code:
fasm test.s test.o
flat assembler  version 1.71.60  (16384 kilobytes memory)
3 passes909 bytes.
readelf -a test.o | grep -i 'start of section headers'
  Start of section headers:          525 (bytes into file)
nm test.o
bfd pluginLLVM gold plugin has failed to create LTO moduleInvalid data was encountered while parsing the file
nmtest.ono symbols
ld.lld -o test test.o
ld.llderrorinvalid alignment of section headers
vim test.s
fasm test.s test.o
flat assembler  version 1.71.60  (16384 kilobytes memory)
3 passes910 bytes
readelf -a test.o | grep -i 'start of section headers'
  Start of section headers:          526 (bytes into file)
nm test.o
0000000000000000 T _start
ld.lld -o test test.o
exit

Post 21 Jun 2017, 18:41
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6605
Location: Kraków, Poland
Even if not for the LLVM toolchain this would be a thing requiring correction, as it is a violation of ELF specification (which directly states that these fields need to be aligned). Thank you for pointing it out!

Would you be able to test this with the ELF formatting macros that come with fasmg? Because there I can fix it very quickly, while fixing it in fasm 1 core may take a bit longer.
Post 21 Jun 2017, 20:32
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6605
Location: Kraków, Poland
Anyway, I gave it a shot. Please try with 1.71.63 and see if the produced files are correct.
Post 21 Jun 2017, 21:37
View user's profile Send private message Visit poster's website Reply with quote
incertia



Joined: 21 Jun 2017
Posts: 2
Seems to be working. Thanks!
Post 22 Jun 2017, 17:45
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


Powered by phpBB © 2001-2005 phpBB Group.

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