[gambit-list] What is required to port gambit to a new cpu?

Martin DeMello martindemello at gmail.com
Wed Jan 27 07:11:21 EST 2010


Just wondering what happened with this - have you got gambit
generating n900 binaries? What is the workflow like?

martin

On Wed, Dec 30, 2009 at 5:08 AM, Frederick LeMaster
<fred.lemaster at gmail.com> wrote:
> Thanks! It looks like the preprocessor symbol __ARMEL__ specifies
> little endianness and __ARMEB__ specifies big endianness. Here's the
> patch for gambit.h.in
>
> On Tue, Dec 29, 2009 at 7:13 AM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
>> I've seen exactly this behaviour when the include/gambit.h.in file determines the wrong endianness for the CPU.  Given that the ARM can either be little or big-endian, chances are good that the #ifdefs in the gambit.h.in file are not sufficient to detect the endianness on the Nokia platform.  Usually the C compiler or development environment will define a symbol that indicates the endianness of the CPU, and the gambit.h.in file needs to be modified to test this symbol.  Here is an excerpt of the gambit.h.in file which determines the endianness when the CPU is an ARM:
>>
>> #ifndef ___BIG_ENDIAN
>> #ifndef ___LITTLE_ENDIAN
>>
>> ...
>>
>> #ifdef ___CPU_arm
>> #ifdef _LITTLE_ENDIAN
>> #define ___LITTLE_ENDIAN
>> #endif
>> #ifdef __LITTLE_ENDIAN__
>> #define ___LITTLE_ENDIAN
>> #endif
>> #ifdef __LITTLE_ENDIAN_DATA__
>> #define ___LITTLE_ENDIAN
>> #endif
>> #endif
>>
>> ...
>>
>> #endif
>> #endif
>>
>> Note that by default the gambit.h.in file assumes the endianness is big-endian.  So I'm pretty sure none of the symbols _LITTLE_ENDIAN, __LITTLE_ENDIAN__, and __LITTLE_ENDIAN_DATA__ are defined and the gambit.h.in file will assume incorrectly that the endianness is big-endian.
>>
>> There are two solutions.
>>
>> #1, the clean way, is to check the compiler documentation to see which symbol is defined by the C preprocessor to indicate the endianness, and to modify the above sequence of #ifdefs to take that into account.
>>
>> #2, the brute force way, is to add #define ___LITTLE_ENDIAN at the top of the gambit.h.in file.
>>
>> I propose you try #2 first, and if that solves the problem, then try #1 and send me a patch so I can modify my source code.
>>
>> Note that after modifying the include/gambit.h.in file, you will have to do a ./configure and probably a "make mostlyclean" before "make".
>>
>> Marc
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
>



More information about the Gambit-list mailing list