[llvm-commits] [PATCH][GNU Build] Add LLVM_IS_TARGET_BIG_ENDIAN to config.h
Michael Spencer
bigcheesegs at gmail.com
Fri Oct 22 13:49:33 PDT 2010
On Fri, Oct 22, 2010 at 3:57 PM, Andy Trick <atrick at apple.com> wrote:
> Michael,
>
> I don't have access to freebsd either. And I don't know how your configure.ac, config.h.in patch will fix freebsd or if it's the right fix. What I can tell you is that I applied the patch to my gnu build and it does what is intended on a little endian host--NOTHING. At any rate, if you believe it fixes the freebsd build, please check it in so we can find out. If you don't have a fix, please revert the changes that broke the build.
I would have removed the defined(_BIG_ENDIAN) ||
defined(__BIG_ENDIAN__) which are also used on some platforms as #if
ENDIAN == _BIG_ENDIAN. So _BIG_ENDIAN is always defined.
> If you haven't done it, I strongly suggest installing the gnu toolchain or getting access to linux/darwin so you can verify the gnu builds yourself before you checkin.
I have it on Windows via MinGW and I have a Linux box. What I don't
have is autoconf 2.60 or w/e exact version is required.
> Thanks!
>
> -Andy
It's fixed on ToT by not using a macro.
- Michael Spencer
> On Oct 22, 2010, at 1:14 AM, Michael Spencer wrote:
>
>> On Fri, Oct 22, 2010 at 2:13 AM, Chris Lattner <clattner at apple.com> wrote:
>>>
>>> On Oct 21, 2010, at 6:59 PM, Michael Spencer wrote:
>>>
>>>> On Thu, Oct 21, 2010 at 7:01 PM, Dale Johannesen <dalej at apple.com> wrote:
>>>>> I may have missed earlier discussion, but why do you want this at compile time? Normally llvm is built to support multiple targets (not necessarily all of the same endianness) and endianness is checked at runtime; see TargetData.
>>>>
>>>> This is for the host target. It is used when working with endian
>>>> dependent data such as object files.
>>>
>>> I still don't get it. If you want the endianness of the host, you can use llvm/System/Host.h.
>>
>> I want it at compile time.
>>
>>> Nothing about the target should be hard coded in at compile time. You should be able to make elf .o files for both powerpc and x86 etc.
>>>
>>> -Chris
>>
>> This isn't about the target. This is about the host, which I now
>> realize is not what that macro is... I really don't know how I missed
>> that...
>>
>> The macro should be LLVM_IS_HOST_BIG_ENDIAN. But everything else is
>> still the same. I'll fix the CMake version, but I still need someone
>> to help with autoconf.
>>
>> The point is so that you can memory map a file, and directly say "read
>> an unsigned 32 bit integer from this address encoded as littlendian."
>> On X86 this would just end up as a movl (%addr), %dest. While on PPC
>> this would expand to a read and a byteswap.
>>
>> - Michael Spencer
More information about the llvm-commits
mailing list