mirror of
git://git.musl-libc.org/musl
synced 2024-12-13 18:25:52 +00:00
5552ce5200
this eliminates the last need for the SHARED macro to control how files in the src tree are compiled. the same code is used for both libc.a and libc.so, with additional code for the dynamic linker (from the new ldso tree) being added to libc.so but not libc.a. separate .o and .lo object files still exist for the src tree, but the only difference is that the .lo files are built as PIC. in the future, if/when we add dlopen support for static-linked programs, much of the code in dynlink.c may be moved back into the src tree, but properly factored into separate source files. in that case, the code in the ldso tree will be reduced to just the dynamic linker entry point, self-relocation, and loading of libraries needed by the main application.
17 lines
439 B
C
17 lines
439 B
C
#define SHARED
|
|
#define START "_start"
|
|
#define _dlstart_c _start_c
|
|
#include "../ldso/dlstart.c"
|
|
|
|
int main();
|
|
void _init() __attribute__((weak));
|
|
void _fini() __attribute__((weak));
|
|
_Noreturn int __libc_start_main(int (*)(), int, char **,
|
|
void (*)(), void(*)(), void(*)());
|
|
|
|
__attribute__((__visibility__("hidden")))
|
|
_Noreturn void __dls2(unsigned char *base, size_t *sp)
|
|
{
|
|
__libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0);
|
|
}
|