Comments (8)
Documenting this would be more natural in the sysvabi as that has a dedicated section on the ToDo list on Program Loading and Dynamic Linking (#152).
The reserved contents of The GOT for example are a convention between the dynamic loader and static linker.
Whether the .got or .got.plt are in separate sections is to some degree convention. In AArch32 the GNU ld default linker script merges the two:
.got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
but on AArch64 it keeps them separate as the .got can be made RELRO but the .got.plt cannot (with lazy binding)
.got : { *(.got) *(.igot) }
. = DATA_SEGMENT_RELRO_END (24, .);
.got.plt : { *(.got.plt) *(.igot.plt) }
It isn't compulsary to have a single .got in AArch32, lld keeps the .got and .got.plt separate in its default layout. I think the important part to document is the value of the _GLOBAL_OFFSET_TABLE_
symbol which the compiler sometimes refers to by convention as meaning base of the GOT, it is important to know whether that is the base of the .got or .got.plt.
from abi-aa.
Defining _GLOBAL_OFFSET_TABLE_
(the start of .got
) will be nice. On x86, the lack of clarity caused https://reviews.llvm.org/D59594 to lld.
Note that we should not require .got[0] == _DYNAMIC
. GNU ld's aarch64 port reserves the entry for glibc rtld but ld.lld does not reserve the entry. I have removed glibc 2.35's reliance on _GLOBAL_OFFSET_TABLE_[0]
for arm/aarch64.
from abi-aa.
Why does it need to be defined? It's just a hook for the linker to calculate offsets against. Indeed, on AArch32 there's the potential to put the GLOBAL_OFFSET_TABLE in the middle of the GOT and then you can use negative offsets as well as positive ones to double the useful size of the GOT with instructions like LDR.
from abi-aa.
From memory it is because there are some code-sequences where it can matter. For example GCC will generate for -fpic
// aarch64-linux-gnu -c -fpic file.c
// int foo;
// int func() { return foo; }
0: 00 00 00 90 adrp x0, 0x0 <func>
0000000000000000: R_AARCH64_ADR_PREL_PG_HI21 _GLOBAL_OFFSET_TABLE_
4: 00 00 40 f9 ldr x0, [x0]
0000000000000004: R_AARCH64_LD64_GOTPAGE_LO15 foo
8: 00 00 40 b9 ldr w0, [x0]
c: c0 03 5f d6 ret
The ldr x0, [x0] // R_AARCH64_LD64_GOTPAGE_LO15 foo
is unsigned so GLOBAL_OFFSET_TABLE can't be above the GOT.
from abi-aa.
W.r.t. the part of the issue around the gABI referencing section names in the processor supplement (which don't match our section names).
I've got the impression from this thread that we're not concerned about that, is that correct?
W.r.t. the fact that we do not describe what is stored in DT_PLTGOT
in any of our documents.
That seems like something we should address if it's not specified in any generic ABI specification.
The description of "an address associated with the procedure linkage table and/or the global offset table" which is what the generic ABI uses doesn't seem sufficient.
I think we should add mention of it in the sysvabi -- does that sound right?
from abi-aa.
I agree that the sysvabi is the right place for a description of DT_PLTGOT. I can send a patch for that later this week.
On Arm and AArch64 it is just the address of the .got.plt section. This is the case for most architectures I think. Looking at the linker code there are some differences on some targets, such as with Sparc where it is expected to point at the start of the .plt section. This difference for some processors probably prevented the gABI from defining it.
from abi-aa.
#173 created to add definition of DT_PLTGOT to sysvabi64
from abi-aa.
#173 has been merged and does contain a definition of DT_PLTGOT. I'm closing this issue for now. If there's anything we've missed we can reopen or raise a new issue.
from abi-aa.
Related Issues (20)
- [sysvabi64] document requirement for bti c in more detail HOT 1
- [aaelf64] BTI PLT requirement should be weaker HOT 2
- Is page-size part of the ABI ? HOT 1
- [sysvabi64] Optional `add x16, x16, :lo12: &.got.plt[N]]` for `ld -z now` HOT 5
- Clarify definition of HFA in AAPCS64 HOT 8
- RST code blocks of type "none" cause warnings when generating html
- Word wrap in RST source files is inconsistent
- PAuthABI support for DWARF (Debugging and Unwinding)
- Reserve DT_ tags used in the PAuthABI and MemtagABI.
- static linkers (lld and GNU ld) out of sync with aaelf64 for GOT relocations with addends. HOT 2
- Need dynamic tag to reflect .note.gnu.prop and/or .note.AARCH64-PAUTH-ABI-tag section addresses HOT 3
- Define GOT-Relative data relocation HOT 3
- Undefined weak symbol's address HOT 8
- Missing page "Semihosting for AArch32 and AArch64" HOT 4
- [pauthabielf64] Define `NT_ARM_TYPE_PAUTH_ABI_TAG` constant
- Some documents have stopped rendering in the preview mode in the Github UI HOT 3
- aaelf64/aaelf64.rst can't preview HOT 2
- Clarify use of DWARF versions
- Quantifying the benefits of DT_AARCH64_AUTH_RELR HOT 5
- [PAUTHABIELF64] Possible typo in `R_AARCH64_AUTH_GOT_LO12_NC` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abi-aa.