Skip to content

The GAS assembler implicitly converts near->far branches#83

Merged
kito-cheng merged 1 commit intoriscv-non-isa:masterfrom
palmer-dabbelt:far-branch
Apr 27, 2023
Merged

The GAS assembler implicitly converts near->far branches#83
kito-cheng merged 1 commit intoriscv-non-isa:masterfrom
palmer-dabbelt:far-branch

Conversation

@palmer-dabbelt
Copy link
Contributor

This wasn't written down anywhere, but I'm pretty sure we've been doing it since the original port and at least GCC depends on it.

Signed-off-by: Palmer Dabbelt palmer@rivosinc.com

This wasn't written down anywhere, but I'm pretty sure we've been doing
it since the original port and at least GCC depends on it.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
@cmuellner
Copy link
Collaborator

I would search for that information in the RISC-V Toolchain Conventions, but since that document references the RISC-V Asm Manual in the Assembler behavior section, this PR is fine.

@kito-cheng, any opinion? If not, I'll merge this PR later this week.

Copy link
Collaborator

@kito-cheng kito-cheng left a comment

Choose a reason for hiding this comment

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

Generally LGTM, but I would like to add some word to mention some compiler e.g. LLVM isn't support that...although the patch for that is restart the discussion recently, but so far all clang/llvm release isn't support that feature.

@cmuellner
Copy link
Collaborator

Thanks for adding the necessary context!

Here is a summary of the situation:

  • GAS does the conversion since day 0
  • Upstream LLVM does not do this conversion
  • Nobody likes this "magic" but tools depend on it
  • Removing the need for this conversion would be much work and break existing code
  • Specifying (=requiring) the conversion and implementing it in LLVM would be the easy path
  • Having different behavior in GAS and LLVM is what everyone wants to avoid

We can set a deadline until someone can bring up a better solution. But given people repeatedly (every year) stumble into this undocumented and unexpected behavior, we should solve it this time while everyone's attention is raised.

@nick-knight
Copy link
Contributor

Is there overlap between @palmer-dabbelt 's PR and this one I filed a few years ago? #58

@palmer-dabbelt
Copy link
Contributor Author

Is there overlap between @palmer-dabbelt 's PR and this one I filed a few years ago? #58

Looks like it's doing the same thing, just with different words.

@kito-cheng
Copy link
Collaborator

LLVM support this as well on LLVM 16, so let merge!

Ref:
[1] LLVM patech: https://reviews.llvm.org/D108961

@kito-cheng kito-cheng merged commit d285e4f into riscv-non-isa:master Apr 27, 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.

4 participants