bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How create small binaries with GNU binutils.


From: Nick Clifton
Subject: Re: How create small binaries with GNU binutils.
Date: Wed, 13 Feb 2019 13:17:58 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

Hi Dmitry,

> Thank you for suggestion, but map did not reveal anything. The only part
> (section?) with non zero size is .text of size 0xd (=13). This is
> correct, raw instructions are really 13 bytes (according to `objdump -d').

> By the way, `readelf --sections' reports, that there is no sections in
> fasm-generated binary. I do not know, how does fasm do it, but probably
> is saves on section headers or something like this. Is is possible to
> make `ld' do the same?

Ah ha - maybe that is it.  Maybe fasm is generating a binary with just
program segments but no sections, whereas ld is generating a binary with
both sections and segments[1].  Unfortunately I do not know of a way to 
tell ld to stop generating the sections.  Unfortunately it also appears
that the objcopy tool does not have an option for removing the sections
either.  (Actually it does, but removing the sections would remove the
code as well, whereas what we want to do is to remove the section header
table but leave in the program header table).

I am sorry, but I think that I going to be unable to help you. :-(

Cheers
  Nick

[1].  You could check this theory by running "readelf --section-headers 
--program-headers"
on the two binaries.  Both should have program headers but, if the 
theory is right, only the ld generated binary will have section headers.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]