From: Fengkai Sun <qcloud1014@gmail.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: libc-help@sourceware.org
Subject: Re: CHECK_STATIC_TLS in R_X86_64_TPOFF64 type relocation
Date: Mon, 27 Dec 2021 11:05:46 +0800 [thread overview]
Message-ID: <CAF6YOcOZvy7k5tGScE7yDsjLuweJZmRPYhrVMSDQN79k6tQQrw@mail.gmail.com> (raw)
In-Reply-To: <87wnjrjrjp.fsf@mid.deneb.enyo.de>
Hi Florian,
Thanks for your reply!
I figure out that dlopened DSOs could use the initial-exec model: as long
as they can have access to static TLS, they are the same as DSOs introduced
by the main executable.
However, I am confused why (and when) the link editor emits initial-exec
for DSOs, because this model is not guaranteed to work. If the TLS segment
in a dlopened DSO is too large to fit in static space, it will fail the
main program and the user does not have a way to fix it. In contrast, the
two dynamic models always work.
Sorry if this sounds deviated and like a linker-related question.
---
Thanks,
Fengkai
On Sun, Dec 26, 2021 at 11:48 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> * Fengkai Sun via Libc-help:
>
> >> We are trying to perform a static TLS relocation in MAP, but it was
> > dynamically loaded.
> >
> > To the best of my knowledge, I found that R_X86_64_TPOFF64 is for
> > Initial-exec TLS model, which only appears in executables.
>
> No, initial-exec in shared objects is fine (as long as static TLS
> space is available).
>
> Local-exec TLS in executables does not need relocations, and the link
> editor typically relaxes initial-exec TLS reference in main programs
> to local-exec TLS, leaving no of them trace (except for the PT_TLS
> segment).
>
prev parent reply other threads:[~2021-12-27 3:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-26 13:29 Fengkai Sun
2021-12-26 15:48 ` Florian Weimer
2021-12-27 3:05 ` Fengkai Sun [this message]
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=CAF6YOcOZvy7k5tGScE7yDsjLuweJZmRPYhrVMSDQN79k6tQQrw@mail.gmail.com \
--to=qcloud1014@gmail.com \
--cc=fw@deneb.enyo.de \
--cc=libc-help@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).