Skip to content

fix: ppc64el test failures in tst_disassemblyoutput#768

Open
Scottcjn wants to merge 1 commit into
KDAB:masterfrom
Scottcjn:fix/ppc64el-test-failures
Open

fix: ppc64el test failures in tst_disassemblyoutput#768
Scottcjn wants to merge 1 commit into
KDAB:masterfrom
Scottcjn:fix/ppc64el-test-failures

Conversation

@Scottcjn
Copy link
Copy Markdown

Fixes two test failures on ppc64el in tst_disassemblyoutput:

  1. readelf regex: Character class [0-9 a-zA-Z]+ too restrictive for ppc64el readelf -s output. Changed to [^\n]+ which matches any format while stopping at newline.

  2. Branch visualisation: Not every architecture emits branch visualisation for every disassembly line. Wrapped QVERIFY with isEmpty() check.

Both fixes from the Debian PowerPC porter analysis in https://bugs.debian.org/1129621#17

Tested on IBM POWER8 S824 (ppc64le). The regex change is backwards-compatible.

Fixes #766

Two fixes for ppc64el (powerpc64le) test failures:

1. readelf -s output format differs on ppc64el — the regex character
   class [0-9 a-zA-Z]+ is too restrictive. Changed to [^\n]+ which
   matches any format while still stopping at the newline.

2. Not every architecture emits branch visualisation for every
   disassembly line. On ppc64el some lines have empty visualisation.
   Wrapped the QVERIFY with an isEmpty() check so the character
   validation only runs when visualisation is present.

Both fixes from the Debian PowerPC porters analysis in
https://bugs.debian.org/1129621#17

Fixes KDAB#766
@milianw
Copy link
Copy Markdown
Collaborator

milianw commented May 12, 2026

Hey there, sorry for the delay @Scottcjn. Can you get us an objdump text output that we can use for extending our test coverage? See tst_disassemblyoutput.cpp

@Scottcjn
Copy link
Copy Markdown
Author

@milianw — generated objdump output for ppc64el (POWER8 hardware: IBM POWER S824, Ubuntu 20.04, GCC 10.5).

Binary: /usr/bin/openssl from Ubuntu's openssl package (stripped, ELF 64-bit LSB shared object, elf64-powerpcle).

Verified header:

/usr/bin/openssl: ELF 64-bit LSB shared object, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.2, BuildID[sha1]=6c3902f01f2036e9ea665fa252fab3e1ff66b6d2, for GNU/Linux 3.10.0, stripped
/usr/bin/openssl: file format elf64-powerpcle

First 300 lines of objdump -d /usr/bin/openssl showing .init, PLT thunks, and early .text:

=== Using binary: /usr/bin/openssl ===
/usr/bin/openssl: ELF 64-bit LSB shared object, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.2, BuildID[sha1]=6c3902f01f2036e9ea665fa252fab3e1ff66b6d2, for GNU/Linux 3.10.0, stripped


/usr/bin/openssl:     file format elf64-powerpcle


Disassembly of section .init:

000000000002d340 <.init>:
   2d340:	std     r2,24(r1)
   2d344:	addis   r12,r2,-1
   2d348:	ld      r12,23496(r12)
   2d34c:	mtctr   r12
   2d350:	bctr
	...
   2d360:	addis   r2,r12,12
   2d364:	addi    r2,r2,-22112
   2d368:	mflr    r0
   2d36c:	std     r0,16(r1)
   2d370:	stdu    r1,-96(r1)
   2d374:	nop
   2d378:	ld      r0,-32760(r2)
   2d37c:	cmpdi   cr7,r0,0
   2d380:	beq+    cr7,2d38c <__glink_PLTresolve-0x6fc1c>
   2d384:	bl      2d340 <__glink_PLTresolve-0x6fc68>
   2d388:	ld      r2,24(r1)
   2d38c:	addi    r1,r1,96
   2d390:	ld      r0,16(r1)
   2d394:	mtlr    r0
   2d398:	blr

Disassembly of section .text:

000000000002d3a0 <__glink_PLTresolve-0x6fc08>:
   2d3a0:	std     r2,24(r1)
   2d3a4:	addis   r12,r2,-1
   2d3a8:	ld      r12,23776(r12)
   2d3ac:	mtctr   r12
   2d3b0:	bctr
	...
   2d3c0:	std     r2,24(r1)
   2d3c4:	addis   r12,r2,-1
   2d3c8:	ld      r12,30592(r12)
   2d3cc:	mtctr   r12
   2d3d0:	bctr
	...
   2d3e0:	std     r2,24(r1)
   2d3e4:	addis   r12,r2,-1
   2d3e8:	ld      r12,22280(r12)
   2d3ec:	mtctr   r12
   2d3f0:	bctr
	...
   2d400:	std     r2,24(r1)
   2d404:	addis   r12,r2,-1
   2d408:	ld      r12,27368(r12)
   2d40c:	mtctr   r12
   2d410:	bctr
	...
   2d420:	std     r2,24(r1)
   2d424:	addis   r12,r2,-1
   2d428:	ld      r12,24848(r12)
   2d42c:	mtctr   r12
   2d430:	bctr
	...
   2d440:	std     r2,24(r1)
   2d444:	addis   r12,r2,-1
   2d448:	ld      r12,27552(r12)
   2d44c:	mtctr   r12
   2d450:	bctr
	...
   2d460:	std     r2,24(r1)
   2d464:	addis   r12,r2,-1
   2d468:	ld      r12,26144(r12)
   2d46c:	mtctr   r12
   2d470:	bctr
	...
   2d480:	std     r2,24(r1)
   2d484:	addis   r12,r2,-1
   2d488:	ld      r12,27344(r12)
   2d48c:	mtctr   r12
   2d490:	bctr
	...
   2d4a0:	std     r2,24(r1)
   2d4a4:	addis   r12,r2,-1
   2d4a8:	ld      r12,29976(r12)
   2d4ac:	mtctr   r12
   2d4b0:	bctr
	...
   2d4c0:	std     r2,24(r1)
   2d4c4:	addis   r12,r2,-1
   2d4c8:	ld      r12,26792(r12)
   2d4cc:	mtctr   r12
   2d4d0:	bctr
	...
   2d4e0:	std     r2,24(r1)
   2d4e4:	addis   r12,r2,-1
   2d4e8:	ld      r12,26224(r12)
   2d4ec:	mtctr   r12
   2d4f0:	bctr
	...
   2d500:	std     r2,24(r1)
   2d504:	addis   r12,r2,-1
   2d508:	ld      r12,25600(r12)
   2d50c:	mtctr   r12
   2d510:	bctr
	...
   2d520:	std     r2,24(r1)
   2d524:	addis   r12,r2,-1
   2d528:	ld      r12,23816(r12)
   2d52c:	mtctr   r12
   2d530:	bctr
	...
   2d540:	std     r2,24(r1)
   2d544:	addis   r12,r2,-1
   2d548:	ld      r12,24120(r12)
   2d54c:	mtctr   r12
   2d550:	bctr
	...
   2d560:	std     r2,24(r1)
   2d564:	addis   r12,r2,-1
   2d568:	ld      r12,28760(r12)
   2d56c:	mtctr   r12
   2d570:	bctr
	...
   2d580:	std     r2,24(r1)
   2d584:	addis   r12,r2,-1
   2d588:	ld      r12,27632(r12)
   2d58c:	mtctr   r12
   2d590:	bctr
	...
   2d5a0:	std     r2,24(r1)
   2d5a4:	addis   r12,r2,-1
   2d5a8:	ld      r12,26112(r12)
   2d5ac:	mtctr   r12
   2d5b0:	bctr
	...
   2d5c0:	std     r2,24(r1)
   2d5c4:	addis   r12,r2,-1
   2d5c8:	ld      r12,24968(r12)
   2d5cc:	mtctr   r12
   2d5d0:	bctr
	...
   2d5e0:	std     r2,24(r1)
   2d5e4:	addis   r12,r2,-1
   2d5e8:	ld      r12,27328(r12)
   2d5ec:	mtctr   r12
   2d5f0:	bctr
	...
   2d600:	std     r2,24(r1)
   2d604:	addis   r12,r2,-1
   2d608:	ld      r12,24392(r12)
   2d60c:	mtctr   r12
   2d610:	bctr
	...
   2d620:	std     r2,24(r1)
   2d624:	addis   r12,r2,-1
   2d628:	ld      r12,30152(r12)
   2d62c:	mtctr   r12
   2d630:	bctr
	...
   2d640:	std     r2,24(r1)
   2d644:	addis   r12,r2,-1
   2d648:	ld      r12,28872(r12)
   2d64c:	mtctr   r12
   2d650:	bctr
	...
   2d660:	std     r2,24(r1)
   2d664:	addis   r12,r2,-1
   2d668:	ld      r12,26328(r12)
   2d66c:	mtctr   r12
   2d670:	bctr
	...
   2d680:	std     r2,24(r1)
   2d684:	addis   r12,r2,-1
   2d688:	ld      r12,26608(r12)
   2d68c:	mtctr   r12
   2d690:	bctr
	...
   2d6a0:	std     r2,24(r1)
   2d6a4:	addis   r12,r2,-1
   2d6a8:	ld      r12,32560(r12)
   2d6ac:	mtctr   r12
   2d6b0:	bctr
	...
   2d6c0:	std     r2,24(r1)
   2d6c4:	addis   r12,r2,-1
   2d6c8:	ld      r12,30616(r12)
   2d6cc:	mtctr   r12
   2d6d0:	bctr
	...
   2d6e0:	std     r2,24(r1)
   2d6e4:	addis   r12,r2,-1
   2d6e8:	ld      r12,25024(r12)
   2d6ec:	mtctr   r12
   2d6f0:	bctr
	...
   2d700:	std     r2,24(r1)
   2d704:	addis   r12,r2,-1
   2d708:	ld      r12,22208(r12)
   2d70c:	mtctr   r12
   2d710:	bctr
	...

=== Full symbol-listed disassembly first 500 lines for test coverage ===

/usr/bin/openssl:     file format elf64-powerpcle


Disassembly of section .init:

000000000002d340 <.init>:
   2d340:	18 00 41 f8 	std     r2,24(r1)
   2d344:	ff ff 82 3d 	addis   r12,r2,-1
   2d348:	c8 5b 8c e9 	ld      r12,23496(r12)
   2d34c:	a6 03 89 7d 	mtctr   r12
   2d350:	20 04 80 4e 	bctr
	...
   2d360:	0c 00 4c 3c 	addis   r2,r12,12
   2d364:	a0 a9 42 38 	addi    r2,r2,-22112
   2d368:	a6 02 08 7c 	mflr    r0
   2d36c:	10 00 01 f8 	std     r0,16(r1)
   2d370:	a1 ff 21 f8 	stdu    r1,-96(r1)
   2d374:	00 00 00 60 	nop
   2d378:	08 80 02 e8 	ld      r0,-32760(r2)
   2d37c:	00 00 a0 2f 	cmpdi   cr7,r0,0
   2d380:	0c 00 fe 41 	beq+    cr7,2d38c <__glink_PLTresolve-0x6fc1c>
   2d384:	bd ff ff 4b 	bl      2d340 <__glink_PLTresolve-0x6fc68>
   2d388:	18 00 41 e8 	ld      r2,24(r1)
   2d38c:	60 00 21 38 	addi    r1,r1,96
   2d390:	10 00 01 e8 	ld      r0,16(r1)
   2d394:	a6 03 08 7c 	mtlr    r0
   2d398:	20 00 80 4e 	blr

Disassembly of section .text:

000000000002d3a0 <__glink_PLTresolve-0x6fc08>:
   2d3a0:	18 00 41 f8 	std     r2,24(r1)
   2d3a4:	ff ff 82 3d 	addis   r12,r2,-1
   2d3a8:	e0 5c 8c e9 	ld      r12,23776(r12)
   2d3ac:	a6 03 89 7d 	mtctr   r12
   2d3b0:	20 04 80 4e 	bctr
	...
   2d3c0:	18 00 41 f8 	std     r2,24(r1)
   2d3c4:	ff ff 82 3d 	addis   r12,r2,-1
   2d3c8:	80 77 8c e9 	ld      r12,30592(r12)
   2d3cc:	a6 03 89 7d 	mtctr   r12
   2d3d0:	20 04 80 4e 	bctr
	...
   2d3e0:	18 00 41 f8 	std     r2,24(r1)
   2d3e4:	ff ff 82 3d 	addis   r12,r2,-1
   2d3e8:	08 57 8c e9 	ld      r12,22280(r12)
   2d3ec:	a6 03 89 7d 	mtctr   r12
   2d3f0:	20 04 80 4e 	bctr
	...
   2d400:	18 00 41 f8 	std     r2,24(r1)
   2d404:	ff ff 82 3d 	addis   r12,r2,-1
   2d408:	e8 6a 8c e9 	ld      r12,27368(r12)
   2d40c:	a6 03 89 7d 	mtctr   r12
   2d410:	20 04 80 4e 	bctr
	...
   2d420:	18 00 41 f8 	std     r2,24(r1)
   2d424:	ff ff 82 3d 	addis   r12,r2,-1
   2d428:	10 61 8c e9 	ld      r12,24848(r12)
   2d42c:	a6 03 89 7d 	mtctr   r12
   2d430:	20 04 80 4e 	bctr
	...
   2d440:	18 00 41 f8 	std     r2,24(r1)
   2d444:	ff ff 82 3d 	addis   r12,r2,-1
   2d448:	a0 6b 8c e9 	ld      r12,27552(r12)
   2d44c:	a6 03 89 7d 	mtctr   r12
   2d450:	20 04 80 4e 	bctr
	...
   2d460:	18 00 41 f8 	std     r2,24(r1)
   2d464:	ff ff 82 3d 	addis   r12,r2,-1
   2d468:	20 66 8c e9 	ld      r12,26144(r12)
   2d46c:	a6 03 89 7d 	mtctr   r12
   2d470:	20 04 80 4e 	bctr
	...
   2d480:	18 00 41 f8 	std     r2,24(r1)
   2d484:	ff ff 82 3d 	addis   r12,r2,-1
   2d488:	d0 6a 8c e9 	ld      r12,27344(r12)
   2d48c:	a6 03 89 7d 	mtctr   r12
   2d490:	20 04 80 4e 	bctr
	...
   2d4a0:	18 00 41 f8 	std     r2,24(r1)
   2d4a4:	ff ff 82 3d 	addis   r12,r2,-1
   2d4a8:	18 75 8c e9 	ld      r12,29976(r12)
   2d4ac:	a6 03 89 7d 	mtctr   r12
   2d4b0:	20 04 80 4e 	bctr
	...
   2d4c0:	18 00 41 f8 	std     r2,24(r1)
   2d4c4:	ff ff 82 3d 	addis   r12,r2,-1
   2d4c8:	a8 68 8c e9 	ld      r12,26792(r12)
   2d4cc:	a6 03 89 7d 	mtctr   r12
   2d4d0:	20 04 80 4e 	bctr
	...
   2d4e0:	18 00 41 f8 	std     r2,24(r1)
   2d4e4:	ff ff 82 3d 	addis   r12,r2,-1
   2d4e8:	70 66 8c e9 	ld      r12,26224(r12)

If you need different sections (full .text, PLT, specific functions) or a different binary (something with hand-written assembly like a libcrypto fast path, or a llama.cpp PSE build with explicit vec_perm/vec_msum instructions), happy to generate those too. The POWER8 lab here has the toolchain ready.

For tst_disassemblyoutput.cpp test coverage, this binary should be useful because:

  • It has standard PLT pattern (std, addis, ld, mtctr, bctr)
  • It's stripped — exercises hotspot's symbol-recovery code paths
  • It's the same binary an end-user would profile in a production scenario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure on powerpc 64-bit little endian (ppc64el) (proposed fix attached)

2 participants