Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld.lld unknown relocation (110) against symbol for powerpc64 #1260

Closed
nathanchance opened this issue Jan 18, 2021 · 4 comments
Closed

ld.lld unknown relocation (110) against symbol for powerpc64 #1260

nathanchance opened this issue Jan 18, 2021 · 4 comments
Labels
[ARCH] powerpc This bug impacts ARCH=powerpc [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 12 This bug was fixed in LLVM 12.0 [Reported-by] kbuild test robot Reported-by: kbuild test robot <lkp@intel.com> [TOOL] lld The issue is relevant to LLD linker

Comments

@nathanchance
Copy link
Member

Just filing this from https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/message/X43XFH7N4VREFNFWVMEUHJFFXD4QTWMG.

$ curl -LSs https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/message/X43XFH7N4VREFNFWVMEUHJFFXD4QTWMG/attachment/2/config.gz | gzip -d > .config

$ make -skj"$(nproc)" ARCH=powerpc CC=clang CROSS_COMPILE=powerpc64-linux-gnu- LD=ld.lld olddefconfig vmlinux
ld.lld: error: arch/powerpc/built-in.a(kernel/exceptions-64e.o):(.text+0x22FE): unknown relocation (110) against symbol interrupt_base_book3e
ld.lld: error: arch/powerpc/built-in.a(kernel/exceptions-64e.o):(.text+0x2316): unknown relocation (110) against symbol __end_interrupts
ld.lld: error: arch/powerpc/built-in.a(kernel/exceptions-64e.o):(.text+0x248A): unknown relocation (110) against symbol interrupt_base_book3e
ld.lld: error: arch/powerpc/built-in.a(kernel/exceptions-64e.o):(.text+0x24A2): unknown relocation (110) against symbol __end_interrupts
ld.lld: error: arch/powerpc/built-in.a(kernel/exceptions-64e.o):(.text+0x36BA): unknown relocation (110) against symbol
ld.lld: error: undefined symbol: .early_setup
>>> referenced by arch/powerpc/kernel/head_64.o:(.ref.text+0x8E)
>>> did you mean: early_setup
>>> defined in: arch/powerpc/built-in.a(kernel/setup_64.o)
@nathanchance nathanchance added [BUG] Untriaged Something isn't working [ARCH] powerpc This bug impacts ARCH=powerpc [Reported-by] kbuild test robot Reported-by: kbuild test robot <lkp@intel.com> labels Jan 18, 2021
@nickdesaulniers
Copy link
Member

Relocation number 110 is not listed in "Figure 4-1. Relocation Table" https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#RELOC-TYPE cc @uweigand @MaskRay

I wonder if GAS is producing a new 64b relocation type?

@uweigand
Copy link

That ABI doc is outdated, the current version is now maintained by OpenPOWER. 110 is R_PPC64_ADDR16_HIGH, see: http://cdn.openpowerfoundation.org/wp-content/uploads/resources/leabi/content/ch03s05s03.html

@MaskRay
Copy link
Member

MaskRay commented Jan 19, 2021

https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html is what people usually refer to as ELF v1.

The OpenPower document is ELF v2.

I did not know #high (no overflow check) exists while there is also #hi (overflow check)... I'll implement it in LLD.

The relocation desugars from

LOAD_REG_IMMEDIATE_SYM(r14, r15, interrupt_base_book3e)

// arch/powerpc/include/asm/ppc_asm.h defines LOAD_REG_IMMEDIATE_SYM and __AS_ATHIGH

Clang generated code does not use @high as far as I can tell.

@nickdesaulniers nickdesaulniers added [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 12 This bug was fixed in LLVM 12.0 [Reported-by] kbuild test robot Reported-by: kbuild test robot <lkp@intel.com> [TOOL] lld The issue is relevant to LLD linker and removed [Reported-by] kbuild test robot Reported-by: kbuild test robot <lkp@intel.com> [BUG] Untriaged Something isn't working labels Jan 19, 2021
@nickdesaulniers
Copy link
Member

thanks @MaskRay @uweigand

arichardson pushed a commit to arichardson/llvm-project that referenced this issue Mar 30, 2021
R_PPC64_ADDR16_HI represents bits 16-31 of a 32-bit value
R_PPC64_ADDR16_HIGH represents bits 16-31 of a 64-bit value.

In the Linux kernel, `LOAD_REG_IMMEDIATE_SYM` defined in `arch/powerpc/include/asm/ppc_asm.h`
uses @l, @high, @higher, @highest to load the 64-bit value of a symbol.

Fixes ClangBuiltLinux/linux#1260
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
R_PPC64_ADDR16_HI represents bits 16-31 of a 32-bit value
R_PPC64_ADDR16_HIGH represents bits 16-31 of a 64-bit value.

In the Linux kernel, `LOAD_REG_IMMEDIATE_SYM` defined in `arch/powerpc/include/asm/ppc_asm.h`
uses @l, @high, @higher, @highest to load the 64-bit value of a symbol.

Fixes ClangBuiltLinux/linux#1260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] powerpc This bug impacts ARCH=powerpc [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 12 This bug was fixed in LLVM 12.0 [Reported-by] kbuild test robot Reported-by: kbuild test robot <lkp@intel.com> [TOOL] lld The issue is relevant to LLD linker
Projects
None yet
Development

No branches or pull requests

4 participants