[llvm-commits] [llvm] r123424 - in /llvm/trunk: include/llvm/Object/MachOFormat.h lib/MC/ELFObjectWriter.cpp lib/MC/MachObjectWriter.cpp lib/Target/ARM/ARMAsmBackend.cpp lib/Target/ARM/ARMFixupKinds.h lib/Target/ARM/ARMMCCodeEmitter.cpp test/MC/A

Jason Kim jasonwkim at google.com
Tue Jan 18 12:22:30 PST 2011


On Fri, Jan 14, 2011 at 3:38 PM, Evan Cheng <evan.cheng at apple.com> wrote:
>
> On Jan 14, 2011, at 12:20 PM, Jason Kim wrote:
>
>
> Hi Evan,
>
> FYI, the movt hi16 fixup you put in does not match the output of GNU as -
> Let me look into this and figure out why. I'll reply soon.
>
> -jason
>
>
> Interesting. That's probably due to this:
>
>   case ARM::fixup_arm_movt_hi16:
>
> -  case ARM::fixup_arm_movw_lo16:
>
>   case ARM::fixup_arm_movt_hi16_pcrel:
>
> +    Value >>= 16;
>
> +    // Fallthrough
>
> +  case ARM::fixup_arm_movw_lo16:
>
>   case ARM::fixup_arm_movw_lo16_pcrel: {
>
>     unsigned Hi4 = (Value & 0xF000) >> 12;
>
>     unsigned Lo12 = Value & 0x0FFF;
>
> @@ -168,6 +175,26 @@
>
>     Value = (Hi4 << 16) | (Lo12);
>
>     return Value;
>
>   }
>
> Notice the Value is shifted down 16 bits for movt. I'm fairly sure this is
> right, at least for Darwin. It's possible there is a bug elsewhere.
> Evan
>
>

Hmm, I see at least one problem that was not caught earlier -

1) movw/movt paired with :lower16:/:upper16:
2) movw/movt NOT paired with a :lower16:/:upper16:

The handling has to be different for these two cases
in case 2, the constant will already be a 16bit value
in case 1, the constant will need to be right shifted (during? before? fixup)

It seems like this needs to be handled before the fixup actually happens.

Does Darwin assembler require :lower16:/:upper16: when using movw/movt?

-jason




More information about the llvm-commits mailing list