flat assembler
Message board for the users of flat assembler.

Index > Linux > is elf format compitable with native linux elf format?

Author
Thread Post new topic Reply to topic
solar



Joined: 20 Jul 2003
Posts: 2
solar
elf executable file generated by fasm can't be striped using strip on linux.
when striped, it just becomes a file of 92 bytes. so i wonder the elf format
generated by fasm is not compitable with the native linux elf format.
Post 28 Oct 2003, 04:23
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7713
Location: Kraków, Poland
Tomasz Grysztar
strip is a tool designed to remove the unnecessary information from object files - these are the ones with section header table (check it out in the ELF specification, you can find it here: http://www.skyfree.org/linux/references/ELF_Format.pdf), and the format generated by "format ELF executable" directive doesn't contain section table, only the program header table (and according to that specification it's completely valid, as for the "execution view" section table is marked as optional), and this probably confuses the "strip" tool, as it is not valid "object" file this way. Having one common format for both objects and executables initially seemed to me to be a nice idea, but now I see it only emerges problems - as many programs are doing false assumptions about the ELF files, like it's in this case. Also the "file" command informs about the "corrupted section header size" on such files (as it is set to zero, because there's no section header in fasm-generated executable). But, once again: according to the ELF specification there is no need to include section header table in the executable file!
And the "strip" would be anyway completely unuseful for you in case of fasm-generated ELF executables, as they only contain information that is really needed for program execution.
Post 28 Oct 2003, 12:57
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7713
Location: Kraków, Poland
Tomasz Grysztar
Anyway it turned out that the behaviour of "file" command with fasm-generated executables can be fixed by simply setting the size of section entry to a valid value (but with count of entries still equal to 0, though), you try, I've updated the latest prerelase with it. But I cannot do anything about the strange behaviour of "strip" program - it is assuming that the given file is object file, even when it's marked in header as executable - and removing everything that doesn't belong to any section from such file ends up with just destroying it. I really don't know why "strip" is doing it even when the file is obviously not object, as it has no section headers at all.
Post 29 Oct 2003, 18:05
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-2020, Tomasz Grysztar.

Powered by rwasa.