[llvm-commits] [PATCH, RFC] Medium code model support for 64-bit PowerPC
Ulrich Weigand
Ulrich.Weigand at de.ibm.com
Mon Nov 26 07:09:29 PST 2012
Bill Schmidt <wschmidt at linux.vnet.ibm.com> wrote:
> Here's a new revision of the patch. The changes are:
>
> (1) Add support for direct object file writing:
> - New relocation types in ELF.h.
> - New fixup kinds in PPCFixupKinds.h
> - Handle new fixups in PPCMCCodeEmitter.cpp, PPCAsmBackend.cpp, and
> PPCELFObjectWriter.cpp.
I think this may be a bit overkill; I don't think you need new fixups
(I see you followed the existing precedent of fixup_ppc_toc16 and
fixup_ppc_toc16_ds, but I think those are already unnecessary).
The *fixup* type describes *how* a value is to be inserted into an
instruction; this is the same for the TOC variants. The difference
is only which *value* is to be inserted, and that is (supposed to
be) already encoded in the symbol kind.
PPCELFObjectWriter::getRelocTypeInner is then supposed to consult
the pair of fixup type and symbol kind to choose the appropriate
relocation type. So instead of adding something like:
+ case PPC::fixup_ppc_toc16_lo:
+ Type = ELF::R_PPC64_TOC16_LO;
+ break;
I think you should rather add a check of symbol kind under the
existing PPC::fixup_ppc_lo16 case. (Similar to what I did for
TPREL16_LO.)
Bye,
Ulrich
More information about the llvm-commits
mailing list