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

wrong instruction generation #78

Open
jnk0le opened this issue Apr 23, 2022 · 4 comments
Open

wrong instruction generation #78

jnk0le opened this issue Apr 23, 2022 · 4 comments

Comments

@jnk0le
Copy link

jnk0le commented Apr 23, 2022

in "GOT-indirect addressing"

1:
auipc a0, %got_pcrel_hi(msg + 1)
ld a0, %pcrel_lo(1b)(a0)

Which generates the following assembler output and relocations as seen by objdump:

0000000000000000 <.text>:
0: 00000517 auipc a0,0x0
0: R_RISCV_GOT_HI20 msg+0x1
4: 00050513 mv a0,a0
4: R_RISCV_PCREL_LO12_I .L1

ld should not expand into mv, looks like copypasted from section above

@jnk0le jnk0le changed the title wrong pseudoinstruction expansion wrong instruction generation Apr 23, 2022
@jnk0le jnk0le closed this as completed Jun 23, 2024
@pdfrod
Copy link

pdfrod commented Oct 19, 2024

This doesn't seem fixed? I'm still seeing mv a0,a0 in GOT-indirect addressing section.

@aswaterman
Copy link
Contributor

Agreed, that line should be replaced with 4: 00053503 ld a0,0(a0). The rest is correct.

@jnk0le jnk0le reopened this Oct 19, 2024
@jnk0le
Copy link
Author

jnk0le commented Oct 19, 2024

one thing is that this could be actual intermediate output from compilers, which gets "relaxed" at later stages.

@aswaterman
Copy link
Contributor

Yeah, but not in this particular situation, AFAICS.

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

No branches or pull requests

3 participants