make more portable
shawnl opened this issue · comments
mesh uses many symbols from glibc, and I didn't manage to build it against musl either. I was interested in investigating using it as an allocator for zig, which does not use libc (and implements its own, as llvm does require some libc symbols).
shawn@shawn-ThinkPad-L420:~/git/mesh$ readelf --dyn-syms libmesh.so | grep GLIBC
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strtof_l@GLIBC_2.2.5 (2)
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mprotect@GLIBC_2.2.5 (2)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fileno@GLIBC_2.2.5 (2)
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strcoll_l@GLIBC_2.2.5 (2)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __nl_langinfo_l@GLIBC_2.2.5 (2)
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dgettext@GLIBC_2.2.5 (2)
9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fseeko64@GLIBC_2.2.5 (2)
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemcpy@GLIBC_2.2.5 (2)
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memset@GLIBC_2.2.5 (2)
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbrtowc@GLIBC_2.2.5 (2)
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND signalfd@GLIBC_2.7 (3)
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcslen@GLIBC_2.2.5 (2)
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND close@GLIBC_2.2.5 (4)
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __duplocale@GLIBC_2.2.5 (2)
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ioctl@GLIBC_2.2.5 (2)
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.2.5 (2)
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memchr@GLIBC_2.2.5 (2)
20: 0000000000000000 0 FUNC GLOBAL DEFAULT UND clock_gettime@GLIBC_2.17 (5)
22: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __printf_chk@GLIBC_2.3.4 (6)
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bindtextdomain@GLIBC_2.2.5 (2)
24: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemcmp@GLIBC_2.2.5 (2)
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strftime_l@GLIBC_2.3 (7)
26: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setvbuf@GLIBC_2.2.5 (2)
27: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __register_atfork@GLIBC_2.3.2 (8)
28: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strxfrm_l@GLIBC_2.2.5 (2)
30: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbsnrtowcs@GLIBC_2.2.5 (2)
31: 0000000000000000 0 FUNC GLOBAL DEFAULT UND read@GLIBC_2.2.5 (4)
32: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fopen@GLIBC_2.2.5 (2)
33: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND __free_hook@GLIBC_2.2.5 (2)
34: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gettext@GLIBC_2.2.5 (2)
35: 0000000000000000 0 FUNC GLOBAL DEFAULT UND unlink@GLIBC_2.2.5 (2)
36: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND __malloc_hook@GLIBC_2.2.5 (2)
37: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rmdir@GLIBC_2.2.5 (2)
38: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtold_l@GLIBC_2.3 (7)
39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sched_yield@GLIBC_2.2.5 (2)
40: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ungetwc@GLIBC_2.2.5 (2)
41: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wctype_l@GLIBC_2.2.5 (2)
42: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (2)
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpid@GLIBC_2.2.5 (2)
44: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_init@GLIBC_2.2.5 (4)
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __vsnprintf_chk@GLIBC_2.3.4 (6)
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __towupper_l@GLIBC_2.2.5 (2)
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wcsxfrm_l@GLIBC_2.2.5 (2)
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __fxstat64@GLIBC_2.2.5 (2)
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND iconv_open@GLIBC_2.2.5 (2)
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strnlen@GLIBC_2.2.5 (2)
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ungetc@GLIBC_2.2.5 (2)
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wcscoll_l@GLIBC_2.2.5 (2)
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputc@GLIBC_2.2.5 (2)
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5 (2)
58: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemchr@GLIBC_2.2.5 (2)
59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_get_mb_cur_max@GLIBC_2.2.5 (2)
60: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2)
61: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wctob@GLIBC_2.2.5 (2)
62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wcsftime_l@GLIBC_2.3 (7)
63: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __iswctype_l@GLIBC_2.2.5 (2)
64: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __tls_get_addr@GLIBC_2.3 (9)
65: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stdin@GLIBC_2.2.5 (2)
66: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fdopen@GLIBC_2.2.5 (2)
67: 0000000000000000 0 FUNC GLOBAL DEFAULT UND syscall@GLIBC_2.2.5 (2)
68: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pipe@GLIBC_2.2.5 (2)
69: 0000000000000000 0 FUNC GLOBAL DEFAULT UND iconv@GLIBC_2.2.5 (2)
71: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __newlocale@GLIBC_2.2.5 (2)
72: 0000000000000000 0 FUNC GLOBAL DEFAULT UND poll@GLIBC_2.2.5 (2)
73: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strerror@GLIBC_2.2.5 (2)
74: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strstr@GLIBC_2.2.5 (2)
75: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputs@GLIBC_2.2.5 (2)
76: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lseek@GLIBC_2.2.5 (4)
77: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtol@GLIBC_2.2.5 (2)
78: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbsrtowcs@GLIBC_2.2.5 (2)
79: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcrtomb@GLIBC_2.2.5 (2)
80: 0000000000000000 0 FUNC GLOBAL DEFAULT UND putwc@GLIBC_2.2.5 (2)
81: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND __realloc_hook@GLIBC_2.2.5 (2)
82: 0000000000000000 0 FUNC GLOBAL DEFAULT UND raise@GLIBC_2.2.5 (4)
83: 0000000000000000 0 FUNC GLOBAL DEFAULT UND putc@GLIBC_2.2.5 (2)
84: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _Exit@GLIBC_2.2.5 (2)
85: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memmove@GLIBC_2.2.5 (2)
86: 0000000000000000 0 FUNC GLOBAL DEFAULT UND vsnprintf@GLIBC_2.2.5 (2)
87: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fread@GLIBC_2.2.5 (2)
88: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemmove@GLIBC_2.2.5 (2)
89: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __fxstat@GLIBC_2.2.5 (2)
90: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getenv@GLIBC_2.2.5 (2)
91: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sendfile@GLIBC_2.2.5 (2)
93: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dl_iterate_phdr@GLIBC_2.2.5 (2)
94: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __errno_location@GLIBC_2.2.5 (4)
95: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND __memalign_hook@GLIBC_2.2.5 (2)
96: 0000000000000000 0 FUNC GLOBAL DEFAULT UND madvise@GLIBC_2.2.5 (2)
97: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strdup@GLIBC_2.2.5 (2)
98: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mkstemp@GLIBC_2.2.5 (2)
99: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigaddset@GLIBC_2.2.5 (2)
100: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __uselocale@GLIBC_2.3 (7)
101: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@GLIBC_2.4 (10)
102: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcmp@GLIBC_2.2.5 (2)
103: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strtod_l@GLIBC_2.2.5 (2)
104: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcpy@GLIBC_2.2.5 (2)
105: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getwc@GLIBC_2.2.5 (2)
106: 0000000000000000 0 FUNC WEAK DEFAULT UND pthread_once@GLIBC_2.2.5 (4)
107: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcmp@GLIBC_2.2.5 (2)
108: 0000000000000000 0 FUNC GLOBAL DEFAULT UND munmap@GLIBC_2.2.5 (2)
109: 0000000000000000 0 FUNC GLOBAL DEFAULT UND writev@GLIBC_2.2.5 (2)
110: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fclose@GLIBC_2.2.5 (2)
111: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strncpy@GLIBC_2.2.5 (2)
112: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lseek64@GLIBC_2.2.5 (4)
113: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dlsym@GLIBC_2.2.5 (11)
114: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_current_sigrtmin@GLIBC_2.2.5 (4)
115: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __freelocale@GLIBC_2.2.5 (2)
116: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bind_textdomain_codeset@GLIBC_2.2.5 (2)
117: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcsnrtombs@GLIBC_2.2.5 (2)
118: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __sprintf_chk@GLIBC_2.3.4 (6)
119: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fallocate@GLIBC_2.10 (12)
120: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stderr@GLIBC_2.2.5 (2)
121: 0000000000000000 0 FUNC GLOBAL DEFAULT UND btowc@GLIBC_2.2.5 (2)
122: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ftruncate@GLIBC_2.2.5 (2)
123: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __snprintf_chk@GLIBC_2.3.4 (6)
124: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigemptyset@GLIBC_2.2.5 (2)
125: 0000000000000000 0 FUNC WEAK DEFAULT UND __pthread_key_create@GLIBC_2.2.5 (4)
126: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fopen64@GLIBC_2.2.5 (2)
127: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtoll@GLIBC_2.2.5 (2)
128: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcscmp@GLIBC_2.2.5 (2)
129: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fwrite@GLIBC_2.2.5 (2)
130: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_lock@GLIBC_2.2.5 (4)
132: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setlocale@GLIBC_2.2.5 (2)
133: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_destroy@GLIBC_2.2.5 (4)
134: 0000000000000000 0 FUNC GLOBAL DEFAULT UND write@GLIBC_2.2.5 (4)
135: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ftello64@GLIBC_2.2.5 (2)
136: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtoul@GLIBC_2.2.5 (2)
137: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_unlock@GLIBC_2.2.5 (4)
138: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.14 (13)
139: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fcntl@GLIBC_2.2.5 (2)
140: 0000000000000000 0 FUNC GLOBAL DEFAULT UND open@GLIBC_2.2.5 (4)
141: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mmap@GLIBC_2.2.5 (2)
142: 0000000000000000 0 FUNC GLOBAL DEFAULT UND iconv_close@GLIBC_2.2.5 (2)
143: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __towlower_l@GLIBC_2.2.5 (2)
144: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stdout@GLIBC_2.2.5 (2)
145: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mkdir@GLIBC_2.2.5 (2)
146: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemset@GLIBC_2.2.5 (2)
147: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fflush@GLIBC_2.2.5 (2)
148: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getc@GLIBC_2.2.5 (2)
You are also monkey-patching epoll_wait and stuff. Maybe there should be a "light" version that only provides malloc, realloc, calloc and free, along with a sized free and a few mesh_* functions.
most of those are pulled in indirectly. let me see what I can do. very open to a light version.
its not much shorter yet, but our full list of symbols is now:
$ readelf --dyn-syms libmesh.so
Symbol table '.dynsym' contains 167 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
4: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND unlink@GLIBC_2.2.5 (2)
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fcntl@GLIBC_2.2.5 (2)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND write@GLIBC_2.2.5 (3)
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpid@GLIBC_2.2.5 (2)
9: 0000000000000000 0 FUNC WEAK DEFAULT UND pthread_once@GLIBC_2.2.5 (3)
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5 (2)
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@GLIBC_2.4 (4)
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __register_atfork@GLIBC_2.3.2 (5)
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND read@GLIBC_2.2.5 (3)
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigemptyset@GLIBC_2.2.5 (2)
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.14 (6)
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_unlock@GLIBC_2.2.5 (3)
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND open@GLIBC_2.2.5 (3)
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_lock@GLIBC_2.2.5 (3)
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND clock_gettime@GLIBC_2.2.5 (7)
20: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (2)
21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND syscall@GLIBC_2.2.5 (2)
22: 0000000000000000 0 FUNC WEAK DEFAULT UND __pthread_key_create@GLIBC_2.2.5 (3)
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mmap@GLIBC_2.2.5 (2)
24: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_destroy@GLIBC_2.2.5 (3)
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.2.5 (2)
26: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_init@GLIBC_2.2.5 (3)
27: 0000000000000000 0 FUNC GLOBAL DEFAULT UND munmap@GLIBC_2.2.5 (2)
28: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcmp@GLIBC_2.2.5 (2)
29: 0000000000000000 0 FUNC GLOBAL DEFAULT UND close@GLIBC_2.2.5 (3)
30: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lseek@GLIBC_2.2.5 (3)
31: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __errno_location@GLIBC_2.2.5 (3)
32: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sendfile@GLIBC_2.2.5 (2)
33: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtoll@GLIBC_2.2.5 (2)
34: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strerror@GLIBC_2.2.5 (2)
35: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigaddset@GLIBC_2.2.5 (2)
36: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_current_sigrtmin@GLIBC_2.2.5 (3)
37: 0000000000000000 0 FUNC GLOBAL DEFAULT UND signalfd@GLIBC_2.7 (8)
38: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sched_yield@GLIBC_2.2.5 (2)
39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND raise@GLIBC_2.2.5 (3)
40: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _Exit@GLIBC_2.2.5 (2)
41: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strstr@GLIBC_2.2.5 (2)
42: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtol@GLIBC_2.2.5 (2)
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dlsym@GLIBC_2.2.5 (9)
44: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mkdir@GLIBC_2.2.5 (2)
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fallocate@GLIBC_2.10 (10)
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mprotect@GLIBC_2.2.5 (2)
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mkstemp@GLIBC_2.2.5 (2)
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ftruncate@GLIBC_2.2.5 (2)
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pipe@GLIBC_2.2.5 (2)
50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strcat_chk@GLIBC_2.3.4 (11)
51: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rmdir@GLIBC_2.2.5 (2)
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __fxstat@GLIBC_2.2.5 (2)
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND madvise@GLIBC_2.2.5 (2)
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND snprintf@GLIBC_2.2.5 (2)
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __vsnprintf_chk@GLIBC_2.3.4 (11)
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getenv@GLIBC_2.2.5 (2)
57: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strnlen@GLIBC_2.2.5 (2)
58: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputs@GLIBC_2.2.5 (2)
59: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memset@GLIBC_2.2.5 (2)
60: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memmove@GLIBC_2.2.5 (2)
61: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fwrite@GLIBC_2.2.5 (2)
62: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stderr@GLIBC_2.2.5 (2)
63: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcpy@GLIBC_2.2.5 (2)
64: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __tls_get_addr@GLIBC_2.3 (12)
65: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __sprintf_chk@GLIBC_2.3.4 (11)
66: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputc@GLIBC_2.2.5 (2)
67: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stdout@GLIBC_2.2.5 (2)
68: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stdin@GLIBC_2.2.5 (2)
69: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strtof_l@GLIBC_2.2.5 (2)
70: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strtod_l@GLIBC_2.2.5 (2)
71: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtold_l@GLIBC_2.3 (13)
72: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __newlocale@GLIBC_2.2.5 (2)
73: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __freelocale@GLIBC_2.2.5 (2)
74: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __duplocale@GLIBC_2.2.5 (2)
75: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strdup@GLIBC_2.2.5 (2)
76: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcmp@GLIBC_2.2.5 (2)
77: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __uselocale@GLIBC_2.3 (13)
78: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemchr@GLIBC_2.2.5 (2)
79: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcsnrtombs@GLIBC_2.2.5 (2)
80: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcrtomb@GLIBC_2.2.5 (2)
81: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memchr@GLIBC_2.2.5 (2)
82: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbsnrtowcs@GLIBC_2.2.5 (2)
83: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbrtowc@GLIBC_2.2.5 (2)
84: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __ctype_get_mb_cur_max@GLIBC_2.2.5 (2)
85: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __nl_langinfo_l@GLIBC_2.2.5 (2)
86: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcslen@GLIBC_2.2.5 (2)
87: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mbsrtowcs@GLIBC_2.2.5 (2)
88: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wcscmp@GLIBC_2.2.5 (2)
89: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wctype_l@GLIBC_2.2.5 (2)
90: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __towupper_l@GLIBC_2.2.5 (2)
91: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __towlower_l@GLIBC_2.2.5 (2)
92: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __iswctype_l@GLIBC_2.2.5 (2)
93: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wctob@GLIBC_2.2.5 (2)
94: 0000000000000000 0 FUNC GLOBAL DEFAULT UND btowc@GLIBC_2.2.5 (2)
95: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gettext@GLIBC_2.2.5 (2)
96: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemcpy@GLIBC_2.2.5 (2)
97: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemset@GLIBC_2.2.5 (2)
98: 0000000000000000 0 FUNC GLOBAL DEFAULT UND wmemmove@GLIBC_2.2.5 (2)
99: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strcoll_l@GLIBC_2.2.5 (2)
100: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strxfrm_l@GLIBC_2.2.5 (2)
101: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wcscoll_l@GLIBC_2.2.5 (2)
102: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wcsxfrm_l@GLIBC_2.2.5 (2)
103: 0000000000000000 0 FUNC GLOBAL DEFAULT UND vsnprintf@GLIBC_2.2.5 (2)
104: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strftime_l@GLIBC_2.3 (13)
105: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __wcsftime_l@GLIBC_2.3 (13)
106: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bind_textdomain_codeset@GLIBC_2.2.5 (2)
107: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dgettext@GLIBC_2.2.5 (2)
108: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getc@GLIBC_2.2.5 (2)
109: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ungetc@GLIBC_2.2.5 (2)
110: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fflush@GLIBC_2.2.5 (2)
111: 0000000000000000 0 FUNC GLOBAL DEFAULT UND putc@GLIBC_2.2.5 (2)
112: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fseeko64@GLIBC_2.2.5 (2)
113: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ftello64@GLIBC_2.2.5 (2)
114: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getwc@GLIBC_2.2.5 (2)
115: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ungetwc@GLIBC_2.2.5 (2)
116: 0000000000000000 0 FUNC GLOBAL DEFAULT UND putwc@GLIBC_2.2.5 (2)
117: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fread@GLIBC_2.2.5 (2)
118: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dl_iterate_phdr@GLIBC_2.2.5 (2)
119: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strncpy@GLIBC_2.2.5 (2)
120: 0000000000090440 347 FUNC GLOBAL DEFAULT 16 mesh_free
121: 00000000000918c0 54 FUNC GLOBAL DEFAULT 16 mesh_memalign
122: 0000000000093120 94 FUNC GLOBAL DEFAULT 16 mesh_posix_memalign
123: 0000000000093220 60 FUNC GLOBAL DEFAULT 16 mesh_strdup
124: 0000000000093380 266 FUNC GLOBAL DEFAULT 16 _Znwm
125: 0000000000093740 194 FUNC GLOBAL DEFAULT 16 _ZnwmRKSt9nothrow_t
126: 0000000000093840 266 FUNC GLOBAL DEFAULT 16 _Znam
127: 0000000000091ed0 515 FUNC GLOBAL DEFAULT 16 sigaction
128: 0000000000093180 69 FUNC GLOBAL DEFAULT 16 mesh_aligned_alloc
129: 0000000000093c80 61 FUNC GLOBAL DEFAULT 16 mesh_recalloc
130: 0000000000093180 69 FUNC WEAK DEFAULT 16 aligned_alloc
131: 00000000000902c0 175 FUNC WEAK DEFAULT 16 malloc
132: 00000000000931d0 80 FUNC GLOBAL DEFAULT 16 mesh_strndup
133: 00000000000918c0 54 FUNC WEAK DEFAULT 16 memalign
134: 00000000000935c0 366 FUNC GLOBAL DEFAULT 16 _ZdlPv
135: 00000000000932f0 6 FUNC GLOBAL DEFAULT 16 mesh_mallopt
136: 0000000000093300 3 FUNC GLOBAL DEFAULT 16 mesh_malloc_trim
137: 0000000000093a80 366 FUNC GLOBAL DEFAULT 16 _ZdaPv
138: 0000000000093110 5 FUNC WEAK DEFAULT 16 cfree
139: 0000000000091600 351 FUNC WEAK DEFAULT 16 malloc_usable_size
140: 0000000000092200 370 FUNC GLOBAL DEFAULT 16 pthread_create
141: 0000000000090840 1758 FUNC GLOBAL DEFAULT 16 mesh_realloc
142: 0000000000091600 351 FUNC GLOBAL DEFAULT 16 mesh_malloc_usable_size
143: 00000000000920e0 283 FUNC GLOBAL DEFAULT 16 sigprocmask
144: 0000000000093340 23 FUNC GLOBAL DEFAULT 16 mesh_mallinfo
145: 0000000000093980 194 FUNC GLOBAL DEFAULT 16 _ZnamRKSt9nothrow_t
146: 0000000000093c30 72 FUNC GLOBAL DEFAULT 16 mesh_pvalloc
147: 0000000000091d30 199 FUNC GLOBAL DEFAULT 16 xxmalloc_lock
148: 0000000000092e90 636 FUNC GLOBAL DEFAULT 16 epoll_pwait
149: 0000000000093110 5 FUNC GLOBAL DEFAULT 16 mesh_cfree
150: 0000000000091b00 286 FUNC WEAK DEFAULT 16 calloc
151: 0000000000092380 22 FUNC GLOBAL DEFAULT 16 pthread_exit
152: 00000000000923a0 2154 FUNC GLOBAL DEFAULT 16 mesh_mallctl
153: 0000000000093310 1 FUNC GLOBAL DEFAULT 16 mesh_malloc_stats
154: 00000000000906c0 347 FUNC GLOBAL DEFAULT 16 mesh_sized_free
155: 0000000000091e00 196 FUNC GLOBAL DEFAULT 16 xxmalloc_unlock
156: 0000000000093330 3 FUNC GLOBAL DEFAULT 16 mesh_malloc_set_state
157: 0000000000093120 94 FUNC WEAK DEFAULT 16 posix_memalign
158: 0000000000090440 347 FUNC WEAK DEFAULT 16 free
159: 00000000000902c0 175 FUNC GLOBAL DEFAULT 16 mesh_malloc
160: 0000000000091b00 286 FUNC GLOBAL DEFAULT 16 mesh_calloc
161: 0000000000093320 3 FUNC GLOBAL DEFAULT 16 mesh_malloc_get_state
162: 0000000000093bf0 58 FUNC GLOBAL DEFAULT 16 mesh_valloc
163: 0000000000091600 351 FUNC WEAK DEFAULT 16 mesh_usable_size
164: 0000000000090840 1758 FUNC WEAK DEFAULT 16 realloc
165: 0000000000092c10 628 FUNC GLOBAL DEFAULT 16 epoll_wait
166: 0000000000093260 131 FUNC GLOBAL DEFAULT 16 mesh_getcwd
most of the symbols we depend on are still included transitively through linking against static libstdc++. I'm not sure why -- I would have expected passing -flto
would remove a bunch of that, but will investigate more later.
once emeryberger/Heap-Layers#26 is merged into Heap-Layers, I'll update our dep, and Mesh should build under musl (I've been testing in a local alpine docker container).
We are pulling in a bunch of wide character support. Not of this should be necessary.
note that this commit (emeryberger/Heap-Layers#26) was merged.
a) I think we should build against musl at this point, and b) I've made a bit more progress in general. the symbols we now depend on are down to:
Symbol table '.dynsym' contains 117 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
4: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND unlink@GLIBC_2.2.5 (2)
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fcntl@GLIBC_2.2.5 (2)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND write@GLIBC_2.2.5 (3)
8: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getpid@GLIBC_2.2.5 (2)
9: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_once@GLIBC_2.2.5 (3)
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strlen@GLIBC_2.2.5 (2)
11: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail@GLIBC_2.4 (4)
12: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __register_atfork@GLIBC_2.3.2 (5)
13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND read@GLIBC_2.2.5 (3)
14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigemptyset@GLIBC_2.2.5 (2)
15: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.14 (6)
16: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_unlock@GLIBC_2.2.5 (3)
17: 0000000000000000 0 FUNC GLOBAL DEFAULT UND open@GLIBC_2.2.5 (3)
18: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_lock@GLIBC_2.2.5 (3)
19: 0000000000000000 0 FUNC GLOBAL DEFAULT UND syscall@GLIBC_2.2.5 (2)
20: 0000000000000000 0 FUNC WEAK DEFAULT UND __pthread_key_create@GLIBC_2.2.5 (3)
21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mmap@GLIBC_2.2.5 (2)
22: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_destroy@GLIBC_2.2.5 (3)
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.2.5 (2)
24: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pthread_mutex_init@GLIBC_2.2.5 (3)
25: 0000000000000000 0 FUNC GLOBAL DEFAULT UND munmap@GLIBC_2.2.5 (2)
26: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcmp@GLIBC_2.2.5 (2)
27: 0000000000000000 0 FUNC GLOBAL DEFAULT UND clock_gettime@GLIBC_2.17 (7)
28: 0000000000000000 0 FUNC GLOBAL DEFAULT UND close@GLIBC_2.2.5 (3)
29: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lseek@GLIBC_2.2.5 (3)
30: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __errno_location@GLIBC_2.2.5 (3)
31: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sendfile@GLIBC_2.2.5 (2)
32: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtoll@GLIBC_2.2.5 (2)
33: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strerror@GLIBC_2.2.5 (2)
34: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sigaddset@GLIBC_2.2.5 (2)
35: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_current_sigrtmin@GLIBC_2.2.5 (3)
36: 0000000000000000 0 FUNC GLOBAL DEFAULT UND signalfd@GLIBC_2.7 (8)
37: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sched_yield@GLIBC_2.2.5 (2)
38: 0000000000000000 0 FUNC GLOBAL DEFAULT UND raise@GLIBC_2.2.5 (3)
39: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _Exit@GLIBC_2.2.5 (2)
40: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strstr@GLIBC_2.2.5 (2)
41: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strtol@GLIBC_2.2.5 (2)
42: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dlsym@GLIBC_2.2.5 (9)
43: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mkdir@GLIBC_2.2.5 (2)
44: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fallocate@GLIBC_2.10 (10)
45: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mprotect@GLIBC_2.2.5 (2)
46: 0000000000000000 0 FUNC GLOBAL DEFAULT UND mkstemp@GLIBC_2.2.5 (2)
47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND ftruncate@GLIBC_2.2.5 (2)
48: 0000000000000000 0 FUNC GLOBAL DEFAULT UND pipe@GLIBC_2.2.5 (2)
49: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __strcat_chk@GLIBC_2.3.4 (11)
50: 0000000000000000 0 FUNC GLOBAL DEFAULT UND rmdir@GLIBC_2.2.5 (2)
51: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __fxstat@GLIBC_2.2.5 (2)
52: 0000000000000000 0 FUNC GLOBAL DEFAULT UND madvise@GLIBC_2.2.5 (2)
53: 0000000000000000 0 FUNC GLOBAL DEFAULT UND snprintf@GLIBC_2.2.5 (2)
54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __vsnprintf_chk@GLIBC_2.3.4 (11)
55: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getenv@GLIBC_2.2.5 (2)
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strnlen@GLIBC_2.2.5 (2)
57: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputs@GLIBC_2.2.5 (2)
58: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fwrite@GLIBC_2.2.5 (2)
59: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND stderr@GLIBC_2.2.5 (2)
60: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memset@GLIBC_2.2.5 (2)
61: 0000000000000000 0 FUNC GLOBAL DEFAULT UND sprintf@GLIBC_2.2.5 (2)
62: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcpy@GLIBC_2.2.5 (2)
63: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __tls_get_addr@GLIBC_2.3 (12)
64: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fputc@GLIBC_2.2.5 (2)
65: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gettext@GLIBC_2.2.5 (2)
66: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (2)
67: 0000000000000000 0 FUNC GLOBAL DEFAULT UND dl_iterate_phdr@GLIBC_2.2.5 (2)
68: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strncpy@GLIBC_2.2.5 (2)
69: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strcat@GLIBC_2.2.5 (2)
I'll note two things -- first, a bunch of these symbols are simply syscall wrappers (mprotect
, sendfile
, etc). The others are somewhat unfortunately pulled in transitively through libstdc++ (e.g. __gnu_cxx::__verbose_terminate_handler()
calls fputs
) which we statically link against. Similarly, using std::mutex
somewhat surprisingly pulls in std::string
to deal with fatal error messages, and I don't think there is an easy out here.
We could consider switching to our own wrappers around pthread_mutex*
or Google's absail, but neither are particularly small changes.
Hope this helps! let me know if you see any smaller/easier answers here!
one more note, verbose_terminate_handler
is also pulled in transitively from std::mutex
, afaict
https://github.com/daanx/mimalloc-bench is interested as well :)