Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 724264 - sys-boot/palo-2.12 with sys-devel/gcc-10.1.0 miscompiles IPL, triggers HPMC
Summary: sys-boot/palo-2.12 with sys-devel/gcc-10.1.0 miscompiles IPL, triggers HPMC
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: HPPA Linux
: Normal normal
Assignee: HPPA Porters
URL: https://lore.kernel.org/linux-parisc/...
Whiteboard:
Keywords:
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2020-05-20 08:01 UTC by Jeroen Roovers (RETIRED)
Modified: 2023-10-01 05:58 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
sys-boot:palo-2.12:20200518-151820.log.xz (sys-boot:palo-2.12:20200518-151820.log.xz,2.57 KB, application/x-xz)
2020-05-20 09:06 UTC, Jeroen Roovers (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Roovers (RETIRED) gentoo-dev 2020-05-20 08:01:56 UTC
HARD Booted.
<Cpu0> 0000107e00e00000  0000000000000000  CC_BOOT_LAUNCH_IPL_PRI
<Cpu0> 0100142900e00000  fffffff0f0e0ac00  CC_CPU_INTRIGUE_LDB
<Cpu0> 3400082100e00000  0000000000000001  CC_BOOT_BOOT_COMPLETE
<Cpu0> e800009800e00000  00000000000640a8  CC_ERR_CHECK_HPMC
<Cpu0> 37000f7300e00000  8040004000000000  CC_ERR_CPU_CHECK_SUMMARY
<Cpu0> f600105e00e00000  fffffff0f0c00000  CC_MC_HPMC_MONARCH_SELECTED
<Cpu0> 140003b200e00000  000000000000000b  CC_ERR_HPMC_STATE_ENTRY
<Cpu0> 400010bd00e00000  0000000000000000  CC_MC_OS_HPMC_CODE_ZERO
<Cpu0> 5600106400e00000  fffffff0f0435110  CC_MC_BR_TO_OS_HPMC_FAILED

I didn't record the HPMC (yet).
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2020-05-20 08:07:13 UTC
Merely switching back to sys-devel/gcc-9.3.0 works around the issue.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2020-05-20 08:32:07 UTC
Normally this would show up as:

HARD Booted.
<Cpu0> 0000109800e00000  0000000000000000  CC_BOOT_LAUNCH_IPL_OTHR
<Cpu0> 0100142900e00000  fffffff0f0e0ac00  CC_CPU_INTRIGUE_LDB
<Cpu0> 3400082100e00000  0000000000000001  CC_BOOT_BOOT_COMPLETE
palo ipl 2.12 http://www.parisc-linux.org - Tue Oct 1 05:26:38 EDT 2019

Boot image contains:
    0/vmlinux64 16301344(0) bytes @ 0xe000
    0/ramdisk 5685144 bytes @ 0xf9a000

Information: No console specified on kernel command line. This is normal.
PALO will choose the console currently used by firmware (serial).
Current command line:
0/vmlinux initrd=0/ramdisk root=/dev/ram0 console=ttyS0 TERM=vt102
 0: 0/vmlinux
 1: initrd=0/ramdisk
 2: root=/dev/ram0
 3: console=ttyS0
 4: TERM=vt102
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2020-05-20 09:06:17 UTC
Created attachment 640492 [details]
sys-boot:palo-2.12:20200518-151820.log.xz
Comment 4 Larry the Git Cow gentoo-dev 2020-05-20 09:56:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de9ddf0d8414328da4af833bbf46c9810084852f

commit de9ddf0d8414328da4af833bbf46c9810084852f
Author:     Jeroen Roovers <jer@gentoo.org>
AuthorDate: 2020-05-20 09:55:43 +0000
Commit:     Jeroen Roovers <jer@gentoo.org>
CommitDate: 2020-05-20 09:56:22 +0000

    sys-boot/palo: Fix compiling ipl with GCC 10
    
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Bug: https://bugs.gentoo.org/724264
    Signed-off-by: Jeroen Roovers <jer@gentoo.org>

 sys-boot/palo/files/palo-2.12-gcc10.patch | 11 ++++++++
 sys-boot/palo/palo-2.12-r1.ebuild         | 44 +++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
Comment 5 Larry the Git Cow gentoo-dev 2020-05-20 20:02:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c8a1f566b00d6eaa447eec8b17a86a4be66d0fb

commit 5c8a1f566b00d6eaa447eec8b17a86a4be66d0fb
Author:     Jeroen Roovers <jer@gentoo.org>
AuthorDate: 2020-05-20 20:02:01 +0000
Commit:     Jeroen Roovers <jer@gentoo.org>
CommitDate: 2020-05-20 20:02:45 +0000

    sys-boot/palo: Old
    
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Closes: https://bugs.gentoo.org/show_bug.cgi?id=724264
    Signed-off-by: Jeroen Roovers <jer@gentoo.org>

 sys-boot/palo/palo-2.12.ebuild | 43 ------------------------------------------
 1 file changed, 43 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=753be99e27af82ca91ebab7cd7802d0a632dd7bf

commit 753be99e27af82ca91ebab7cd7802d0a632dd7bf
Author:     Jeroen Roovers <jer@gentoo.org>
AuthorDate: 2020-05-20 20:01:06 +0000
Commit:     Jeroen Roovers <jer@gentoo.org>
CommitDate: 2020-05-20 20:02:44 +0000

    sys-boot/palo: Stable
    
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Bug: https://bugs.gentoo.org/show_bug.cgi?id=724264
    Signed-off-by: Jeroen Roovers <jer@gentoo.org>

 sys-boot/palo/palo-2.12-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-20 21:04:04 UTC
To elaborate a bit more on breakage mechanics why -fno-builtin helps here:

mis-compliation happens in ipl/lib.c file where a bunch of C-library substitutes like malloc() and strcpy() are provided to make self-contained static iplelf binary to later convert to iplboot.

Worst-affected function seems to be a memset() definition. Here is a shrinked example:

  // cat lib_minimized.c
  typedef unsigned long size_t;
  void * memset(void * s, int c, size_t count)
  {
    char *xs = (char *) s;
    while (count--)
        *xs++ = c;
    return s;
  }

$ hppa2.0-unknown-linux-gnu-gcc -O2 -mdisable-fpregs -Wall -fno-delete-null-pointer-checks -S -fverbose-asm -o lib_minimized.S lib_minimized.c -fdump-tree-all -fdump-rtl-all

$ cat lib_minimized.c.234t.optimized

;; Function memset (memset, funcdef_no=0, decl_uid=796, cgraph_uid=1, symbol_order=0)

Removing basic block 5
__attribute__((nothrow, leaf))
memset (void * s, int c, size_t count)
{
  char _4;
  int _18;

  <bb 2> [local count: 118111600]:
  if (count_6(D) != 0)
    goto <bb 4>; [89.00%]
  else
    goto <bb 3>; [11.00%]

  <bb 3> [local count: 118111600]:
  return s_5(D);

  <bb 4> [local count: 105119324]:
  _4 = (char) c_10(D);
  _18 = (int) _4;
  __builtin_memset (s_5(D), _18, count_6(D));
  goto <bb 3>; [100.00%]

}

Note how tree transform made memset() into __builtin_memset().

$ cat lib_minimized.S
; GNU C17 (Gentoo 10.1.0 p1) version 10.1.0 (hppa2.0-unknown-linux-gnu)
...
	.text
	.align 4
.globl memset
	.type	memset, @function
memset:
	.PROC
	.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=4
	.ENTRY
	stw %r2,-20(%r30)	;,
	stwm %r4,64(%r30)	;,,
	stw %r3,-60(%r30)	;,
	copy %r26,%r3	; s, tmp106
; lib_minimized.c:7:     while (count--)
	comib,= 0,%r24,.L4	;,, tmp108,
	stw %r19,-32(%r30)	;,
; lib_minimized.c:8:         *xs++ = c;
	bl memset,%r2	;,
	extrs %r25,31,8,%r25	; c,
.L4:
; lib_minimized.c:11: }
	copy %r3,%r28	; s,
	ldw -84(%r30),%r2	;,
	ldw -60(%r30),%r3	;,
	bv %r0(%r2)
	ldwm -64(%r30),%r4	;,,
	.EXIT
	.PROCEND
	.size	memset, .-memset
	.ident	"GCC: (Gentoo 10.1.0 p1) 10.1.0"

Here RTL turned __builtin_memset() into memset() call building endless recursion.