Skip to content

Commit b7ed07a

Browse files
Bernhard M. Wiedemannjohn-sharratt
Bernhard M. Wiedemann
authored andcommittedMar 5, 2023
Sort lists of input files (WebAssembly#313)
For reproducible .a files in spite of non-deterministic filesystem readdir order Without this patch, find returned files in filesystem order and llvm-ar used that order to create .a files.
1 parent 845313d commit b7ed07a

File tree

3 files changed

+7
-34
lines changed

3 files changed

+7
-34
lines changed
 

‎Makefile

+7-6
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ LIBC_BOTTOM_HALF_HEADERS_PUBLIC = $(LIBC_BOTTOM_HALF_DIR)/headers/public
5151
LIBC_BOTTOM_HALF_HEADERS_PRIVATE = $(LIBC_BOTTOM_HALF_DIR)/headers/private
5252
LIBC_BOTTOM_HALF_SOURCES = $(LIBC_BOTTOM_HALF_DIR)/sources
5353
LIBC_BOTTOM_HALF_ALL_SOURCES = \
54+
$(sort \
5455
$(shell find $(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC) -name \*.c) \
55-
$(shell find $(LIBC_BOTTOM_HALF_SOURCES) -name \*.c)
56+
$(shell find $(LIBC_BOTTOM_HALF_SOURCES) -name \*.c))
5657

5758
# FIXME(https://reviews.llvm.org/D85567) - due to a bug in LLD the weak
5859
# references to a function defined in `chdir.c` only work if `chdir.c` is at the
@@ -62,13 +63,13 @@ LIBC_BOTTOM_HALF_ALL_SOURCES := $(filter-out $(LIBC_BOTTOM_HALF_SOURCES)/chdir.c
6263
LIBC_BOTTOM_HALF_ALL_SOURCES := $(LIBC_BOTTOM_HALF_ALL_SOURCES) $(LIBC_BOTTOM_HALF_SOURCES)/chdir.c
6364

6465
LIBWASI_EMULATED_MMAN_SOURCES = \
65-
$(shell find $(LIBC_BOTTOM_HALF_DIR)/mman -name \*.c)
66+
$(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/mman -name \*.c))
6667
LIBWASI_EMULATED_PROCESS_CLOCKS_SOURCES = \
67-
$(shell find $(LIBC_BOTTOM_HALF_DIR)/clocks -name \*.c)
68+
$(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/clocks -name \*.c))
6869
LIBWASI_EMULATED_GETPID_SOURCES = \
69-
$(shell find $(LIBC_BOTTOM_HALF_DIR)/getpid -name \*.c)
70+
$(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/getpid -name \*.c))
7071
LIBWASI_EMULATED_SIGNAL_SOURCES = \
71-
$(shell find $(LIBC_BOTTOM_HALF_DIR)/signal -name \*.c)
72+
$(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/signal -name \*.c))
7273
LIBC_BOTTOM_HALF_CRT_SOURCES = $(wildcard $(LIBC_BOTTOM_HALF_DIR)/crt/*.c)
7374
LIBC_TOP_HALF_DIR = $(CURDIR)/libc-top-half
7475
LIBC_TOP_HALF_MUSL_DIR = $(LIBC_TOP_HALF_DIR)/musl
@@ -226,7 +227,7 @@ LIBC_TOP_HALF_HEADERS_PRIVATE = $(LIBC_TOP_HALF_DIR)/headers/private
226227
LIBC_TOP_HALF_SOURCES = $(LIBC_TOP_HALF_DIR)/sources
227228
LIBC_TOP_HALF_ALL_SOURCES = \
228229
$(LIBC_TOP_HALF_MUSL_SOURCES) \
229-
$(shell find $(LIBC_TOP_HALF_SOURCES) -name \*.c)
230+
$(sort $(shell find $(LIBC_TOP_HALF_SOURCES) -name \*.c))
230231

231232
# Add any extra flags
232233
CFLAGS = $(EXTRA_CFLAGS)

‎expected/wasm32-wasi/defined-symbols.txt

-14
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ __fsmu8
9696
__ftello
9797
__ftello_unlocked
9898
__funcs_on_exit
99-
__funcs_on_exit
100-
__funcs_on_quick_exit
10199
__funcs_on_quick_exit
102100
__futimesat
103101
__fwritable
@@ -164,7 +162,6 @@ __isxdigit_l
164162
__lctrans
165163
__lctrans_cur
166164
__lctrans_impl
167-
__lctrans_impl
168165
__ldexp_cexp
169166
__ldexp_cexpf
170167
__ldso_atfork
@@ -292,23 +289,17 @@ __stack_chk_fail_local
292289
__stack_chk_guard
293290
__stderr_FILE
294291
__stderr_used
295-
__stderr_used
296-
__stderr_used
297292
__stdin_FILE
298293
__stdin_used
299-
__stdin_used
300294
__stdio_close
301295
__stdio_exit
302-
__stdio_exit
303296
__stdio_exit_needed
304297
__stdio_ofl_lockptr
305298
__stdio_read
306299
__stdio_seek
307300
__stdio_write
308301
__stdout_FILE
309302
__stdout_used
310-
__stdout_used
311-
__stdout_used
312303
__stdout_write
313304
__stpcpy
314305
__stpncpy
@@ -503,7 +494,6 @@ __wasilibc_deinitialize_environ
503494
__wasilibc_dttoif
504495
__wasilibc_ensure_environ
505496
__wasilibc_environ
506-
__wasilibc_environ
507497
__wasilibc_environ_init
508498
__wasilibc_fd_renumber
509499
__wasilibc_find_abspath
@@ -521,7 +511,6 @@ __wasilibc_link_newat
521511
__wasilibc_link_oldat
522512
__wasilibc_longjmp
523513
__wasilibc_maybe_reinitialize_environ_eagerly
524-
__wasilibc_maybe_reinitialize_environ_eagerly
525514
__wasilibc_nocwd___wasilibc_rmdirat
526515
__wasilibc_nocwd___wasilibc_unlinkat
527516
__wasilibc_nocwd_faccessat
@@ -569,7 +558,6 @@ _initialize
569558
_pthread_cleanup_pop
570559
_pthread_cleanup_push
571560
_start
572-
_start
573561
a64l
574562
abort
575563
abs
@@ -967,7 +955,6 @@ getrandom
967955
getrlimit
968956
getrlimit64
969957
getrusage
970-
getrusage
971958
getsid
972959
getsockname
973960
getsockopt
@@ -977,7 +964,6 @@ getspnam_r
977964
getsubopt
978965
gettext
979966
gettimeofday
980-
gettimeofday
981967
getuid
982968
getw
983969
getwc

‎expected/wasm64-wasi/defined-symbols.txt

-14
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ __fsmu8
9696
__ftello
9797
__ftello_unlocked
9898
__funcs_on_exit
99-
__funcs_on_exit
100-
__funcs_on_quick_exit
10199
__funcs_on_quick_exit
102100
__futimesat
103101
__fwritable
@@ -164,7 +162,6 @@ __isxdigit_l
164162
__lctrans
165163
__lctrans_cur
166164
__lctrans_impl
167-
__lctrans_impl
168165
__ldexp_cexp
169166
__ldexp_cexpf
170167
__ldso_atfork
@@ -292,23 +289,17 @@ __stack_chk_fail_local
292289
__stack_chk_guard
293290
__stderr_FILE
294291
__stderr_used
295-
__stderr_used
296-
__stderr_used
297292
__stdin_FILE
298293
__stdin_used
299-
__stdin_used
300294
__stdio_close
301295
__stdio_exit
302-
__stdio_exit
303296
__stdio_exit_needed
304297
__stdio_ofl_lockptr
305298
__stdio_read
306299
__stdio_seek
307300
__stdio_write
308301
__stdout_FILE
309302
__stdout_used
310-
__stdout_used
311-
__stdout_used
312303
__stdout_write
313304
__stpcpy
314305
__stpncpy
@@ -503,7 +494,6 @@ __wasilibc_deinitialize_environ
503494
__wasilibc_dttoif
504495
__wasilibc_ensure_environ
505496
__wasilibc_environ
506-
__wasilibc_environ
507497
__wasilibc_environ_init
508498
__wasilibc_fd_renumber
509499
__wasilibc_find_abspath
@@ -521,7 +511,6 @@ __wasilibc_link_newat
521511
__wasilibc_link_oldat
522512
__wasilibc_longjmp
523513
__wasilibc_maybe_reinitialize_environ_eagerly
524-
__wasilibc_maybe_reinitialize_environ_eagerly
525514
__wasilibc_nocwd___wasilibc_rmdirat
526515
__wasilibc_nocwd___wasilibc_unlinkat
527516
__wasilibc_nocwd_faccessat
@@ -569,7 +558,6 @@ _initialize
569558
_pthread_cleanup_pop
570559
_pthread_cleanup_push
571560
_start
572-
_start
573561
a64l
574562
abort
575563
abs
@@ -967,7 +955,6 @@ getrandom
967955
getrlimit
968956
getrlimit64
969957
getrusage
970-
getrusage
971958
getsid
972959
getsockname
973960
getsockopt
@@ -977,7 +964,6 @@ getspnam_r
977964
getsubopt
978965
gettext
979966
gettimeofday
980-
gettimeofday
981967
getuid
982968
getw
983969
getwc

0 commit comments

Comments
 (0)
Please sign in to comment.