[lld] [lld][ELF][RISC-V] Fixes undefined_cc symbol (PR #203800)

Kartik Ohlan via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 15:51:23 PDT 2026


Ko496-glitch wrote:

ping @lenary  i ran 

`cd /tmp/t6

~/llvm-project/build-release/bin/llvm-mc -filetype=obj -triple=riscv64 6a.s -o 6a.o
~/llvm-project/build-release/bin/llvm-mc -filetype=obj -triple=riscv64 6b.s -o 6b.o
~/llvm-project/build-release/bin/ld.lld 6b.o --shared -o 6b.so
~/llvm-project/build-release/bin/ld.lld 6a.o 6b.so --shared -o 6.so
~/llvm-project/build-release/bin/llvm-readelf -d -s 6.so`

and looks like the fix is working and now we are emitting the variant_cc,

Dynamic section at offset 0x2f0 contains 13 entries:
  Tag                Type               Name/Value
  0x0000000000000001 (NEEDED)           Shared library: [6b.so]
  0x0000000000000017 (JMPREL)           0x298
  0x0000000000000002 (PLTRELSZ)         24 (bytes)
  0x0000000070000001 (RISCV_VARIANT_CC) 0x0
  0x0000000000000003 (PLTGOT)           0x33c0
  0x0000000000000014 (PLTREL)           RELA
  0x0000000000000006 (SYMTAB)           0x200
  0x000000000000000b (SYMENT)           24 (bytes)
  0x0000000000000005 (STRTAB)           0x288
  0x000000000000000a (STRSZ)            15 (bytes)
  0x000000006ffffef5 (GNU_HASH)         0x248
  0x0000000000000004 (HASH)             0x268
  0x0000000000000000 (NULL)             0x0

Symbol table '.dynsym' contains 3 entries:
   Num:    Value          Size Type    Bind   Vis                    Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT                UND
     1: 0000000000000000     0 FUNC    GLOBAL DEFAULT [VARIANT_CC]   UND ext
     2: 00000000000012b0     0 NOTYPE  GLOBAL DEFAULT                  6 foo

Symbol table '.symtab' contains 5 entries:
   Num:    Value          Size Type    Bind   Vis                    Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT                UND
     1: 00000000000012b0     0 NOTYPE  LOCAL  DEFAULT                  6 $xrv64i2p1
     2: 00000000000022f0     0 NOTYPE  LOCAL  HIDDEN                   8 _DYNAMIC
     3: 00000000000012b0     0 NOTYPE  GLOBAL DEFAULT                  6 foo
     4: 0000000000000000     0 FUNC    GLOBAL DEFAULT [VARIANT_CC]   UND ext


https://github.com/llvm/llvm-project/pull/203800


More information about the llvm-commits mailing list