[llvm] r182092 - [PowerPC] Merge/rename PPC fixup types

Ulrich Weigand Ulrich.Weigand at de.ibm.com
Wed May 22 11:40:15 PDT 2013


I wrote:

> PPCELFObjectWriter now handles it like this:
>
>   MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
>     MCSymbolRefExpr::VK_None : Target.getSymA()->getKind();
> [...]
>     case PPC::fixup_ppc_half16:
>       switch (Modifier) {
>       case MCSymbolRefExpr::VK_PPC_GAS_HA16:
>       case MCSymbolRefExpr::VK_PPC_DARWIN_HA16:
>         Type = ELF::R_PPC_ADDR16_HA;
>         break;
>       case MCSymbolRefExpr::VK_PPC_GAS_LO16:
>       case MCSymbolRefExpr::VK_PPC_DARWIN_LO16:
>         Type = ELF::R_PPC_ADDR16_LO;
>         break;
>
> Unfortunately, on Darwin, the VK_PPC_DARWIN_HA16/LO16
> markers are currently not 100% correct, since in some
> cases the back-end makes hard-coded assumptions on
> where lo/ha markers are required.  If you recall my
> patch you've been testing recently, this was intended to
> address exactly this problem.  With the patch applied,
> it should be possible to reliably check for the HA/LO
> target-specific expressions.
>
> However, it seems we cannot in fact use the MCValue
> object to represent target-specific flags resulting
> from evaluation of target-specific expressions.

Looks like I was too pessimistic here; in fact, it now
seems relatively straight-forward to do exactly that.

The attached patch is an updated version of the Darwin
target-specific MCExpr patch, now including an
EvaluateAsRelocatableImpl routine that processes
HA/LO expressions.

With this patch applied, the solution for PPCMachObjectWriter
outlined above (consult the VariantKind to distinguish
between HA and LO relocations) should now work reliably.

(Note that the patch merges VK_PPC_GAS_HA16 and
VK_PPC_DARWIN_HA16 into a single VK_PPC_ADDR16_HA and
likewise for LO, so you'll have to adapt the example.)

Can you try and see if that works for you?  If so,
I can commit the patch to the repository to make
merging into your branch easier ...

Bye,
Ulrich

(See attached file: diff-reloc-mcexpr)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff-reloc-mcexpr
Type: application/octet-stream
Size: 21941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130522/328364ce/attachment.obj>


More information about the llvm-commits mailing list