about summary refs log tree commit diff
path: root/arch/mips/crt_arch.h
Commit message (Collapse)AuthorAgeFilesLines
* remove workaround for broken mips assemblersRich Felker2016-02-081-4/+1
| | | | | | | | | | | | | | | | | | | | the workaround was for a bug that botched .gpword references to local labels, applying a nonsensical random offset of -0x4000 to them. this reverses commit 5e396fb996a80b035d0f6ecf7fed50f68aa3ebb7 and a removes a similar hack that was added to syscall_cp.s in the later commit 756c8af8589265e99e454fe3adcda1d0bc5e1963. it turns out one additional instance of the same idiom, the GETFUNCSYM macro in arch/mips/reloc.h, was still affected by the assembler bug and does not admit an easy workaround without making assumptions about how the macro is used. the previous workarounds made static linking work but left the early-stage dynamic linker broken and thus had limited usefulness. instead, affected users (using binutils versions older than 2.20) will need to fix the bug on the binutils side; the trivial patch is commit 453f5985b13e35161984bf1bf657bbab11515aa4 in the binutils-gdb repository.
* adjust mips crt_arch entry point asm to avoid assembler bugsRich Felker2015-12-291-1/+4
| | | | | | | | | | | | | 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.
* fix stack alignment code in mips crt_arch.hRich Felker2015-05-241-2/+2
| | | | | | | | | | | | | | the instruction used to align the stack, "and $sp, $sp, -8", does not actually exist; it's expanded to 2 instructions using the 'at' (assembler temporary) register, and thus cannot be used in a branch delay slot. since alignment mod 16 commutes with subtracting 8, simply swapping these two operations fixes the problem. crt1.o was not affected because it's still being generated from a dedicated asm source file. dlstart.lo was not affected because the stack pointer it receives is already aligned by the kernel. but Scrt1.o was affected in cases where the dynamic linker gave it a misaligned stack pointer.
* add .text section directive to all crt_arch.h files missing itRich Felker2015-05-221-0/+1
| | | | | | | | i386 and x86_64 versions already had the .text directive; other archs did not. normally, top-level (file scope) __asm__ starts in the .text section anyway, but problems were reported with some versions of clang, and it seems preferable to set it explicitly anyway, at least for the sake of consistency between archs.
* fix missing quotation mark in mips crt_arch.h that broke buildRich Felker2015-04-171-1/+1
|
* dynamic linker bootstrap overhaulRich Felker2015-04-131-21/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this overhaul further reduces the amount of arch-specific code needed by the dynamic linker and removes a number of assumptions, including: - that symbolic function references inside libc are bound at link time via the linker option -Bsymbolic-functions. - that libc functions used by the dynamic linker do not require access to data symbols. - that static/internal function calls and data accesses can be made without performing any relocations, or that arch-specific startup code handled any such relocations needed. removing these assumptions paves the way for allowing libc.so itself to be built with stack protector (among other things), and is achieved by a three-stage bootstrap process: 1. relative relocations are processed with a flat function. 2. symbolic relocations are processed with no external calls/data. 3. main program and dependency libs are processed with a fully-functional libc/ldso. reduction in arch-specific code is achived through the following: - crt_arch.h, used for generating crt1.o, now provides the entry point for the dynamic linker too. - asm is no longer responsible for skipping the beginning of argv[] when ldso is invoked as a command. - the functionality previously provided by __reloc_self for heavily GOT-dependent RISC archs is now the arch-agnostic stage-1. - arch-specific relocation type codes are mapped directly as macros rather than via an inline translation function/switch statement.
* new mostly-C crt1 implementationRich Felker2013-07-261-0/+21
the only immediate effect of this commit is enabling PIE support on some archs that did not previously have any Scrt1.s, since the existing asm files for crt1 override this C code. so some of the crt_arch.h files committed are only there for the sake of documenting what their archs "would do" if they used the new C-based crt1. the expectation is that new archs should use this new system rather than using heavy asm for crt1. aside from being easier and less error-prone, it also ensures that PIE support is available immediately (since Scrt1.o is generated from the same C source, using -fPIC) rather than having to be added as an afterthought in the porting process.