[cfe-dev] [PATCH]: add support for FreeBSD
daniel at zuster.org
Sat Oct 11 12:58:54 PDT 2008
Ok, I understand that issue now.
However, the proposed solution still doesn't solve the issue that the value
will be compiled in instead of determined at run time. Presumably that is
what gcc is doing so this is acceptable (the difference is that clang is
less likely to be shipped "bound" to some particular OS version).
If its only being determined at compile time then it isn't unreasonable to
obtain the number from "gcc -dM"; chances are we will end up wanting to do
this for other configuration values eventually. Of course, getting the value
from a header is certainly preferable if you can get the changes into
FreeBSD (I'm still confused as to where gcc is getting the number from).
On Sat, Oct 11, 2008 at 2:08 AM, Roman Divacky <rdivacky at freebsd.org> wrote:
> > >>>I might ignite a discussion on the fbsd mailing list if we can
> > >>>change
> > >>>the sources to export these two numbers to be exported in some
> > >>>header file.
> > >>
> > >>On darwin, we autodetect using the "approved system interfaces". The
> > >>idea is that we want to be able to build a binary on darwin9 and have
> > >>it run find on darwin10. The idea is that we want the compiler to
> > >>default to generating code for the current OS, but that requires
> > >>detecting it (since the build may have been done on a different one).
> > >>
> > >>Make sense?
> > >
> > >well.. I could parse output of "touch dummy_file.c ; gcc -E -dM
> > >dummy_file.c"
> > >to get the two defines. there's no other way to get this on runtime,
> > >is
> > >this an acceptable solution?
> > I'm confused about why that would be useful. Worst case you could
> > parse the output of 'system("uname -a")' or something, no? Presumably
> > uname is implemented in terms of some library/system call, and that
> > could just be used instead?
> there's some confusion here...
> we are talking about:
> + Define(Defs, "__FreeBSD__", "8");
> + Define(Defs, "__FreeBSD_cc_version", "800001");
> the problem is that the second number is defined only in an internal
> header file or can be obtained via "gcc -E -dM dummy_file.c", the
> does not correspond to anything in uname.
> so here's the plan. I'll convince people in the freebsd land to include
> this number
> in some public header file and
> #ifdef __FreeBSD__
> #include <that_header_file.h>
> to get the numbers, ok?
> hope it's clear enough now :)
> p.s. keep me CCed as I am not subscribed to the ML
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev