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

fix compile for Clang #409

Closed
wants to merge 7 commits into from
Closed

fix compile for Clang #409

wants to merge 7 commits into from

Conversation

geekLucian
Copy link

When trying to compile riscv-tests with clang, several incompatible compilation issues between clang and gcc are met, such as:

jrtc27 and others added 7 commits September 10, 2022 07:42
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.
Copy link
Collaborator

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@geekLucian geekLucian closed this by deleting the head repository Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants