[Bug 263265] The port audio/dexed fails to build: error: undefined symbol: environ - when a shared library using environ is linked with -Wl,--no-undefined

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 04 Jul 2022 00:43:31 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265

--- Comment #8 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Yuri Victorovich from comment #0)

I tried looking up environ for POSIX via:

https://pubs.opengroup.org/onlinepubs/9699919799/

and I did not find any criteria for dlopen handling or
related material. I just found the following:

QUOTE
When a C-language program is executed as a result of a call to one of the exec
family of functions, it shall be entered as a C-language function call as
follows:

int main (int argc, char *argv[]);

where argc is the argument count and argv is an array of character pointers to
the arguments themselves. In addition, the following variable, which must be
declared by the user if it is to be used directly:

extern char **environ;
END QUOTE

So far as I can tell, FreeBSD's somewhat unusual handling is
conformant with POSIX and programs that do not work on
FreeBSD because of what this report is about have gone beyond
what POSIX indicates. I'm not aware of other standards covering
environ that are not more operating-system-family specific.
(If I've missed something in POSIX, feel free to let me know.)

(environ is not from a C language standard vintage.)

None of that dictates what FreeBSD should do. But POSIX compliance
would not seem to be a contribution to the choices made (so long
as FreeBSD stays compliant for environ).

It may be that FreeBSD should explicitly document the issue.
So far as I can tell, the addition of such documentation to
environ(7) would not contradict the existing description of
FreeBSD's environ handling. It would just be new material.

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