[LLVMdev] Extend llvm to fix global addresses

Joerg Sonnenberger joerg at britannica.bec.de
Tue Dec 6 06:55:05 PST 2011


On Mon, Dec 05, 2011 at 07:18:36PM -0800, Peter Cooper wrote:
> It would be nice to add support for placing globals at fixed addresses in memory.  

I don't know. From my experience, the usefulness is very, very limited.
As in: drivers are about the only thing that can make use of it.

> For example, low level driver code tends to contain things like this
> 
> *(int*)0x00001000
> 
> which is horrible.

The drivers I have seen can't work that way because they are written to
cover more than one specific machine. As soon as you go anywhere near an
IO abstraction, this doesn't apply anymore. As such, I think this
feature primarily helps making ugly, unportable code differently ugly,
unportable code.

Joerg



More information about the llvm-dev mailing list