[Bug c++/118716] GCC(11.2) generating newer symbol for std::string::compare while linking against older runtime(libstdc++ : 6.0.13)

2025-02-03 Thread rayatha1 at in dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118716

Ravali Yatham  changed:

   What|Removed |Added

 Resolution|INVALID |---
 Status|RESOLVED|UNCONFIRMED

--- Comment #3 from Ravali Yatham  ---
Apologies if there was a misunderstanding, My words might have been misleading.

Please read "we would like to link against older c/c++ runtime with GCC 11.2."
as "we would like to compile it with gcc 11.2 while linking against older c/c++
runtime".

I guess this is supported, as documented in "-std" flag?

On the comment "You cannot compile a newer code with libstdc++ headers and
thinking it will link with the older library." : no we don't intent to compile
newer code with older c++ runtime, our intent is to link it against old ones.

We don't have new code, ours is old code that used to compile with gcc 4.x.

Even if new code was used, isn't linking against new libs fully ignoring the
"-std" flag? Is there a caveat on the usage of the flag that suggests it may be
ignored/ overridden if the said target do not have required symbols it will be
picked up from available link targets?

thanks in advance!

[Bug c++/118716] New: GCC(11.2) generating newer symbol for std::string::compare while linking against older runtime(libstdc++ : 6.0.13)

2025-01-31 Thread rayatha1 at in dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118716

Bug ID: 118716
   Summary: GCC(11.2) generating newer symbol for
std::string::compare while linking against older
runtime(libstdc++ : 6.0.13)
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rayatha1 at in dot ibm.com
  Target Milestone: ---

Background: We have an agent code which was previously compiled with GCC 4.4.7
using libc 2.12 and libstdc++ : 6.0.13 and are planning to upgrade it to GCC
11.2. However to maintain backward Compatibility we would like to link against
older c/c++ runtime with GCC 11.2.


Environment:
Red Hat Enterprise Linux Server release 6.10 (Santiago)

$g++ --version
g++ (GCC) 11.2.0

$ldd --version
ldd (GNU libc) 2.12

$ls -lrt /usr/lib64 | grep libstdc++
libstdc++.so.6.0.13

Sample Code:
#include 
#include 

int main() {
std::string foo = "apple";
std::string bar = "banana";
if(foo.compare(bar) == 0){
std::cout<<"Equal" No issue
GCC 7.5 => No issue
GCC 9.3 => No issue
GCC-10.3 => Issue started
GCC-11.2 => Issue