LLD appears to emit RELATIVE relocations for PIE hidden undefined weak symbols.
I believe that Morello LLD is emitting RELATIVE
relocations for hidden weak undefined symbols in PIE binaries.
As Peter Smith pointed out to me, depending on the behaviour of the runtime this could lead to having a non-zero capability once the relocations have been processed.
I have not double-checked if this happens, but raising an issue since there seems to be no reason for these relocations and I expect we could do without.
vshcmd: > cat ${testsuite_path}/${testcase}.s
.weak globalsym
.weak localsym
.weak hiddensym
.hidden hiddensym
.data
.chericap globalsym
.chericap localsym
.chericap hiddensym
.text
.globl _start
_start:
adrp c0, :got:globalsym
ldr c0, [c0, #:got_lo12:globalsym]
adrp c0, :got:hiddensym
ldr c0, [c0, #:got_lo12:hiddensym]
adrp c0, :got:localsym
ldr c0, [c0, #:got_lo12:localsym]
ret
testing [10:53:54] $
vshcmd: > ~/Documents/llvm-aarch64-morello-linux/bin/clang --target=aarch64-none-linux-gnu -march=morello+c64 -mabi=purecap -c ${testsuite_path}/${testcase}.s -o ${testcase}-clang.o
vshcmd: > ~/Documents/llvm-aarch64-morello-linux/bin/ld.lld -pie ${testcase}-clang.o -o ${testcase}-lld
vshcmd: > aarch64-none-elf-readelf --relocs ${testcase}-lld
testing [10:53:58] $ testing [10:53:58] $
Relocation section '.rela.dyn' at offset 0x298 contains 6 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000020430 00000000e803 R_MORELLO_RELATIV 0
0000000304a0 00000000e803 R_MORELLO_RELATIV 0
000000020420 00010000e801 R_MORELLO_GLOB_DA 0000000000000000 globalsym + 0
000000030480 00010000e800 R_MORELLO_CAPINIT 0000000000000000 globalsym + 0
000000020440 00020000e801 R_MORELLO_GLOB_DA 0000000000000000 localsym + 0
000000030490 00020000e800 R_MORELLO_CAPINIT 0000000000000000 localsym + 0
testing [10:53:58] $
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information