[Bug 265008] 'undefined symbol: environ' when a shared library is built which shouldn't happen according to environ(7)

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 03 Jul 2022 07:33:24 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265008

--- Comment #1 from Yuri Victorovich <yuri@freebsd.org> ---
The -Wl,--no-undefined flag triggers it.


Testcase:

$ cat x.c 

extern char **environ;

char** fn() {
        return environ;
}

$ cc --shared -o x.so -fPIC -Wl,--no-undefined  x.c
ld: error: undefined symbol: environ
>>> referenced by x.c
>>>               /tmp/x-0e96b0.o:(fn)
cc: error: linker command failed with exit code 1 (use -v to see invocation)

-- 
You are receiving this mail because:
You are the assignee for the bug.