Reputation: 131
The POSIX standard specifies what interface system utilities must have (amongst other things). For example, POSIX says that a conforming system must have a c compiler, and that it must use -I
to include headers, etc.
I created a lib which interfaces with C compilers, and I want to ensure that it will work with any c compiler, or at least those that are POSIX compliant.
The POSIX standard says:
-G
Create a shared library or create object files suitable for inclusion in such a shared library. Compilations shall be performed in a manner suitable for the creation of shared libraries (for example, by producing position-independent code).
...
man gcc
(v11) says:
-G num
Put definitions of externally-visible data in a small data section if that data is no bigger than
num bytes. The default value of num is 4 for any ARC configuration, or 8 when we have double
load/store operations.
These two definitions for -G
, unless I'm misunderstanding something, are entirely different.
What's going on here? Is gcc not POSIX compliant? Similarly for clang, which doesn't document a -G
option, is clang also not POSIX compliant?
What's a POSIX compliant invocation for creating a shared object that also works with common c compilers?
Upvotes: 0
Views: 46