Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Jul 2022 07:33:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 265008] 'undefined symbol: environ' when a shared library is built which shouldn't happen according to environ(7)
Message-ID:  <bug-265008-29464-Vnk8GrPqG8@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-265008-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-265008-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265008

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


Testcase:

$ cat x.c=20

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)

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-265008-29464-Vnk8GrPqG8>