Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
L llvm-project
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 33
    • Issues 33
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Code Review
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Morello
  • llvm-project
  • Issues
  • #50

Closed
Open
Created May 17, 2022 by Matthew Malcomson@mmalcomsonDeveloper

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] $ 
Edited May 17, 2022 by Matthew Malcomson
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking