Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 May 2023 23:20:55 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 268518] Undefined symbol error when building shared library with environ(7)
Message-ID:  <bug-268518-227-JNaX1MrRww@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-268518-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-268518-227@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=3D268518

--- Comment #2 from Konstantin Belousov <kib@FreeBSD.org> ---
POSIX does not have the concept of shared libraries.  It is only vaguely
mentioned in the description of dl* functions, for instance

void *dlopen(const char *file, int mode);
25290 DESCRIPTION
25291
The dlopen( ) function shall make the symbols (function identifiers and data
object identifiers) in
25292
the executable object file specified by file available to the calling progr=
am.
25293
The class of executable object files eligible for this operation and the ma=
nner
of their
25294
construction are implementation-defined, though typically such files are sh=
ared
libraries or
25295
programs.

In FreeBSD, environ is exported by the main binary, moving it to e.g. libc =
is
impossible without breaking
ABI.  Practically it would end in the main binary anyway, with the copy
relocation from libc.

Simply do not link with --no-undefined if you absolutely need environ refer=
ence
from dso.  Why you cannot
use POSIX getenv(3) and friends?

--=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-268518-227-JNaX1MrRww>