Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>General list:</p> <ul> <li>Make sure that you have the compiler and linker debug options disabled</li> <li>Compile and link with all size options turned on (-Os in gcc)</li> <li>Run <code>strip</code> on the executable</li> <li>Generate a map file and check your function sizes. You can either get your linker to generate your map file (<code>-M</code> when using ld), or you can use objdump on the final executable (note that this will only work on an unstripped executable!) This won't actually fix the problem, but it will let you know of the worst offenders.</li> <li>Use <code>nm</code> to investigate the symbols that are called from each of your object files. This should help in finding who's calling functions that you don't want called.</li> </ul> <p>In the original question was a sub-question about including only relevant functions. <code>gcc</code> will include all functions within every object file that is used. To put that another way, if you have an object file that contains 10 functions, all 10 functions are included in your executable even if one 1 is actually called.</p> <p>The standard libraries (eg. libc) will split functions into many separate object files, which are then archived. The executable is then linked against the archive. By splitting into many object files the linker is able to include only the functions that are actually called. (this assumes that you're statically linking)</p> <p>There is no reason why you can't do the same trick. Of course, you could argue that if the functions aren't called the you can probably remove them yourself.</p> <p>If you're statically linking against other libraries you can run the tools listed above over them too to make sure that they're following similar rules.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload