Skip to content

Conversation

@ebahapo
Copy link
Contributor

@ebahapo ebahapo commented Feb 4, 2022

This is a working draft.

@ebahapo ebahapo changed the title riscv-large.md: define the large code model Define the large code model Feb 4, 2022
@ebahapo ebahapo force-pushed the large branch 4 times, most recently from 30f3d92 to 564b95a Compare February 7, 2022 15:28

```assembly
auipc s0, %pcrel_hi(__global_pointer__)
addi s0, s0, %pcrel_lo(__global_pointer__)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't work if you have more then 2G-4G of code in the object


### Program Linkage Table

Each PLT entry follows the pattern below:
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does the linker know which you want?

jr t3
nop
2:
.quad .got.plt - ., 0
Copy link
Collaborator

@jrtc27 jrtc27 Feb 7, 2022

Choose a reason for hiding this comment

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

This either forbids lazy binding or requires RWX PLT entries at run time, not just load time (though even load time is not great); the latter is something that is strongly discouraged and has been deliberately moved away from on most architectures


| Source | Assembly | Relocations
| -- | -- | --
| `extern int src;` | `.extern src` | `R_RISCV_64`
Copy link
Collaborator

Choose a reason for hiding this comment

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

No they're not, declarations generate no code

@rui314
Copy link
Collaborator

rui314 commented Mar 20, 2022

From a linker author's perspective, we want to turn a PLT-indirect reference to a direct reference if a referenced symbol is within reach. Does this spec allow such relaxation?

@kito-cheng
Copy link
Collaborator

Prefer #388, so close this PR

@kito-cheng kito-cheng closed this Feb 15, 2024
@ebahapo ebahapo deleted the large branch February 24, 2024 21:01
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