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

Several SPARC lld issues in compiler-rt tests #100320

Open
rorth opened this issue Jul 24, 2024 · 3 comments
Open

Several SPARC lld issues in compiler-rt tests #100320

rorth opened this issue Jul 24, 2024 · 3 comments
Assignees
Labels

Comments

@rorth
Copy link
Collaborator

rorth commented Jul 24, 2024

When running an LLVM build on Debian/sparc64, several compiler-rt tests FAIL with linker errors. Although the primary linker is ld.bfd 2.42.50.20240625, some tests are specificially run with ld.lld. Admittedly this is currenty lld 16.0.6, AFAICS most if not all of the issues remain:

ld.lld: error: unknown emulation: elf32_sparc
ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x1c): unknown relocation (82) against symbol main
ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x20): unknown relocation (83) against symbol main
ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x24): unknown relocation (84) against symbol main

which is

#define R_SPARC_GOTDATA_OP_HIX22	82
#define R_SPARC_GOTDATA_OP_LOX10	83
#define R_SPARC_GOTDATA_OP	84
ld.lld: error: /tmp/lit-tmp-gq6t5qs1/coverage-linkage-35e2a3.o:(__llvm_prf_data+0x10): unknown relocation (46) against symbol 

which is

#define R_SPARC_DISP64		46	/* PC relative 64 bit */
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC

I'm still looking how to properly disable use of -fuse-lld on this target; maybe it should be done in compiler-rt for now.

@llvmbot
Copy link
Member

llvmbot commented Jul 24, 2024

@llvm/issue-subscribers-lld-elf

Author: Rainer Orth (rorth)

When running an LLVM build on Debian/sparc64, several `compiler-rt` tests `FAIL` with linker errors. Although the primary linker is `ld.bfd` 2.42.50.20240625, some tests are specificially run with `ld.lld`. Admittedly this is currenty `lld` 16.0.6, AFAICS most if not all of the issues remain: ``` ld.lld: error: unknown emulation: elf32_sparc ``` ``` ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x1c): unknown relocation (82) against symbol main ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x20): unknown relocation (83) against symbol main ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x24): unknown relocation (84) against symbol main ``` which is ``` #define R_SPARC_GOTDATA_OP_HIX22 82 #define R_SPARC_GOTDATA_OP_LOX10 83 #define R_SPARC_GOTDATA_OP 84 ``` ``` ld.lld: error: /tmp/lit-tmp-gq6t5qs1/coverage-linkage-35e2a3.o:(__llvm_prf_data+0x10): unknown relocation (46) against symbol ``` which is ``` #define R_SPARC_DISP64 46 /* PC relative 64 bit */ ``` ``` ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC ``` I'm still looking how to properly disable use of `-fuse-lld` on this target; maybe it should be done in `compiler-rt` for now.

@EugeneZelenko EugeneZelenko removed the lld label Jul 24, 2024
rorth added a commit to rorth/llvm-project that referenced this issue Jul 25, 2024
As detailed in Issue llvm#100320, a considerable number of tests that
explicitly use `-fuse-ld=lld` `FAIL` on Linux/sparc64 due to several `lld`
limitations (no 32-bit SPARC support, lack of support for various
relocations, ...).

To reduce the noise, this patch disables `COMPILER_RT_HAS_LLD` on SPARC
wholesale.

Tested on `sparc64-unknown-linux-gnu`.
@MaskRay
Copy link
Member

MaskRay commented Jul 27, 2024

I believe the Sparc port of lld for the 64-bit architecture was contributed by enthusiasts without long-term maintenance plans.
The 32-bit architecture was never seriously considered.
Due to the complexity of older architectures and potential ABI issues requiring significant changes to the core codebase, maintaining the 32-bit version poses challenges and risks to the project's overall health.
Given the limited user base and the availability of GNU ld as a functional alternative, I think it is reasonable to consider the 32-bit Sparc architecture unsupported for lld.

@rorth
Copy link
Collaborator Author

rorth commented Jul 28, 2024

Thanks for the explanation. I've just had a look: after the initial code drop back in 2017 there were barely any non-mechanical changes to the file.

Given that situation (no 32-bit support at all, incomplete 64-bit reloc support, ...), I guess it's reasonable to disable the -fuse-ld=lld tests in compiler-rt as I've proposed in PR #100533?

rorth added a commit that referenced this issue Jul 29, 2024
As detailed in Issue #100320, a considerable number of tests that
explicitly use `-fuse-ld=lld` `FAIL` on Linux/sparc64 due to several
`lld` limitations (no 32-bit SPARC support, lack of support for various
relocations, ...).

To reduce the noise, this patch disables `COMPILER_RT_HAS_LLD` on SPARC
wholesale.

Tested on `sparc64-unknown-linux-gnu`.
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Jul 29, 2024
As detailed in Issue llvm#100320, a considerable number of tests that
explicitly use `-fuse-ld=lld` `FAIL` on Linux/sparc64 due to several
`lld` limitations (no 32-bit SPARC support, lack of support for various
relocations, ...).

To reduce the noise, this patch disables `COMPILER_RT_HAS_LLD` on SPARC
wholesale.

Tested on `sparc64-unknown-linux-gnu`.

(cherry picked from commit 33a50e0)
tru pushed a commit to llvmbot/llvm-project that referenced this issue Jul 29, 2024
As detailed in Issue llvm#100320, a considerable number of tests that
explicitly use `-fuse-ld=lld` `FAIL` on Linux/sparc64 due to several
`lld` limitations (no 32-bit SPARC support, lack of support for various
relocations, ...).

To reduce the noise, this patch disables `COMPILER_RT_HAS_LLD` on SPARC
wholesale.

Tested on `sparc64-unknown-linux-gnu`.

(cherry picked from commit 33a50e0)
banach-space pushed a commit to banach-space/llvm-project that referenced this issue Aug 7, 2024
As detailed in Issue llvm#100320, a considerable number of tests that
explicitly use `-fuse-ld=lld` `FAIL` on Linux/sparc64 due to several
`lld` limitations (no 32-bit SPARC support, lack of support for various
relocations, ...).

To reduce the noise, this patch disables `COMPILER_RT_HAS_LLD` on SPARC
wholesale.

Tested on `sparc64-unknown-linux-gnu`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants