https://sourceware.org/bugzilla/show_bug.cgi?id=23906

--- Comment #21 from Tamar Christina <tnfchris at sourceware dot org> ---
It seems that Nick was right that this hitting the stack limit.

The reason it's doing so is that you have a quite a lot of templates in your
C++ code.

The linker seems to segfault when it's trying to demangle this symbol
_ZNSt11_Tuple_implILj0EJN7General6Parser4NodeINS1_7KeywordILj4ELj2EEENS1_6StatesIJNS2_INS3_ILj5ELj3EEENS5_IJNS1_4SCPI3EndINS7_15CommandInternalIRKS4_JNS1_5ParamIfEENS7_5BlankILj0EEEEEEZNS7_7CommandISB

which is done in libiberty
https://github.com/gcc-mirror/gcc/blob/master/libiberty/cp-demangle.c#L4315

This hits two VLAs expanding two structs of 16 bytes. However you have 1485065
entries in dpi.num_copy_templates

causing it to push the stack down (dpi.num_saved_scopes +
dpi.num_copy_templates) * 16 bytes. Which is 190129824 bytes, or 181mb and so
way over blowing your stack limit.

I tried with GCC 9 which seems to do a better job with the templates and it
works there. But I guess the real fix is to not use those VLAs in libiberty.

But I believe that's maintained by GCC if I'm not mistaken.

for now, you can work around it by increasing your ulimit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to