+#include "libc.h"
+
#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
#define BLX "mov lr,pc\n\tbx"
#else
#define BLX "blx"
#endif
-extern uintptr_t __attribute__((__visibility__("hidden")))
- __a_cas_ptr, __a_barrier_ptr;
+extern hidden uintptr_t __a_cas_ptr, __a_barrier_ptr;
#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
static inline pthread_t __pthread_self()
{
- extern uintptr_t __attribute__((__visibility__("hidden"))) __a_gettp_ptr;
+ extern hidden uintptr_t __a_gettp_ptr;
register uintptr_t p __asm__("r0");
__asm__ __volatile__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
return (void *)(p-sizeof(struct pthread));
((union { long long ll; long l[2]; }){ .ll = x }).l[1]
#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
-__attribute__((visibility("hidden")))
-long (__syscall)(long, ...);
+hidden long (__syscall)(long, ...);
#define SYSCALL_RLIM_INFINITY (-1UL/2)
#define __SYSCALL_LL_E(x) (x)
#define __SYSCALL_LL_O(x) (x)
-__attribute__((visibility("hidden")))
-long (__syscall)(long, ...);
+hidden long (__syscall)(long, ...);
#define SYSCALL_RLIM_INFINITY (-1UL/2)
+#include "libc.h"
+
#if defined(__SH4A__)
#define a_ll a_ll
#else
#define a_cas a_cas
-__attribute__((__visibility__("hidden"))) extern const void *__sh_cas_ptr;
+extern hidden const void *__sh_cas_ptr;
static inline int a_cas(volatile int *p, int t, int s)
{
register int r1 __asm__("r1");
#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(*)());
#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);
}
#include <stddef.h>
#include "dynlink.h"
+#include "libc.h"
#ifndef START
#define START "_dlstart"
#ifndef GETFUNCSYM
#define GETFUNCSYM(fp, sym, got) do { \
- __attribute__((__visibility__("hidden"))) void sym(); \
+ hidden void sym(); \
static void (*static_func_ptr)() = sym; \
__asm__ __volatile__ ( "" : "+m"(static_func_ptr) : : "memory"); \
*(fp) = static_func_ptr; } while(0)
#endif
-__attribute__((__visibility__("hidden")))
-void _dlstart_c(size_t *sp, size_t *dynv)
+hidden void _dlstart_c(size_t *sp, size_t *dynv)
{
size_t i, aux[AUX_CNT], dyn[DYN_CNT];
size_t *rel, rel_size, base;
void __init_libc(char **, char *);
void *__copy_tls(unsigned char *);
-__attribute__((__visibility__("hidden")))
-const char *__libc_get_version(void);
+hidden const char *__libc_get_version(void);
static struct builtin_tls {
char c;
struct debug *_dl_debug_addr = &debug;
-__attribute__((__visibility__("hidden")))
-extern int __malloc_replaced;
+extern hidden int __malloc_replaced;
-__attribute__((__visibility__("hidden")))
-void (*const __init_array_start)(void)=0, (*const __fini_array_start)(void)=0;
+hidden void (*const __init_array_start)(void)=0, (*const __fini_array_start)(void)=0;
-__attribute__((__visibility__("hidden")))
-extern void (*const __init_array_end)(void), (*const __fini_array_end)(void);
+extern hidden void (*const __init_array_end)(void), (*const __fini_array_end)(void);
weak_alias(__init_array_start, __init_array_end);
weak_alias(__fini_array_start, __fini_array_end);
return def;
}
-__attribute__((__visibility__("hidden")))
-ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic();
+hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic();
static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stride)
{
{
}
-__attribute__((__visibility__("hidden")))
-void *__tls_get_new(tls_mod_off_t *v)
+hidden void *__tls_get_new(tls_mod_off_t *v)
{
pthread_t self = __pthread_self();
* linker itself, but some of the relocations performed may need to be
* replaced later due to copy relocations in the main program. */
-__attribute__((__visibility__("hidden")))
-void __dls2(unsigned char *base, size_t *sp)
+hidden void __dls2(unsigned char *base, size_t *sp)
{
if (DL_FDPIC) {
void *p1 = (void *)sp[-2];
return p;
}
-__attribute__((__visibility__("hidden")))
-int __dl_invalid_handle(void *h)
+hidden int __dl_invalid_handle(void *h)
{
struct dso *p;
for (p=head; p; p=p->next) if (h==p) return 0;
return 1;
}
-__attribute__((__visibility__("hidden")))
-void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra)
+hidden void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra)
{
void *res;
pthread_rwlock_rdlock(&lock);
return ret;
}
-__attribute__((__visibility__("hidden")))
-void __dl_vseterr(const char *, va_list);
+hidden void __dl_vseterr(const char *, va_list);
static void error(const char *fmt, ...)
{
typedef Elf64_Phdr Phdr;
#endif
-__attribute__((__weak__, __visibility__("hidden")))
-extern const size_t _DYNAMIC[];
+extern weak hidden const size_t _DYNAMIC[];
static void static_init_tls(size_t *aux)
{
static void dummy(void) {}
weak_alias(dummy, _init);
-__attribute__((__weak__, __visibility__("hidden")))
-extern void (*const __init_array_start)(void), (*const __init_array_end)(void);
+extern weak hidden void (*const __init_array_start)(void), (*const __init_array_end)(void);
static void dummy1(void *p) {}
weak_alias(dummy1, __init_ssp);
a_crash();
}
-__attribute__((__visibility__("hidden")))
-void __stack_chk_fail_local(void);
+hidden void __stack_chk_fail_local(void);
weak_alias(__stack_chk_fail, __stack_chk_fail_local);
#include "libc.h"
#include "ksigaction.h"
-__attribute__((__visibility__("hidden")))
-volatile int __abort_lock[1];
+hidden volatile int __abort_lock[1];
_Noreturn void abort(void)
{
weak_alias(dummy, __stdio_exit);
weak_alias(dummy, _fini);
-__attribute__((__weak__, __visibility__("hidden")))
-extern void (*const __fini_array_start)(void), (*const __fini_array_end)(void);
+extern weak hidden void (*const __fini_array_start)(void), (*const __fini_array_end)(void);
static void libc_exit_fini(void)
{
#include <stdint.h>
+#include "libc.h"
-__attribute__((__visibility__("hidden")))
-void *__fdpic_fixup(void *map, uintptr_t *a, uintptr_t *z)
+hidden void *__fdpic_fixup(void *map, uintptr_t *a, uintptr_t *z)
{
/* If map is a null pointer, the program was loaded by a
* non-FDPIC-aware ELF loader, and fixups are not needed,
#define PAGE_SIZE libc.page_size
#endif
-#ifdef __PIC__
-#define ATTR_LIBC_VISIBILITY __attribute__((visibility("hidden")))
-#else
-#define ATTR_LIBC_VISIBILITY
-#endif
+#define weak __attribute__((__weak__))
+#define hidden __attribute__((__visibility__("hidden")))
-extern struct __libc __libc ATTR_LIBC_VISIBILITY;
+extern hidden struct __libc __libc;
#define libc __libc
-extern size_t __hwcap ATTR_LIBC_VISIBILITY;
-extern size_t __sysinfo ATTR_LIBC_VISIBILITY;
+extern hidden size_t __hwcap;
+extern hidden size_t __sysinfo;
extern char *__progname, *__progname_full;
/* Designed to avoid any overhead in non-threaded processes */
-void __lock(volatile int *) ATTR_LIBC_VISIBILITY;
-void __unlock(volatile int *) ATTR_LIBC_VISIBILITY;
-int __lockfile(FILE *) ATTR_LIBC_VISIBILITY;
-void __unlockfile(FILE *) ATTR_LIBC_VISIBILITY;
+hidden void __lock(volatile int *);
+hidden void __unlock(volatile int *);
+hidden int __lockfile(FILE *);
+hidden void __unlockfile(FILE *);
#define LOCK(x) __lock(x)
#define UNLOCK(x) __unlock(x)
#undef weak_alias
#define weak_alias(old, new) \
- extern __typeof(old) new __attribute__((weak, alias(#old)))
+ extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
#undef LFS64_2
#define LFS64_2(x, y) weak_alias(x, y)
#ifndef MALLOC_IMPL_H
#define MALLOC_IMPL_H
+#include "libc.h"
+
void *__mmap(void *, size_t, int, int, int, off_t);
int __munmap(void *, size_t);
void *__mremap(void *, size_t, size_t, int, ...);
#define IS_MMAPPED(c) !((c)->csize & (C_INUSE))
-__attribute__((__visibility__("hidden")))
-void __bin_chunk(struct chunk *);
+hidden void __bin_chunk(struct chunk *);
-__attribute__((__visibility__("hidden")))
-extern int __malloc_replaced;
+hidden extern int __malloc_replaced;
#endif
-__attribute__((__visibility__("hidden")))
-int __shcall(void *arg, int (*func)(void *))
+#include "libc.h"
+
+hidden int __shcall(void *arg, int (*func)(void *))
{
return func(arg);
}
#define _INTERNAL_SYSCALL_H
#include <sys/syscall.h>
+#include "libc.h"
#include "syscall_arch.h"
#ifndef SYSCALL_RLIM_INFINITY
typedef long syscall_arg_t;
#endif
-__attribute__((visibility("hidden")))
-long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
+hidden long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
__syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t,
syscall_arg_t, syscall_arg_t, syscall_arg_t);
#include "version.h"
+#include "libc.h"
static const char version[] = VERSION;
-__attribute__((__visibility__("hidden")))
-const char *__libc_get_version()
+hidden const char *__libc_get_version()
{
return version;
}
#include <dlfcn.h>
#include "libc.h"
-__attribute__((__visibility__("hidden")))
-void __dl_seterr(const char *, ...);
+hidden void __dl_seterr(const char *, ...);
static void *stub_dlsym(void *restrict p, const char *restrict s, void *restrict ra)
{
#define AUX_CNT 38
-__attribute__((__weak__, __visibility__("hidden")))
-extern const size_t _DYNAMIC[];
+extern weak hidden const size_t _DYNAMIC[];
static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void *data), void *data)
{
#include <dlfcn.h>
+#include "libc.h"
-__attribute__((__visibility__("hidden")))
-int __dl_invalid_handle(void *);
+hidden int __dl_invalid_handle(void *);
int dlclose(void *p)
{
free(self->dlerror_buf);
}
-__attribute__((__visibility__("hidden")))
-void __dl_vseterr(const char *fmt, va_list ap)
+hidden void __dl_vseterr(const char *fmt, va_list ap)
{
va_list ap2;
va_copy(ap2, ap);
self->dlerror_flag = 1;
}
-__attribute__((__visibility__("hidden")))
-void __dl_seterr(const char *fmt, ...)
+hidden void __dl_seterr(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
va_end(ap);
}
-__attribute__((__visibility__("hidden")))
-int __dl_invalid_handle(void *);
+hidden int __dl_invalid_handle(void *);
static int stub_invalid_handle(void *h)
{
#define _GNU_SOURCE
#include <dlfcn.h>
+#include "libc.h"
-__attribute__((__visibility__("hidden")))
-int __dl_invalid_handle(void *);
+hidden int __dl_invalid_handle(void *);
-__attribute__((__visibility__("hidden")))
-void __dl_seterr(const char *, ...);
+hidden void __dl_seterr(const char *, ...);
int dlinfo(void *dso, int req, void *res)
{
#include <dlfcn.h>
#include "libc.h"
-__attribute__((__visibility__("hidden")))
-void __dl_seterr(const char *, ...);
+hidden void __dl_seterr(const char *, ...);
static void *stub_dlopen(const char *file, int mode)
{
#include <stddef.h>
#include "libc.h"
-__attribute__((__visibility__("hidden")))
-ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic();
+hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic();
ptrdiff_t __tlsdesc_static()
{
#define bittab __fsmu8
#include <stdint.h>
+#include "libc.h"
-#ifdef __PIC__
-__attribute__((__visibility__("hidden")))
-#endif
-extern const uint32_t bittab[];
+extern hidden const uint32_t bittab[];
/* Upper 6 state bits are a negative integer offset to bound-check next byte */
/* equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f */
volatile int dummy_lock[1] = { 0 };
-__attribute__((__visibility__("hidden")))
+extern hidden volatile int __abort_lock[1];
+
weak_alias(dummy_lock, __abort_lock);
static int unmask_done;
#include <setjmp.h>
#include <signal.h>
#include "syscall.h"
+#include "libc.h"
-__attribute__((__visibility__("hidden")))
-int __sigsetjmp_tail(sigjmp_buf jb, int ret)
+hidden int __sigsetjmp_tail(sigjmp_buf jb, int ret)
{
void *p = jb->__ss;
__syscall(SYS_rt_sigprocmask, SIG_SETMASK, ret?p:0, ret?0:p, _NSIG/8);
#include "pthread_impl.h"
#include "syscall.h"
+#include "libc.h"
-__attribute__((__visibility__("hidden")))
-long __syscall_cp_c();
+hidden long __syscall_cp_c();
static long sccp(syscall_arg_t nr,
syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
#include "pthread_impl.h"
#include "libc.h"
-__attribute__((__visibility__("hidden")))
-void *__tls_get_new(tls_mod_off_t *);
+hidden void *__tls_get_new(tls_mod_off_t *);
void *__tls_get_addr(tls_mod_off_t *v)
{
#define HWCAP_TLS (1 << 15)
-extern const unsigned char __attribute__((__visibility__("hidden")))
+extern hidden const unsigned char
__a_barrier_oldkuser[], __a_barrier_v6[], __a_barrier_v7[],
__a_cas_v6[], __a_cas_v7[],
__a_gettp_cp15[];
#define __a_gettp_kuser 0xffff0fe0
#define __a_gettp_cp15 (uintptr_t)__a_gettp_cp15
-extern uintptr_t __attribute__((__visibility__("hidden")))
- __a_barrier_ptr, __a_cas_ptr, __a_gettp_ptr;
+extern hidden uintptr_t __a_barrier_ptr, __a_cas_ptr, __a_gettp_ptr;
int __set_thread_area(void *p)
{
#include "pthread_impl.h"
#include "syscall.h"
+#include "libc.h"
-__attribute__((__visibility__("hidden")))
-void *__start_sched(void *p)
+hidden void *__start_sched(void *p)
{
struct start_sched_args *ssa = p;
void *start_arg = ssa->start_arg;
#include "syscall.h"
#include "libc.h"
-__attribute__((__visibility__("hidden")))
-long __cancel(), __syscall_cp_asm(), __syscall_cp_c();
+hidden long __cancel(), __syscall_cp_asm(), __syscall_cp_c();
long __cancel()
{
set->__bits[s/8/sizeof *set->__bits] |= 1UL<<(s&8*sizeof *set->__bits-1);
}
-__attribute__((__visibility__("hidden")))
-extern const char __cp_begin[1], __cp_end[1], __cp_cancel[1];
+extern hidden const char __cp_begin[1], __cp_end[1], __cp_cancel[1];
static void cancel_handler(int sig, siginfo_t *si, void *ctx)
{
#define CPU_HAS_LLSC 0x0040
#define CPU_HAS_CAS_L 0x0400
-__attribute__((__visibility__("hidden")))
-extern const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[];
+extern hidden const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[];
-__attribute__((__visibility__("hidden")))
-const void *__sh_cas_ptr;
+hidden const void *__sh_cas_ptr;
-__attribute__((__visibility__("hidden")))
-unsigned __sh_nommu;
+hidden unsigned __sh_nommu;
int __set_thread_area(void *p)
{
: : "r"(pc), "r"(sp) : "r0", "memory" )
#include "../__unmapself.c"
#undef __unmapself
-extern __attribute__((__visibility__("hidden"))) unsigned __sh_nommu;
+extern hidden unsigned __sh_nommu;
#else
#define __sh_nommu 0
#endif
#include <sys/syscall.h>
+#include "libc.h"
-__attribute__((__visibility__("hidden")))
-long __syscall_cp_internal(volatile void*, long long, long long, long long, long long,
- long long, long long, long long);
+hidden long __syscall_cp_internal(volatile void*, long long, long long,
+ long long, long long, long long,
+ long long, long long);
struct __timespec { long long tv_sec; long tv_nsec; };
struct __timespec_kernel { long long tv_sec; long long tv_nsec; };
ts->tv_nsec = __tsc(X)->tv_nsec; \
(X) = (unsigned long)ts; } } while(0)
-__attribute__((__visibility__("hidden")))
-long __syscall_cp_asm (volatile void * foo, long long n, long long a1, long long a2, long long a3,
- long long a4, long long a5, long long a6)
+hidden long __syscall_cp_asm (volatile void * foo, long long n, long long a1,
+ long long a2, long long a3, long long a4,
+ long long a5, long long a6)
{
struct __timespec_kernel ts[1];
switch (n) {