Skip to content

Commit 79e859c

Browse files
authored
Don't include libc_rt files in libc as well (#6781)
1 parent 88f44af commit 79e859c

File tree

1 file changed

+44
-8
lines changed

1 file changed

+44
-8
lines changed

tools/system_libs.py

+44-8
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,49 @@ def build_libcxx(src_dirname, lib_filename, files, lib_opts, has_noexcept_versio
119119
# libc
120120
def create_libc(libname):
121121
logging.debug(' building libc for cache')
122-
libc_files = [
123-
]
122+
libc_files = []
124123
musl_srcdir = shared.path_from_root('system', 'lib', 'libc', 'musl', 'src')
125-
blacklist = set(
126-
['ipc', 'passwd', 'thread', 'signal', 'sched', 'ipc', 'time', 'linux', 'aio', 'exit', 'legacy', 'mq', 'process', 'search', 'setjmp', 'env', 'ldso', 'conf'] + # musl modules
127-
['memcpy.c', 'memset.c', 'memmove.c', 'getaddrinfo.c', 'getnameinfo.c', 'inet_addr.c', 'res_query.c', 'gai_strerror.c', 'proto.c', 'gethostbyaddr.c', 'gethostbyaddr_r.c', 'gethostbyname.c', 'gethostbyname2_r.c', 'gethostbyname_r.c', 'gethostbyname2.c', 'usleep.c', 'alarm.c', 'syscall.c', '_exit.c', 'popen.c'] + # individual files
128-
['abs.c', 'cos.c', 'cosf.c', 'cosl.c', 'sin.c', 'sinf.c', 'sinl.c', 'tan.c', 'tanf.c', 'tanl.c', 'acos.c', 'acosf.c', 'acosl.c', 'asin.c', 'asinf.c', 'asinl.c', 'atan.c', 'atanf.c', 'atanl.c', 'atan2.c', 'atan2f.c', 'atan2l.c', 'exp.c', 'expf.c', 'expl.c', 'log.c', 'logf.c', 'logl.c', 'sqrt.c', 'sqrtf.c', 'sqrtl.c', 'fabs.c', 'fabsf.c', 'fabsl.c', 'ceil.c', 'ceilf.c', 'ceill.c', 'floor.c', 'floorf.c', 'floorl.c', 'pow.c', 'powf.c', 'powl.c', 'round.c', 'roundf.c', 'rintf.c'] # individual math files
129-
)
124+
125+
# musl modules
126+
blacklist = [
127+
'ipc', 'passwd', 'thread', 'signal', 'sched', 'ipc', 'time', 'linux',
128+
'aio', 'exit', 'legacy', 'mq', 'process', 'search', 'setjmp', 'env',
129+
'ldso', 'conf'
130+
]
131+
132+
# individual files
133+
blacklist += [
134+
'memcpy.c', 'memset.c', 'memmove.c', 'getaddrinfo.c', 'getnameinfo.c',
135+
'inet_addr.c', 'res_query.c', 'gai_strerror.c', 'proto.c',
136+
'gethostbyaddr.c', 'gethostbyaddr_r.c', 'gethostbyname.c',
137+
'gethostbyname2_r.c', 'gethostbyname_r.c', 'gethostbyname2.c',
138+
'usleep.c', 'alarm.c', 'syscall.c', '_exit.c', 'popen.c'
139+
]
140+
141+
# individual math files
142+
blacklist += [
143+
'abs.c', 'cos.c', 'cosf.c', 'cosl.c', 'sin.c', 'sinf.c', 'sinl.c',
144+
'tan.c', 'tanf.c', 'tanl.c', 'acos.c', 'acosf.c', 'acosl.c', 'asin.c',
145+
'asinf.c', 'asinl.c', 'atan.c', 'atanf.c', 'atanl.c', 'atan2.c',
146+
'atan2f.c', 'atan2l.c', 'exp.c', 'expf.c', 'expl.c', 'log.c', 'logf.c',
147+
'logl.c', 'sqrt.c', 'sqrtf.c', 'sqrtl.c', 'fabs.c', 'fabsf.c',
148+
'fabsl.c', 'ceil.c', 'ceilf.c', 'ceill.c', 'floor.c', 'floorf.c',
149+
'floorl.c', 'pow.c', 'powf.c', 'powl.c', 'round.c', 'roundf.c',
150+
'rintf.c'
151+
]
152+
153+
if shared.Settings.WASM_BACKEND:
154+
# With the wasm backend these are included in wasm_libc_rt instead
155+
blacklist += [
156+
'fmin.c', 'fminf.c', 'fminl.c', 'fmax.c', 'fmaxf.c', 'fmaxl.c',
157+
'fmod.c', 'fmodf.c', 'fmodl.c', 'log2.c', 'log2f.c', 'log10.c',
158+
'log10f.c', 'exp2.c', 'exp2f.c', 'exp10.c', 'exp10f.c', 'scalbn.c',
159+
'__fpclassifyl.c'
160+
]
161+
162+
blacklist += ['memcpy.c', 'memset.c', 'memmove.c']
163+
164+
blacklist = set(blacklist)
130165
# TODO: consider using more math code from musl, doing so makes box2d faster
131166
for dirpath, dirnames, filenames in os.walk(musl_srcdir):
132167
for f in filenames:
@@ -141,6 +176,7 @@ def create_libc(libname):
141176
break
142177
if not cancel:
143178
libc_files.append(os.path.join(musl_srcdir, dirpath, f))
179+
144180
# Without -fno-builtin, LLVM can optimize away or convert calls to library
145181
# functions to something else based on assumptions that they behave exactly
146182
# like the standard library. This can cause unexpected bugs when we use our
@@ -428,7 +464,7 @@ def create_wasm_libc_rt(libname):
428464
'fmod.c', 'fmodf.c', 'fmodl.c',
429465
'log2.c', 'log2f.c', 'log10.c', 'log10f.c',
430466
'exp2.c', 'exp2f.c', 'exp10.c', 'exp10f.c',
431-
'scalbn.c',
467+
'scalbn.c', '__fpclassifyl.c'
432468
])
433469
string_files = files_in_path(
434470
path_components=['system', 'lib', 'libc', 'musl', 'src', 'string'],

0 commit comments

Comments
 (0)