fix compile for Clang#409
Closed
geekLucian wants to merge 7 commits into
Closed
Conversation
It's unnecessary and non-portable; Clang doesn't even implement that part of GNU C.
Clang's driver does not seem to forward this on, unlike GCC's, so instead ensure the linker sees it by using -Wl.
Clang only supports register variables when declared at global scope (and only for non-allocatable registers, which is fine for tp), so move thread_pointer. This does not make thread_pointer visible outside the translation unit, it merely acts as a C alias for tp, so the semantics remain unchanged.
GNU as let .weak override .globl since binutils-gdb 5ca547dc2399a0a5d9f20626d4bf5547c3ccfddd (1996) while MC lets the last directive win (PR38921). https://reviews.llvm.org/D90108 For current version of riscv-tests, compile with clang will get errors of change binding of certain symbols to .globl. Change its second definition to .weak will let clang pass the compilation without affecting GNU's compilation sanity.
aswaterman
requested changes
Sep 15, 2022
Collaborator
aswaterman
left a comment
There was a problem hiding this comment.
Having two copies of everything substantially adds to the maintenance burden. Can you please instead find a common dialect that works for both toolchains? It’s totally fine to change the existing code for the GCC toolchain provided it still works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When trying to compile riscv-tests with clang, several incompatible compilation issues between clang and gcc are met, such as:
0f:7fc00000.weakoverride.globl, while clang lets the last directive win https://reviews.llvm.org/D90108