about summary refs log tree commit diff
path: root/crt
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-09-05 12:43:34 -0400
committerRich Felker <dalias@aerifal.cx>2018-09-05 14:05:14 -0400
commit9b95fd0944e4206949e90633c3fed088202810ec (patch)
tree4af9c66139abfef78854aca3200f836153727c23 /crt
parent2de29bc994029b903a366b8a4a9f8c3c3ee2be90 (diff)
downloadmusl-9b95fd0944e4206949e90633c3fed088202810ec.tar.gz
musl-9b95fd0944e4206949e90633c3fed088202810ec.tar.xz
musl-9b95fd0944e4206949e90633c3fed088202810ec.zip
define and use internal macros for hidden visibility, weak refs
this cleans up what had become widespread direct inline use of "GNU C"
style attributes directly in the source, and lowers the barrier to
increased use of hidden visibility, which will be useful to recovering
some of the efficiency lost when the protected visibility hack was
dropped in commit dc2f368e565c37728b0d620380b849c3a1ddd78f, especially
on archs where the PLT ABI is costly.
Diffstat (limited to 'crt')
-rw-r--r--crt/crt1.c5
-rw-r--r--crt/rcrt1.c7
2 files changed, 6 insertions, 6 deletions
diff --git a/crt/crt1.c b/crt/crt1.c
index af02af94..7b12665f 100644
--- a/crt/crt1.c
+++ b/crt/crt1.c
@@ -1,12 +1,13 @@
 #include <features.h>
+#include "libc.h"
 
 #define START "_start"
 
 #include "crt_arch.h"
 
 int main();
-void _init() __attribute__((weak));
-void _fini() __attribute__((weak));
+weak void _init();
+weak void _fini();
 _Noreturn int __libc_start_main(int (*)(), int, char **,
 	void (*)(), void(*)(), void(*)());
 
diff --git a/crt/rcrt1.c b/crt/rcrt1.c
index be017153..7bb3322f 100644
--- a/crt/rcrt1.c
+++ b/crt/rcrt1.c
@@ -3,13 +3,12 @@
 #include "../ldso/dlstart.c"
 
 int main();
-void _init() __attribute__((weak));
-void _fini() __attribute__((weak));
+weak void _init();
+weak void _fini();
 _Noreturn int __libc_start_main(int (*)(), int, char **,
 	void (*)(), void(*)(), void(*)());
 
-__attribute__((__visibility__("hidden")))
-_Noreturn void __dls2(unsigned char *base, size_t *sp)
+hidden _Noreturn void __dls2(unsigned char *base, size_t *sp)
 {
 	__libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0);
 }