https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577
--- Comment #104 from dave.anglin at bell dot net --- On 2019-07-25 8:46 p.m., dave.anglin at bell dot net wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577 > > --- Comment #103 from dave.anglin at bell dot net --- > On 2019-07-25 7:27 p.m., elowe at elowe dot com wrote: >> According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64919 >> >> comment 6 >> >> "As far as I can tell all g++ versions available for download are broken, so >> you have to first download and build 4.7.4 or earlier, applying the same >> gcc/config/ia64/hpux.h as above. This version builds with gcc, not g++, so >> the >> bootstrap isn't a problem. Once you have a fixed 4.7.4 g++, you can then use >> that to bootstrap 4.9.2 - after again apply the hpux.h edit to the 4.9.2 >> sources." > I think there's an alternative to this fix: > > /* The HP-UX linker has a bug that causes calls from functions in > .text.unlikely to functions in .text to cause a segfault. Until > it is fixed, prevent code from being put into .text.unlikely or > .text.hot. */ > > #define TARGET_ASM_FUNCTION_SECTION ia64_hpux_function_section > > In pa.c, we have the following to suppress hot and cold partitioning: > > /* Disable -freorder-blocks-and-partition as we don't support hot and > cold partitioning. */ > if (flag_reorder_blocks_and_partition) > { > inform (input_location, > "%<-freorder-blocks-and-partition%> does not work " > "on this architecture"); > flag_reorder_blocks_and_partition = 0; > flag_reorder_blocks = 1; > } I should have said that this is to avoid the "#undef MAKE_DECL_ONE_ONLY" hack. It's also possible to define "text_section" if necessary to ensure everything goes in .text. You can see sections in executable with "readelf -S". This should show if you're hitting the linker bug. I think we need more info on linker bug. You might look at pa_function_section(). It's for both ELF and SOM. Is -ffunction-sections being used (named sections)?