https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116693
Bug ID: 116693 Summary: [RISC-V] @tlsdesc<mode> generates duplicate assembler labels Product: gcc Version: 14.2.0 Status: UNCONFIRMED Keywords: assemble-failure Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sch...@linux-m68k.org Target Milestone: --- Target: riscv*-*-* Current mesa fails to build with LTO because it emits duplicate assembler labels. src/gallium/targets/dri/libgallium-24.2.2.so.ltrans125.ltrans.s: Assembler messages: src/gallium/targets/dri/libgallium-24.2.2.so.ltrans125.ltrans.s:132389: Error: symbol `.LT178' is already defined src/gallium/targets/dri/libgallium-24.2.2.so.ltrans125.ltrans.s:135408: Error: symbol `.LT226' is already defined src/gallium/targets/dri/libgallium-24.2.2.so.ltrans125.ltrans.s:136590: Error: symbol `.LT250' is already defined make: *** [/tmp/ccU08NIk.mk:252: src/gallium/targets/dri/libgallium-24.2.2.so.ltrans125.ltrans.o] Error 1 .LBB33241: .loc 87 51 35 .LT178: auipc a0,%tlsdesc_hi(_ZGVZN4r60010MemoryPool8instanceEvE2me.lto_priv.0) ld t0,%tlsdesc_load_lo(.LT178)(a0) addi a0,a0,%tlsdesc_add_lo(.LT178) jalr t0,t0,%tlsdesc_call(.LT178) The problem is that the @tlsdesc<mode> insn uses a label number that is only unique at the time of the generation, but when the insn is duplicated the label number is not updated. The pattern should use the %= format instead of maintaining the label number explicitly.