Skip to content

Duplicate labels generated with --disable-tables-next-to-code

Summary

GHC build configured with --disable-tables-next-to-code generates assembler files with duplicated labels.

Steps to reproduce

From #24536 (closed):

./boot
./configure --disable-tables-next-to-code
hadrian/build --flavour=default+debug_info

Run ./configure --disable-tables-next-to-code, build GHC. I see this failure from as:

"inplace/bin/ghc-stage1" -static  -H32m -O -Wall  -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Iincludes/dist-install/build -Irts -Irts/dist/build -DCOMPILING_RTS -DFS_NAMESPACE=rts -this-unit-id rts -dcmm-lint     -package-env - -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen            -O2 -Wcpp-undef   -Wnoncanonical-monad-instances  -c rts/StgStdThunks.cmm

/tmp/ghc12749_0/ghc_4.s:44:1: error:
     error: symbol '.Lcb' is already defined
   |
44 | .Lcb:
   | ^
.Lcb:
^

/tmp/ghc12749_0/ghc_4.s:59:1: error:
     error: symbol '.Lc8' is already defined
   |
59 | .Lc8:
   | ^
.Lc8:
^
...
Many more.

The generated file left behind with -keep-tmp-files contains all these reported labels twice in a row, e.g.:

.section .text
.align 8
.Lcb:
.Lcb:
	movq %rbx,(%rbp)
	jmp .Lc8
	.size .Lcb, .-.Lcb
.section .data.rel.ro
.align 8
.align 1
.Lcb_info:
	.quad	.Lcb
	.quad	0
	.long	30
	.long	0
.section .text
.align 8
.Lc8:
.Lc8:
	movq (%rbp),%rax
	andq $-8,%rax
	movq 8(%rax),%rbx
	addq $8,%rbp
	jmp stg_ap_0_fast
	.size .Lc8, .-.Lc8

Confirmed stage1 is configured as expected

% "inplace/bin/ghc-stage1" --print-tables-next-to-code
NO

Expected behavior

Working build.

Environment

  • GHC version used: 9.2.5

Optional:

  • Operating System: OpenBSD
  • System Architecture: amd64
Edited by Sylvain Henry
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information