[PATCH] 32-bit PowerPC ELF Position Independent Code
iain at codesourcery.com
Mon Jul 14 03:07:37 PDT 2014
thanks for working on this.
FWIW, I have ~ 10 or so PPC-darwin 32bit patches in progress (I don't believe any conflict with this). However, if you start to move focus to the ABI stuff in clang - we should discuss.
... one request below.
On 12 Jul 2014, at 01:54, Justin Hibbits wrote:
> For the last few weeks I've been working off and on with ppc32 PIC for
> ELF/SysVR4, and now have something to show for it. The patch is
> attached. It passes all existing tests, and I haven't yet added new
> tests for this. I also tested by compiling zlib on FreeBSD/PowerPC,
> and running some commands linked against it.
--- lib/Target/PowerPC/PPC.h (revision 212105)
+++ lib/Target/PowerPC/PPC.h (working copy)
@@ -60,10 +60,10 @@
// PPC Specific MachineOperand flags.
- /// MO_DARWIN_STUB - On a symbol operand "FOO", this indicates that the
- /// reference is actually to the "FOO$stub" symbol. This is used for calls
- /// and jumps to external functions on Tiger and earlier.
- MO_DARWIN_STUB = 1,
+ /// MO_PLT_STUB - On a symbol operand "FOO", this indicates that the
+ /// reference is actually to the "FOO$stub" or "FOO at plt" symbol. This is
+ /// used for calls and jumps to external functions on Tiger and earlier.
+ MO_PLT_STUB = 1,
/// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
/// the function's picbase, e.g. lo16(symbol-picbase).
Either we could have two flags (to avoid repeated testing for darwin) or - perhaps just make it "MO_STUB" (PLT will likely confuse anyone looking at the Darwin doc. since the stubs are not referred to with that term).
I'd also like to take the opportunity to make the comment a bit clearer ... something like:
MO_STUB - On a symbol operand "FOO", this indicates that the reference is actually to the "FOO$stub" or "FOO at plt" symbol.
The compiler also emits a similar structure to be used by older Darwin/OSX linkers (pre ld64-85.2.1), corresponding to the toolchains used on Darwin8/OSX10.4. For modern linkers the stubs are no longer required, the linker produces them as needed.
open to futher suggestions / tweaking, of course.
More information about the llvm-commits