PR# 17915 Finalizing system with C++ external causes link failure due to unknown -xstrconst option

Problem Report Summary
Submitter: prestoat2000
Category: Compiler
Priority: Medium
Date: 2011/10/26
Class: Bug
Severity: Serious
Number: 17915
Release: 7.0.87514
Confidential: No
Status: Analyzed
Responsible:
Environment: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.1.8) Gecko/20100226 Firefox/3.5.8 OpenSolaris on x86
Synopsis: Finalizing system with C++ external causes link failure due to unknown -xstrconst option

Description
Finalizing a system with a C++ external causes CC to be used for the final
link rather than cc.  The "optimize" options from config.sh are
included in CPPFLAGS in the generated Makefile, CPPFLAGS are included in the
command for the final link and CC does not recognize the -xstrconst option,
so the linker issues an error and quits.

I think that to solve this problem on Solaris, you would need to have
two different CPPFLAGS variables in the Makefile, one that included the
flags from the "optimize" variable in config.sh and one that didn't include
these flags (such as CPPLDFLAGS).  If you then used CPPLDFLAGS for the
final link, it would work.

I have not added an eweasel test because there is already a test that fails
due to this problem (ccomp076).  This test passes on Linux but fails on
Solaris.

I manually ran the final link command without the problematic -xstrconst
option and confirmed that the test would pass if this option was not included
in the final link command.
To Reproduce
Run test ccomp076.
Problem Report Interactions
From:manus_eiffel    Date:2011/10/26    Download   
Because there is not much time for us to test this further, I'll postpone this change to 7.1.

From:prestoat2000    Date:2011/10/26    Download   
I can't see how -xO2 or -xstrconst would have any effect on linking.
It seems to me that it would be safe to not include them in any
link command.

From:manus_eiffel    Date:2011/10/26    Status: Analyzed    Download   
When I introduced CCLDFLAGS I think I wanted to simply get rid of the CFLAGS altogether for the link. Any reason why the -O2 or -xstrconst flag would have an impact in linking?

This would require more testing for all our supported platforms, but that's more the route I would take.