[project @ 2005-01-14 22:12:54 by wolfgang]
authorwolfgang <unknown>
Fri, 14 Jan 2005 22:12:55 +0000 (22:12 +0000)
committerwolfgang <unknown>
Fri, 14 Jan 2005 22:12:55 +0000 (22:12 +0000)
commitacea64ed203f2e1b340e5a42bbb5fab4fc240baf
tree66d5a1982164fc5ba19a095c46d9cc9f63ef9a38
parentc464eda3010831d8e5fb97c950aef953a1217db6
[project @ 2005-01-14 22:12:54 by wolfgang]
When -dynamic is specified but -fPIC is not, generate code that works around
the ELF dynamic linker's misguided attempts to keep the main program unaware
of dynamic linking.

This involves generating indirect references and computed jumps for position
dependent code, too, and making all constant data sections writable in order
to persuade ld to not use "COPY" relocations.

Tested on powerpc-linux; in theory, it also applies to i386-linux, but other
parts of the PIC story are missing there.

Note that the writable-const-data hack could be improved a bit by
distinguishing between "really" constant data and "relocatable" constant data,
which would be a nice thing to do anyway.
ghc/compiler/nativeGen/PositionIndependentCode.hs
ghc/compiler/nativeGen/PprMach.hs