Link with correct values-*.o files on Solaris (PR target/40411)
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Tue Jan 30 14:03:00 GMT 2018
Hi Joseph,
> On Fri, 12 Jan 2018, Rainer Orth wrote:
>
>> At the same time, I had a new look at when values-Xc.o is used by the
>> Studio compilers. It selects strict ISO C mode in a couple of cases,
>> and the latest Studio 12.6 cc, which is about to do away with the
>> previous -Xc option which enabled that mode in favour of gcc-compatible
>> -pedantic, uses the latter to control its use. So I've changed gcc to
>> follow suit.
>
> gcc -pedantic is only ever a diagnostic option, not a semantic one; it's
> incorrect to use it to change library semantics. The relevant options for
> strict ISO C (and C++) modes are -ansi, -std=c*, -std=iso9899:199409 and
> aliases for those options.
that's what you get for changing your code at the eleventh hour ;-)
Before introducing -pedantic, I had
#define STARTFILE_ARCH_SPEC \
"%{ansi|std=c90|std=iso9899\\:199409:values-Xc.o%s; :values-Xa.o%s} \
(which isn't correct either since it only handled C90 and C94). I don't
think you need to handle the aliases explicitly: last time I checked
they never arrive in specs.
Prompted by the realization that -ansi applies to both C and C++ and I
only meant to affect C, I had a look at what the (then recently
released) Studio 12.6 compilers do, which strive for more GCC
compatibility.
I've now also checked the OpenSolaris libc and libm sources for uses of
_lib_version == strict_ansi (as is set in values-Xc.o). libc has none,
and the uses in libm all follow this pattern (ignoring C Issue 4.2
compatibility mode handling no longer activated):
if (lib_version == strict_ansi) {
errno = EDOM;
} else if (!matherr(&exc)) {
errno = EDOM;
}
The default implementation of matherr (overridable by the user) just returns 0.
So it seems the following snippet
#define STARTFILE_ARCH_SPEC \
[...]
%{std=c9*|std=iso9899\\:199409|std=c1*:values-Xc.o%s; :values-Xa.o%s} \
seems like the right thing to do, as you said.
> -ansi is not defined as a .opt alias of -std=c90 (because the option it's
> an alias for depends on whether C or C++ is being compiled), so I'd expect
> the specs to need to handle it along with -std=c90. I'd also expect
> -std=iso9899:199409 to need to be handled there, supposing handling it
> like -std=c90 is correct. And what about C++ versions not based on C99 or
> later?
I'm of mixed minds about whether or not to include -ansi in the above
list: for C it's correct, for C++ it's less clear. AFAIK there's no way
to distinguish between different languages in specs (like via an -x
<lang> switch always passed in). OTOH, it has always been there already.
The following patch implements the above with corresponding comment
adjustments. I'm open to suggestions what to do about -ansi.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2018-01-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/40411
* config/sol2.h (STARTFILE_ARCH_SPEC): Use -std=c9*,
-std=iso9899:199409, -std=c1* instead of -pedantic to select
values-Xc.o.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-values-Xc.patch
Type: text/x-patch
Size: 1271 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180130/07fff52a/attachment.bin>
More information about the Libstdc++
mailing list