This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libfortran] PR 47571 Fix static linking regression


On 01/02/2011 21:12, Janne Blomqvist wrote:

> my recent patch to use clock_gettime() made static linking break on
> Linux,  since the driver didn't link in librt. It was also pointed out
> that always requiring librt in libgfortran might in principle reduce
> performance for non-threaded programs as librt pulls in libpthread and
> thus the weakrefed IO locking stuff becomes real locks.
> 
> The attached patch fixes this by not linking in librt (and this
> libpthread) in libgfortran.so, and instead calls clock_gettime()
> through a weak reference, falling back to gettimeofday()/other
> fallbacks in case librt is not explicitly linked in (or implicitly
> e.g. via -fopenmp). For platforms that provide clock_gettime() in
> libc, clock_gettime() ought to always be used, although I'm not able
> to test this.
> 
> Regtested on x86_64-unknown-linux-gnu, tested a simple program to
> ensure usage of clock_gettime() or gettimeofday() depending on whether
> librt is linked. Ok for trunk?

  Does SUPPORTS_WEAK necessarily imply supports weakref?  I'm not certain
they're the same thing.

    cheers,
      DaveK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]