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 Tue, Feb 1, 2011 at 23:58, Dave Korn <dave.korn.cygwin@gmail.com> wrote:
> 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.

Well, that macro is used in quadmath_weak.h and in gthr-posix.h in a
similar way, so I guess it's ok.



-- 
Janne Blomqvist


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