Skip to content

Conversation

@statham-arm
Copy link
Contributor

This is the first document that uses the 'rubric' markup element, so
I've added a style stanza for it in rst2pdf-abi.style. Also updated
links in other documents to link to the new location.

Copy link
Member

@stuij stuij left a comment

Choose a reason for hiding this comment

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

Thanks!

Regarding the comments on tables below, and my suggestion to use the pdf stylesheet: the html renderer is quite good at proportioning the tables, so we don't really have to worry about it. And I'd check the output pdf to see that the tables without class do render correctly.

Also updated links in other documents to link to the new location.
@stuij
Copy link
Member

stuij commented Nov 25, 2020

LGTM. Thanks!

@stuij stuij merged commit f11e316 into ARM-software:master Nov 25, 2020
@statham-arm statham-arm deleted the aaelf32 branch November 27, 2020 13:30
statham-arm added a commit to statham-arm/abi-aa that referenced this pull request Jul 1, 2024
This brings AAELF64 into line with AAELF32, which already has a
similar clarification for the MOVW+MOVT pair. For the instructions
which shift their operand left (ADRP, and the shifted MOVZ and MOVK),
if the relocation addend is taken from the input value of the
immediate field, it is not treated as shifted.

The rationale is that this allows a sequence of related instructions
to consistently compute the same value (symbol + small offset), and
cooperate to load that value into the target register, one small chunk
at a time. For example, this would load `mySymbol + 0x123`:

  mov  x0, #0x123          ; R_AARCH64_MOVW_UABS_G0_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#16 ; R_AARCH64_MOVW_UABS_G1_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#32 ; R_AARCH64_MOVW_UABS_G2_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#48 ; R_AARCH64_MOVW_UABS_G3(mySymbol)

The existing text made it unclear whether the addends were shifted or
not. If they are interpreted as shifted, then nothing useful happens,
because the first instruction would load the low 16 bits of
`mySymbol+0x123`, and the second would load the next 16 bits of
`mySymbol+0x1230000`, and so on. This doesn't reliably get you _any_
useful offset from the symbol, because the relocations are processed
independently, so that a carry out of the low 16 bits won't be taken
into account in the next 16.

If you do need to compute a large offset from the symbol, you have no
option but to use SHT_RELA and specify a full 64-bit addend: there's
no way to represent that in an SHT_REL setup. But interpreting the
SHT_REL addends in the way specified here, you can at least specify
_small_ addends successfully.
statham-arm added a commit to statham-arm/abi-aa that referenced this pull request Jul 2, 2024
This brings AAELF64 into line with AAELF32, which already has a
similar clarification for the MOVW+MOVT pair. For the instructions
which shift their operand left (ADRP, and the shifted MOVZ and MOVK),
if the relocation addend is taken from the input value of the
immediate field, it is not treated as shifted.

The rationale is that this allows a sequence of related instructions
to consistently compute the same value (symbol + small offset), and
cooperate to load that value into the target register, one small chunk
at a time. For example, this would load `mySymbol + 0x123`:

  mov  x0, #0x123          ; R_AARCH64_MOVW_UABS_G0_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#16 ; R_AARCH64_MOVW_UABS_G1_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#32 ; R_AARCH64_MOVW_UABS_G2_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#48 ; R_AARCH64_MOVW_UABS_G3(mySymbol)

The existing text made it unclear whether the addends were shifted or
not. If they are interpreted as shifted, then nothing useful happens,
because the first instruction would load the low 16 bits of
`mySymbol+0x123`, and the second would load the next 16 bits of
`mySymbol+0x1230000`, and so on. This doesn't reliably get you _any_
useful offset from the symbol, because the relocations are processed
independently, so that a carry out of the low 16 bits won't be taken
into account in the next 16.

If you do need to compute a large offset from the symbol, you have no
option but to use SHT_RELA and specify a full 64-bit addend: there's
no way to represent that in an SHT_REL setup. But interpreting the
SHT_REL addends in the way specified here, you can at least specify
_small_ addends successfully.
statham-arm added a commit to statham-arm/abi-aa that referenced this pull request Jul 2, 2024
This brings AAELF64 into line with AAELF32, which already has a
similar clarification for the MOVW+MOVT pair. For the instructions
which shift their operand left (ADRP, and the shifted MOVZ and MOVK),
if the relocation addend is taken from the input value of the
immediate field, it is not treated as shifted.

The rationale is that this allows a sequence of related instructions
to consistently compute the same value (symbol + small offset), and
cooperate to load that value into the target register, one small chunk
at a time. For example, this would load `mySymbol + 0x123`:

  mov  x0, #0x123          ; R_AARCH64_MOVW_UABS_G0_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#16 ; R_AARCH64_MOVW_UABS_G1_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#32 ; R_AARCH64_MOVW_UABS_G2_NC(mySymbol)
  movk x0, #0x123, lsl ARM-software#48 ; R_AARCH64_MOVW_UABS_G3(mySymbol)

The existing text made it unclear whether the addends were shifted or
not. If they are interpreted as shifted, then nothing useful happens,
because the first instruction would load the low 16 bits of
`mySymbol+0x123`, and the second would load the next 16 bits of
`mySymbol+0x1230000`, and so on. This doesn't reliably get you _any_
useful offset from the symbol, because the relocations are processed
independently, so that a carry out of the low 16 bits won't be taken
into account in the next 16.

If you do need to compute a large offset from the symbol, you have no
option but to use SHT_RELA and specify a full 64-bit addend: there's
no way to represent that in an SHT_REL setup. But interpreting the
SHT_REL addends in the way specified here, you can at least specify
_small_ addends successfully.
smithp35 pushed a commit that referenced this pull request Jul 8, 2024
This brings AAELF64 into line with AAELF32, which already has a
similar clarification for the MOVW+MOVT pair. For the instructions
which shift their operand left (ADRP, and the shifted MOVZ and MOVK),
if the relocation addend is taken from the input value of the
immediate field, it is not treated as shifted.

The rationale is that this allows a sequence of related instructions
to consistently compute the same value (symbol + small offset), and
cooperate to load that value into the target register, one small chunk
at a time. For example, this would load `mySymbol + 0x123`:

  mov  x0, #0x123          ; R_AARCH64_MOVW_UABS_G0_NC(mySymbol)
  movk x0, #0x123, lsl #16 ; R_AARCH64_MOVW_UABS_G1_NC(mySymbol)
  movk x0, #0x123, lsl #32 ; R_AARCH64_MOVW_UABS_G2_NC(mySymbol)
  movk x0, #0x123, lsl #48 ; R_AARCH64_MOVW_UABS_G3(mySymbol)

The existing text made it unclear whether the addends were shifted or
not. If they are interpreted as shifted, then nothing useful happens,
because the first instruction would load the low 16 bits of
`mySymbol+0x123`, and the second would load the next 16 bits of
`mySymbol+0x1230000`, and so on. This doesn't reliably get you _any_
useful offset from the symbol, because the relocations are processed
independently, so that a carry out of the low 16 bits won't be taken
into account in the next 16.

If you do need to compute a large offset from the symbol, you have no
option but to use SHT_RELA and specify a full 64-bit addend: there's
no way to represent that in an SHT_REL setup. But interpreting the
SHT_REL addends in the way specified here, you can at least specify
_small_ addends successfully.
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.

2 participants