[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
Kevin Enderby
enderby at apple.com
Tue Jan 18 15:05:17 PST 2011
On Jan 18, 2011, at 2:48 PM, Evan Cheng wrote:
>
> On Jan 18, 2011, at 12:22 PM, Jason Kim wrote:
>
>> 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?
>
> I believe so. Kevin?
The Darwin assembler does not "require" a lower16:/:upper16: when using movw/movt if that is used with just const:
% cat x.s
.syntax unified
.code 16
.thumb_func t
t:
movt r1,#1
movw r2,#2
% as -arch armv7 x.s
% otool -tv a.out
a.out:
(__TEXT,__text) section
t:
00000000 f2c00101 movt r1, #1 ; 0x1
00000004 f2400202 movw r2, #2 ; 0x2
But normally is used with a symbol or expression in any generated code for example
>
> Evan
>
>>
>> -jason
>
More information about the llvm-commits
mailing list