From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Linux: Consolidate auxiliary vector parsing (redo)
Date: Mon, 14 Feb 2022 10:00:06 -0300 [thread overview]
Message-ID: <8da69301-2650-a38d-2e96-665a7ba14c8d@linaro.org> (raw)
In-Reply-To: <87ee4563t9.fsf@oldenburg.str.redhat.com>
On 14/02/2022 09:16, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>> I still think this approach is still fragile since we don't how if this
>> will be the only optimization option gcc will make loops to memset. We
>> already have a similar problem on _dl_start, but it is slight different
>> since the clear memory should be done before self-relocation. Also for
>> memset.c itself there is no much we can do, so we need to resort on
>> -fno-tree-loop-distribute-patterns.
>>
>> However in this case I think it would be better to avoid hacking the
>> compiler and expect it does not generate broken code and instead assume
>> memset *might* be generate and work around it. We already have the
>> hack on sysdeps/generic/symbol-hacks.h, so I think we should do something
>> similiar:
>>
>> 1. Add a __memset_generic internal symbol on all ports to avoid the
>> iFUNC plt (which seems to be cause of this issue).
>>
>> 2. Add a symbol redirection to call such symbol when required (most
>> likely in the dl-start.h as H.J has suggested.
>>
>> So we don't need to handle this specific issue everytime we hack into
>> the loader code.
>
> But this isn't a new problem, right?
>
> I also don't think an assembler-based symbol redirect is more portable
> than -fno-tree-loop-distribute-patterns. We need to build these parts
> with -ffreestanding, and we need a portable way (across GCC and Clang)
> to redirect the four required functions ('memcpy', 'memmove', 'memset'
> and 'memcmp', according to the GCC manual).
I don't think -ffreestanding will help much in this specific issue. The
problem is mainly that for some architectures, memcpy, memmove, memset,
and memcmp might be implemented as a iFUNC and it might no be relocated
at the time of the call. At least redirecting the calls to internal
symbols avoid this specific issue.
prev parent reply other threads:[~2022-02-14 13:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 20:33 Florian Weimer
2022-02-14 8:27 ` Szabolcs Nagy
2022-02-14 10:10 ` Florian Weimer
2022-02-14 11:44 ` Adhemerval Zanella
2022-02-14 12:16 ` Florian Weimer
2022-02-14 13:00 ` Adhemerval Zanella [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=8da69301-2650-a38d-2e96-665a7ba14c8d@linaro.org \
--to=adhemerval.zanella@linaro.org \
--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).