unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>,
	libc-alpha@sourceware.org, "H.J. Lu" <hjl.tools@gmail.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: [RFC] elf: Implement filtering of symbols historically defined in libpthread
Date: Tue, 4 May 2021 09:59:05 -0300	[thread overview]
Message-ID: <3c32c2c4-3e94-25cb-7f15-4f8dda6a2324@linaro.org> (raw)
In-Reply-To: <87h7jqguew.fsf@oldenburg.str.redhat.com>



On 28/04/2021 15:01, Florian Weimer via Libc-alpha wrote:
> Definitions of these symbols in libc expose bugs in existing binaries
> linked against earlier glibc versions.  Therefore, hide these symbols
> for old binaries.

It is unfortunate that we didn't specify that redefine libc symbol
visbility regarding elf linking should be considered undefined 
behaviour, so programs now rely un such behaviour (the bug foward
compatibility is such a messy constraint...).  It would be better if 
we knew earlier that a single thread API indication might just avoided 
this mess.

In any case I don't see a better way than moving the logic to loader
to handle such cases, the LD_PRELOAD is not really a solution. 

> 
> The symbol list in sysdeps/nptl/dl-pthread-weak.c contains some
> symbols which have not been moved yet, but that is harmless because
> the function is only invoked if the symbol is found in libc.so.
> 
> The test suite passes on i686-gnu-linux, powerpc64-linux-gnu,
> x86_64-linux-gnu with these changes.
> 
> Is this the direction we want to go in?  Then I'm going to add test
> cases, probably using assembler.
> 
> Personally I think it's not *too* bad, also not particularly nice
> either.  elf/dl-pthread-weak.os brings in 2-3 KiB of code (but few
> run-time relocations).  One possibility I have not mentioned in the
> comment is to put the moved symbols into a GLIBCPTHREAD_2.34 symbol
> version and use the presence of this version on the chain as an
> indicator that the symbol uses special treatment.  This eliminates the
> separate string table.  The downside is that we cannot easily add more
> symbols if we discover some are missing.  This happened to me during
> development with pthread_mutexattr_gettype, which is a GLIBC_2.1 symbol
> and therefore not actually suitable for detecting the presence of
> libpthread (historically speaking).  And it could happen again with
> thrd_exit (which is of course much younger).

My take on this is to postpone the 2.34 release until we have the
libpthread/librt *fully* integrate on libc.so.  The half way through
only add unecessary complexity and it might avoid the 2-3 KiB binary
increase in code .

  parent reply	other threads:[~2021-05-04 12:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 18:01 [RFC] elf: Implement filtering of symbols historically defined in libpthread Florian Weimer via Libc-alpha
2021-05-04  6:55 ` Florian Weimer via Libc-alpha
2021-05-04 11:47 ` H.J. Lu via Libc-alpha
2021-05-04 12:04   ` Florian Weimer via Libc-alpha
2021-05-04 12:24     ` H.J. Lu via Libc-alpha
2021-05-04 12:27       ` Florian Weimer via Libc-alpha
2021-05-04 12:30         ` H.J. Lu via Libc-alpha
2021-05-04 12:33           ` Florian Weimer via Libc-alpha
2021-05-04 12:36             ` H.J. Lu via Libc-alpha
2021-05-04 12:43               ` Florian Weimer via Libc-alpha
2021-05-04 13:06                 ` H.J. Lu via Libc-alpha
2021-05-04 13:13                   ` Florian Weimer via Libc-alpha
2021-05-04 13:28                     ` H.J. Lu via Libc-alpha
2021-05-04 12:59 ` Adhemerval Zanella via Libc-alpha [this message]
2021-05-04 21:08   ` Carlos O'Donell via Libc-alpha
2021-05-04 13:08 ` Andreas Schwab
2021-05-04 16:52   ` Florian Weimer via Libc-alpha
2021-05-04 21:28 ` Carlos O'Donell via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c32c2c4-3e94-25cb-7f15-4f8dda6a2324@linaro.org \
    --to=libc-alpha@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).