public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: Re: [PATCH 1/3] x86: Initialize CPU info via IFUNC relocation [BZ 26203]
Date: Fri, 18 Sep 2020 07:18:52 -0700	[thread overview]
Message-ID: <CAMe9rOqDwrj5Jba2=y1HaZfs09-SQ3QRrsqF9XEQCASTxfD8jw@mail.gmail.com> (raw)
In-Reply-To: <87a6xn6v8u.fsf@oldenburg2.str.redhat.com>

On Fri, Sep 18, 2020 at 6:59 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > On Fri, Sep 18, 2020 at 1:06 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > X86 CPU features in ld.so are initialized by init_cpu_features, which is
> >> > invoked by DL_PLATFORM_INIT from _dl_sysdep_start.  But when ld.so is
> >> > loaded by static executable, DL_PLATFORM_INIT is never called.
> >>
> >> I don't think that's accurate.  It's called from elf/dl-support.c in the
> >> static case.  But I agree that it's too late in this case.
> >
> > I was referring to the ld.so case.  elf/dl-support.c isn't used for ld.so.
>
> I missed that.
>
> You cannot use ld.so in a static executable because it is
> uninitialized/dormant.
>
> If you need functionality after static dlopen, it has to reside in
> libc.so.6, not the dynamic loader.

Here is the problem.  static dlopen uses libc.so.6 which brings in ld.so
with _rtld_global and _rtld_global_ro via DT_NEEDED.  My patch is
trying to deal with it to initialize CPU info in _rtld_global_ro in this case.

-- 
H.J.

  reply	other threads:[~2020-09-18 14:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-12 13:44 [PATCH 0/3] ld.so: Add --list-tunables to print tunable values H.J. Lu
2020-09-12 13:44 ` [PATCH 1/3] x86: Initialize CPU info via IFUNC relocation [BZ 26203] H.J. Lu
2020-09-18  8:06   ` Florian Weimer
2020-09-18 13:55     ` H.J. Lu
2020-09-18 13:59       ` Florian Weimer
2020-09-18 14:18         ` H.J. Lu [this message]
2020-09-18 14:22           ` Florian Weimer
2020-09-18 14:30             ` H.J. Lu
2020-09-21  8:21               ` Florian Weimer
2020-09-21 11:31                 ` H.J. Lu
2020-09-25 12:55                   ` Florian Weimer
2020-09-12 13:44 ` [PATCH 2/3] Set tunable value as well as min/max values H.J. Lu
2020-09-18  8:29   ` Florian Weimer
2020-09-18 15:11     ` H.J. Lu
2020-09-12 13:44 ` [PATCH 3/3] ld.so: Add --list-tunables to print tunable values H.J. Lu
2020-09-18  8:13   ` Florian Weimer
2020-09-18 15:24     ` H.J. Lu
  -- strict thread matches above, loose matches on Subject: below --
2020-07-12 14:24 [PATCH 0/3] " H.J. Lu
2020-07-12 14:24 ` [PATCH 1/3] x86: Initialize CPU info via IFUNC relocation [BZ 26203] H.J. Lu

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

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

  git send-email \
    --in-reply-to='CAMe9rOqDwrj5Jba2=y1HaZfs09-SQ3QRrsqF9XEQCASTxfD8jw@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.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).