mirror of
git://git.musl-libc.org/musl
synced 2025-01-12 09:39:39 +00:00
5e396fb996
apparently the .gpword directive does not work reliably with local text labels; values produced were offset by 64k from the correct value, resulting in incorrect computation of the got pointer at runtime. instead, use an external label so that the assembler does not munge the relocation; the linker will then get it right. commit 6fef8cafbd0f6f185897bc87feb1ff66e2e204e1 exposed this issue by removing the old, non-PIE-compatible handwritten crt1.s, which was not affected. presumably mips PIE executables (using Scrt1.o produced from crt_arch.h) were already affected at the time.
33 lines
671 B
C
33 lines
671 B
C
__asm__(
|
|
".set push\n"
|
|
".set noreorder\n"
|
|
".text \n"
|
|
".global _" START "\n"
|
|
".global " START "\n"
|
|
".global " START "_data\n"
|
|
".type _" START ", @function\n"
|
|
".type " START ", @function\n"
|
|
".type " START "_data, @function\n"
|
|
"_" START ":\n"
|
|
"" START ":\n"
|
|
" bal 1f \n"
|
|
" move $fp, $0 \n"
|
|
"" START "_data: \n"
|
|
" .gpword " START "_data \n"
|
|
" .gpword " START "_c \n"
|
|
".weak _DYNAMIC \n"
|
|
".hidden _DYNAMIC \n"
|
|
" .gpword _DYNAMIC \n"
|
|
"1: lw $gp, 0($ra) \n"
|
|
" subu $gp, $ra, $gp \n"
|
|
" move $4, $sp \n"
|
|
" lw $5, 8($ra) \n"
|
|
" addu $5, $5, $gp \n"
|
|
" lw $25, 4($ra) \n"
|
|
" addu $25, $25, $gp \n"
|
|
" and $sp, $sp, -8 \n"
|
|
" jalr $25 \n"
|
|
" subu $sp, $sp, 16 \n"
|
|
".set pop \n"
|
|
);
|