[cfe-dev] [PATCH]: add support for FreeBSD
Roman Divacky
rdivacky at freebsd.org
Thu Oct 16 04:14:05 PDT 2008
On Wed, Oct 15, 2008 at 08:14:29AM -0700, Chris Lattner wrote:
> On Oct 14, 2008, at 11:35 PM, Roman Divacky wrote:
> >>>I think you are right.... the __FreeBSD_cc_version is used to denote
> >>>what gcc is used on a given FreeBSD. I believe we can easily pretend
> >>>it's always X00001 where X is the FreeBSD major number. do you like
> >>>this
> >>>patch? I could not test it but it should be ok...
> >>
> >>The patch looks great to me, can you please resend as an attachment?
> >>It is coming through inline and I can't copy/paste it successfully,
> >>thanks!
> >
> >here it is.
>
> Ah, I'm sorry, one more change please.
>
> The code to detect the OS should go into the llvm::sys::osVersion()
> function in libsystem. This causes clang to set the target triple in
> CreateTargetTriple() in clang.cpp. You will want it to set a target
> triple like "freebsd8-..." etc.
>
> Based on the target triple, you want getFreeBSDDefines to set the
> "release". For an example, look at how getDarwinDefines extracts the
> "darwin8-..." into some logic that eventually sets
> __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__.
>
>
> Splitting the patch into these two pieces is important because you
> want clang to *default* to the current dynamic system, but you want to
> be able to override/cross compile with the -target=... option. Also,
> calling uname in Targets.cpp doesn't work because not all hosts have
> it (which is why it needs to be in libsystem).
this should do the trick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: text/x-diff
Size: 3119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081016/57c8483d/attachment.patch>
More information about the cfe-dev
mailing list