[LLVMdev] Linkage Types again!

Brian R. Gaeke gaeke at uiuc.edu
Sun Nov 23 15:13:01 PST 2003


> That's essentially what I did to get it to work but instead of
> appending, I just opted for LinkOnce. 

Sounds ok.

> > I don't quite understand why you need an appending global to do this, if you
> > can only have one main. I would just set it to the correct initializer in the
> > module that has main, and leave it external everywhere else.
> 
> Its essentially a hack.  What I was trying to do was have the size of
> the global stack array increase depending on the number of compilation
> units that are linked together. The idea was that a given compilation
> unit would know its stack requirements but not that of other compilation
> units. Using appending linkage allows the sum total of the stack
> requirements to be handled without foreknowledge of the total size
> needed. 
> 
> This actually doesn't work because you can't (yet) specify the stack
> size to the compiler!  I'm debating the pros and cons of doing this.

This sounds like something you could do much more cleanly with some sort
of interprocedural analysis.  You could stick that in your link-time
Stacker optimizer. :-) For example:

stkrc -c 1.st -o 1.o
stkrc -c 2.st -o 2.o
...
stkrc -c n.st -o n.o
stkrld -o program 1.o 2.o ... n.o
  (links bytecode files, and does all the inter-procedural analysis and
  optimizations you need)

We do stuff like this with gccld, for C/C++ programs.

Hope this helps,
-Brian

-- 
gaeke at uiuc.edu



More information about the llvm-dev mailing list