Re: -fwhole-program and __attribute__((externally_visible))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joel Dice <dicej@xxxxxxxxxxxxx> writes:

> I've been playing with -flto and -fwhole-program using an SVN snapshot
> of GCC and I have a couple of questions.
>
> I'm using __attribute__((externally_visible)) to mark the entry points
> in my executable (which is also a shared object).  However, said
> attribute is not available with all versions of GCC.  What's the best
> way to determine whether it's available or not?

It's always available when -flto is available.

If you want your code to compile with older versions of gcc which
don't support -flto, then the best approach is probably something like

#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)


> Also, I'm curious as to why above attribute is necessary at all.  All
> my code is built with -fvisibility=hidden, and the exported functions
> are marked with either __declspec(dllexport) or
> __attribute__((visibility("default"))), depending on the platform.  It
> seems redundant to specify an additional attribute that means
> essentially the same thing.

I don't think anybody has really thought through how to best use -flto
-fwhole-program with a shared library.  Most likely a different option
should be used, similar to -fwhole-program except meaning that all
hidden functions may be considered static.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux