-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysdeps/{linux,managarm}: Set RISC-V gp from .preinit_array
- Loading branch information
1 parent
c7bb359
commit c112513
Showing
4 changed files
with
74 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
|
||
.section .text | ||
.global _start | ||
_start: | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
.option push | ||
.option norelax | ||
# Load gp. | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
.option pop | ||
|
||
mv a0, sp | ||
la a1, main | ||
call __mlibc_entry@plt | ||
unimp | ||
|
||
# Load gp from .preinit_array since it may be used by the executable's .init_array. | ||
# We still load it in _start to account for static binaries. This matches glibc's behavior. | ||
load_gp: | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
|
||
.section .preinit_array,"aw" | ||
.dword load_gp | ||
|
||
.section .note.GNU-stack,"",%progbits | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
|
||
.section .text | ||
.global _start | ||
_start: | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
.option push | ||
.option norelax | ||
# Load gp. | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
.option pop | ||
|
||
mv a0, sp | ||
la a1, main | ||
call __mlibc_entry | ||
.section .note.GNU-stack,"",%progbits | ||
unimp | ||
|
||
# Load gp from .preinit_array since it may be used by the executable's .init_array. | ||
# We still load it in _start to account for static binaries. This matches glibc's behavior. | ||
load_gp: | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
|
||
.section .preinit_array,"aw" | ||
.dword load_gp | ||
|
||
.section .note.GNU-stack,"",%progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
|
||
.section .text | ||
.global _start | ||
_start: | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
.option push | ||
.option norelax | ||
# Load gp. | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
.option pop | ||
|
||
mv a0, sp | ||
la a1, main | ||
call __mlibc_entry@plt | ||
unimp | ||
|
||
# Load gp from .preinit_array since it may be used by the executable's .init_array. | ||
# We still load it in _start to account for static binaries. This matches glibc's behavior. | ||
load_gp: | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
|
||
.section .preinit_array,"aw" | ||
.dword load_gp | ||
|
||
.section .note.GNU-stack,"",%progbits | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
|
||
.section .text | ||
.global _start | ||
_start: | ||
.weak __global_pointer$ | ||
.hidden __global_pointer$ | ||
.option push | ||
.option norelax | ||
# Load gp. | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
.option pop | ||
|
||
mv a0, sp | ||
la a1, main | ||
call __mlibc_entry | ||
.section .note.GNU-stack,"",%progbits | ||
unimp | ||
|
||
# Load gp from .preinit_array since it may be used by the executable's .init_array. | ||
# We still load it in _start to account for static binaries. This matches glibc's behavior. | ||
load_gp: | ||
.option push | ||
.option norelax | ||
lla gp, __global_pointer$ | ||
.option pop | ||
|
||
.section .preinit_array,"aw" | ||
.dword load_gp | ||
|
||
.section .note.GNU-stack,"",%progbits |