[cfe-dev] Defining a custom "mixed" TargetInfo

Luboš Doležel via cfe-dev cfe-dev at lists.llvm.org
Sat Dec 12 16:12:59 PST 2015


Hello,

I'm looking for a way of altering the default i386 ABI on Linux, namely
for the Darling project (running OS X apps on Linux).

There are at least two deal-breaking incompatibilities between the i386
Darwin and Linux ABIs:

- size_t on Linux is unsigned int, but unsigned long on Darwin.
- long double on Linux is 96 bits long, Darwin's is 128 bits long.

Trying the hack around the first one by defining size_t differently
doesn't end up very well:

/home/lubos/Projects/darling/src/external/libcxx/include/new:131:30:
error: 'operator new' takes type size_t ('unsigned int') as first parameter

I have tried to force the Darwin ABI (which forces Mach-O), but keep the
ELF output format, but that was very naive of me, apparently.

An easy way would be to extend clang with a new special descendant of
X86TargetInfo, but Darling surely doesn't meet the first Clang
contribution criterion ("Evidence of a significant user community"). (Or
would this extension be sufficiently small to be accepted?)

Please, do you have any advice how to go on?

Thanks!
-- 
Luboš Doležel



More information about the cfe-dev mailing list