summaryrefslogtreecommitdiff
path: root/tools/lib/api/debug.c
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2022-03-23 10:18:07 +0300
committerPaul E. McKenney <paulmck@kernel.org>2022-04-21 03:05:46 +0300
commit2475d37ac30b8a850d3dd4fcbcb20895928b73fd (patch)
tree587979e0fcf8f611a1912d0393c64b4b741d0e39 /tools/lib/api/debug.c
parent96980b833a21c6dc29d0dfdc8f211fb8a10256a7 (diff)
downloadlinux-2475d37ac30b8a850d3dd4fcbcb20895928b73fd.tar.xz
tools/nolibc/stdlib: only reference the external environ when inlined
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> Tested-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'tools/lib/api/debug.c')
0 files changed, 0 insertions, 0 deletions