From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
To: Willy Tarreau <w@1wt.eu>, "Paul E . McKenney" <paulmck@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] tools/nolibc/stdlib: only reference the external environ when inlined
Date: Wed, 23 Mar 2022 20:36:24 +0700 [thread overview]
Message-ID: <5b611ae8-aca6-71c1-6a86-6234f61f1608@gnuweeb.org> (raw)
In-Reply-To: <20220323071807.14413-3-w@1wt.eu>
On 3/23/22 2:18 PM, Willy Tarreau wrote:
> When building with gcc at -O0 we're seeing link errors due to the
> "environ" variable being referenced by getenv(). The problem is that
> at -O0 gcc will not inline getenv() and will not drop the external
> reference. One solution would be to locally declare the variable as
> weak, but then it would appear in all programs even those not using
> it, and would be confusing to users of getenv() who would forget to
> set environ to envp.
>
> An alternate approach used in this patch consists in always inlining
> the outer part of getenv() that references this extern so that it's
> always dropped when not used. The biggest part of the function was
> now moved to a new function called _getenv() that's still not inlined
> by default.
>
> Reported-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
> Signed-off-by: Willy Tarreau <w@1wt.eu>
> ---
This one works nicely. I will resend my previous RFC after this one
lands in Paul's tree to avoid conflict.
Tested-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Thanks!
--
Ammar Faizi
next prev parent reply other threads:[~2022-03-23 13:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 7:18 [PATCH 0/2] nolibc: fix two build issues at -O0 Willy Tarreau
2022-03-23 7:18 ` [PATCH 1/2] tools/nolibc/string: do not use __builtin_strlen() " Willy Tarreau
2022-03-23 7:18 ` [PATCH 2/2] tools/nolibc/stdlib: only reference the external environ when inlined Willy Tarreau
2022-03-23 13:36 ` Ammar Faizi [this message]
2022-03-23 23:16 ` [PATCH 0/2] nolibc: fix two build issues at -O0 Paul E. McKenney
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=5b611ae8-aca6-71c1-6a86-6234f61f1608@gnuweeb.org \
--to=ammarfaizi2@gnuweeb.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=w@1wt.eu \
/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
all inboxes | Powered by JetHome®