Hello,

We are hitting an infinite recursion in "ld", eventually leading to a 
stackoverflow and segfault, when using the --version-script option with a C++ 
symbol (which "forces" ld to demangle symbols).


This bug also affects our versions of c++filt and gdb.



Commands used:


$ /opt/imc/gcc-6.2.0/bin/g++ -fPIC -std=c++14 -O3 -ggdb -o main.cpp.o -c 
main.cpp

$ /opt/imc/gcc-6.2.0/bin/g++ -fPIC -std=c++14 -shared -o libCrash.so main.cpp.o 
-Wl,--version-script=simple.map
collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
compilation terminated.



And:


$ c++filt 
_ZSt7forwardIRP22XxxxxxxxXxxxxxxXxxxxxxI28XxxxxxxxXxxxXxxxXxxxXxxxxxxxZN3TBQ26XxxxxxxxXxxxXxxxXxxxxxxxxxINS2_14TBQXxxxXxxxxxxINS2_8TBQXxxxxINS2_12XxXxxXxxxxxxINS2_15XxxxxxxxXxxxxxxEEEEEEENS2_10TBQXxxxxxxEE5xxxxxEvEUlRT_RT0_PT1_E_Z28xxxxxxXxxxxxxxXxxxxxxXxxxxxxIS1_SJ_ESt10unique_ptrI31XxxxxxxxXxxxxxxXxxxxxxXxxxxxxxxISD_ESt14default_deleteISN_EESF_EUlR5XxxxxE_ZSK_IS1_SJ_ESQ_SF_EUlvE0_EEOSD_RNSt16remove_referenceISD_E4typeE
Segmentation fault



Versions used:


$ cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)


$ /opt/imc/gcc-6.2.0/bin/g++ --version
g++ (GCC) 6.2.0


$ c++filt --version
GNU c++filt version 2.23.52.0.1-55.el7 20130226


$ /opt/imc/gcc-6.2.0/bin/ld --version
GNU ld (GNU Binutils) 2.27


$ gdb --version
GNU gdb (GDB) Red Hat Enterprise Linux 7.10.50.20151113-33.el7



Notes:

The symbols reported in those bug reports do not crash my c++filt:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61233

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61460

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61805

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72822


However the symbol reported in this one does crash c++filt (although not ld):

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70909


Kind Regards,

Matthieu Monrocq

IMC financial markets | Strawinskylaan 377, WTC D-tower, 1077 XX Amsterdam | 
www.imc.com<http://www.imc.nl/>
P +31 (0)20 798 8601 | E matthieu.monr...@imc.com<mailto:julien.leh...@imc.nl>

________________________________

The information in this e-mail is intended only for the person or entity to 
which it is addressed.

It may contain confidential and /or privileged material. If someone other than 
the intended recipient should receive this e-mail, he / she shall not be 
entitled to read, disseminate, disclose or duplicate it.

If you receive this e-mail unintentionally, please inform us immediately by 
"reply" and then delete it from your system. Although this information has been 
compiled with great care, neither IMC Financial Markets & Asset Management nor 
any of its related entities shall accept any responsibility for any errors, 
omissions or other inaccuracies in this information or for the consequences 
thereof, nor shall it be bound in any way by the contents of this e-mail or its 
attachments. In the event of incomplete or incorrect transmission, please 
return the e-mail to the sender and permanently delete this message and any 
attachments.

Messages and attachments are scanned for all known viruses. Always scan 
attachments before opening them.
#include <iostream>

extern "C" {
void _ZSt7forwardIRP22XxxxxxxxXxxxxxxXxxxxxxI28XxxxxxxxXxxxXxxxXxxxXxxxxxxxZN3TBQ26XxxxxxxxXxxxXxxxXxxxxxxxxxINS2_14TBQXxxxXxxxxxxINS2_8TBQXxxxxINS2_12XxXxxXxxxxxxINS2_15XxxxxxxxXxxxxxxEEEEEEENS2_10TBQXxxxxxxEE5xxxxxEvEUlRT_RT0_PT1_E_Z28xxxxxxXxxxxxxxXxxxxxxXxxxxxxIS1_SJ_ESt10unique_ptrI31XxxxxxxxXxxxxxxXxxxxxxXxxxxxxxxISD_ESt14default_deleteISN_EESF_EUlR5XxxxxE_ZSK_IS1_SJ_ESQ_SF_EUlvE0_EEOSD_RNSt16remove_referenceISD_E4typeE() {
    std::cout << "Hello, World\n";
}
}

int main() {
    _ZSt7forwardIRP22XxxxxxxxXxxxxxxXxxxxxxI28XxxxxxxxXxxxXxxxXxxxXxxxxxxxZN3TBQ26XxxxxxxxXxxxXxxxXxxxxxxxxxINS2_14TBQXxxxXxxxxxxINS2_8TBQXxxxxINS2_12XxXxxXxxxxxxINS2_15XxxxxxxxXxxxxxxEEEEEEENS2_10TBQXxxxxxxEE5xxxxxEvEUlRT_RT0_PT1_E_Z28xxxxxxXxxxxxxxXxxxxxxXxxxxxxIS1_SJ_ESt10unique_ptrI31XxxxxxxxXxxxxxxXxxxxxxXxxxxxxxxISD_ESt14default_deleteISN_EESF_EUlR5XxxxxE_ZSK_IS1_SJ_ESQ_SF_EUlvE0_EEOSD_RNSt16remove_referenceISD_E4typeE();
}

{ global:
  extern "C++" {
    __wrap_memcpy;
  };
  local: *;
};
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to