[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread sebunger44 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #13 from Sebastian Unger --- No worries, the constructor attribute is much better. I was aware of that, but at the time had already several examples using .preinit_array and couldn't be bothered to look it up. I later added the sort

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #12 from Andrew Pinski --- (In reply to Sebastian Unger from comment #11) > I see. It was the SORT_BY_INIT_PRIORITY with the section name used not > actually having a priority that triggered it, was it?! If I change the > section nam

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread sebunger44 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #11 from Sebastian Unger --- I see. It was the SORT_BY_INIT_PRIORITY with the section name used not actually having a priority that triggered it, was it?! If I change the section name to .init_array.1 then it works. But, yes, you su

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #10 from Andrew Pinski --- Changing it into: static void leon_initialise(void) __attribute__((constructor)); Fixes the ICE and fixes the code to be better and not depened on init_array there either ...

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread sebunger44 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #9 from Sebastian Unger --- (In reply to Sebastian Unger from comment #8) > Not that on my target everything compiles and runs fine without -flto! Not -> Note

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread sebunger44 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #8 from Sebastian Unger --- Not that on my target everything compiles and runs fine without -flto!

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread sebunger44 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #7 from Sebastian Unger --- How is it broken and how should it be rewritten?

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #6 from Andrew Pinski --- Note I suspect this part of the code example you gave: ``` static void const * const leon_init __attribute__((section (".init_array"), retain, used)) = (void*)leon_initialise; ``` Is broken and should be re

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #5 from Andrew Pinski --- Note I get the crash with a cross to aarch64 where both gcc and ld are from the trunk. So this does look like the crash was introduced by a ld change ...

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread sebunger44 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #4 from Sebastian Unger --- I should have mentioned that for my TC I use binutils 2.41.

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #3 from Andrew Pinski --- LD that causes the crash: ``` GNU ld (GNU Binutils for Ubuntu) 2.38 Copyright (C) 2022 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #2 from Andrew Pinski --- But changing env to Ubuntu, upstream GCC produces an ICE: ``` Segmentation fault 0xf370cf crash_signal /home/apinski/src/upstream-gcc/gcc/gcc/toplev.cc:316 0x7f1bac5a351f ??? ./signal/../sysd

[Bug lto/113183] LTO crashes with Segmentation fault

2023-12-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183 --- Comment #1 from Andrew Pinski --- GCC trunk fails with: ``` [apinski@xeond2 tt]$ ~/upstream-gcc/bin/gcc -nostartfiles -O2 -flto -T link.ld tt.cpp -o tt tt.cpp:18:90: warning: ‘retain’ attribute ignored [-Wattributes] 18 | static void cons