Git Product home page Git Product logo

Comments (3)

smithp35 avatar smithp35 commented on May 26, 2024

Thanks for the suggestion and the motivating details. If I've understood this correctly this is a data relocation, that generates a GOT entry, and resolves to the 32-bit pc-relative offset to that GOT entry. The GOT entry may point to an entity that isn't DSO local so this may require a dynamic relocation.

I think the expression we use for that for the equivalent instruction relocations is G(GDAT(S+A))- P
GDAT(S+A) generates the GOT entry and the dynamic relocation R__GLOB_DAT(S+A).
G(GDAT(S+A)) is the address of that GOT entry
G(GDAT(S+A)) - P is the offset to the GOT entry.

I note that no linker currently implements the GDAT(S+A) correctly, I think LLD would implement as G(GDAT(S)) - P + A and GNU ld would ignore the addend A (#217) that is probably best handled by issue 217 so I suggest we keep the expression consistent.

I think this would result in:

GOT-relative data relocation
...
315 | - | R_<CLS>_GOTREL32 | G(GDAT(S+A))- P | Write bits [31:0] of X at byte-aligned place P. This represents a 32-bit offset relative to GOT, treated as signed; Check that -2^31 <= X < 2^31 |

I think the fastest way to progress this would be to submit a pull request with the suggested changes. Otherwise it is waiting for someone to write it up.

To me (as an individual) the proposal looks reasonable. I'm wondering if it is worth defining a 64-bit R__GOTREL64 while we are here. My instinct is that we wait till something needs it.

from abi-aa.

PiJoules avatar PiJoules commented on May 26, 2024

Thanks for the suggestion and the motivating details. If I've understood this correctly this is a data relocation, that generates a GOT entry, and resolves to the 32-bit pc-relative offset to that GOT entry. The GOT entry may point to an entity that isn't DSO local so this may require a dynamic relocation.

Correct

I think the expression we use for that for the equivalent instruction relocations is G(GDAT(S+A))- P GDAT(S+A) generates the GOT entry and the dynamic relocation R__GLOB_DAT(S+A). G(GDAT(S+A)) is the address of that GOT entry G(GDAT(S+A)) - P is the offset to the GOT entry.

Oh ok that makes sense. I actually didn't notice GDAT(S+A) before but that equation works also.

I note that no linker currently implements the GDAT(S+A) correctly, I think LLD would implement as G(GDAT(S)) - P + A and GNU ld would ignore the addend A (#217) that is probably best handled by issue 217 so I suggest we keep the expression consistent.

I think this would result in:

GOT-relative data relocation
...
315 | - | R_<CLS>_GOTREL32 | G(GDAT(S+A))- P | Write bits [31:0] of X at byte-aligned place P. This represents a 32-bit offset relative to GOT, treated as signed; Check that -2^31 <= X < 2^31 |

I think the fastest way to progress this would be to submit a pull request with the suggested changes. Otherwise it is waiting for someone to write it up.

Can do. Wanted some early feedback to see if there would be any hard no's.

To me (as an individual) the proposal looks reasonable. I'm wondering if it is worth defining a 64-bit R__GOTREL64 while we are here. My instinct is that we wait till something needs it.

I'm also in the boat of reserving it until it's needed.

from abi-aa.

PiJoules avatar PiJoules commented on May 26, 2024

Submitted #223

from abi-aa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.