This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Ping on HP-UX patch for a clean build


On Wed, 2005-06-01 at 11:39, Steve Ellcey wrote:
> I am still looking for approval and checkin of the following patch:
> http://sourceware.org/ml/binutils/2005-05/msg00218.html

I'd been meaning to to check my POSIX manuals at home for info on the
*_unlocked but kept forgetting to do so.  Turns out that my 15 year old
copy of POSIX.1 doesn't have them.  Looks like I have to buy a new set
of manuals.  Meanwhile, all I know is what I've gleaned from reading the
linux man pages and the glibc sources.

Anyways, I believe I understand what is going on here.  glibc is thread
safe by default, so single threaded apps should use the *_unlocked
functions to improve performance.  HPUX is thread safe only if
-D_REENTRANT, so there is no need to use the *_unlocked functions for
performance reasons.  There is also the issue that it might possibly be
unsafe to use it in this case.  I haven't seen any evidence to support
that, but I have incomplete docs, and since it isn't doing anything
useful here, there is no need to take the risk.

The check you are adding for NEED_DECLARATION_GETC_UNLOCKED in strings.c
is unlike anything else in binutils, but does actually make sense in
this case, and is roughly equivalent to the corresponding gcc code.  It
really should have a comment explaining why we are doing this though. 
Maybe something like
  /* Only use getc_unlocked if we found a declaration for it.
     Otherwise, libc is not thread safe by default, and we should not
     use it.  This should test HAVE_DECL_GETC_UNLOCKED if configure
     used the standard autoconf AC_CHECK_DECLS test.  */

One thing that isn't clear to me is why you just didn't add the
AC_CHECK_DECLS test in the first place.  Sure, the existing configure.in
file has out of date BFD_NEED_DECLARATION checks, but that shouldn't
prevent you from handling getc_unlocked the correct way via
AC_CHECK_DECLS, unless I missed something.  You can leave the problem of
fixing the rest of the BFD_NEED_DECLARATION checks to someone else.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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