enormous executable

Alastair David Reid reid@cs.utah.edu
04 Oct 2001 13:24:14 -0600

Simon (talking about using -ffunction-sections)
> And there's bound to be some
> complication due to the assumptions we make in the RTS about the
> relative ordering of code/data.

Sounds like the mangler should do the function section magic.
Assuming the mangler understands where section boundaries can
and cannot go (I think this is true), this should be quite easy.

If you run this:
  $ cat > /tmp/tst.c
  int f(int x) {return x;}
  int g(int x) {return x;}
  $ gcc -ffunction-sections -o - -S /tmp/tst.c 
You'll see that the -ffunction-sections flag causes gcc to output these
section directives before the code implementing f and g.

  .section        .text.f,"ax",@progbits
  .section        .text.g,"ax",@progbits

The corresponding GNU linker magic constructs the .text segment out of
all the .text.* segments.

Alastair Reid        reid@cs.utah.edu        http://www.cs.utah.edu/~reid/