--- binutils.orig/ld/ldlang.c 2024-07-30 16:10:24.931862075 +0100 +++ binutils-2.41/ld/ldlang.c 2024-07-30 19:11:58.741929934 +0100 @@ -7940,6 +7940,19 @@ lang_list_remove_tail (lang_statement_li { union lang_statement_union **savetail; /* Check that ORIGLIST really is an earlier state of DESTLIST. */ + + if (getenv ("LD_DEBUG_NEVER") != NULL) + { + /* FIXME: RHEL-49348: For some reason building this function for the + PowerPC architecture on RHEL-10 is resulting in a linker that + triggers the ASSERT below - because the origlist pointer is + corrupt. These fprintf statements, even if they will never be + used, are enough to cause the compiler to build the function + correctly, thus avoiding the problem. */ + fprintf (stderr, "origlist %p destlist %p\n", origlist, destlist); + fprintf (stderr, "heads: %p %p\n", origlist->head, destlist->head); + } + ASSERT (origlist->head == destlist->head); savetail = origlist->tail; origlist->head = *(savetail);