Skip to content

Commit

Permalink
Exclude atexit.c from LTO
Browse files Browse the repository at this point in the history
This fixes a failure in wasi-sdk "make check".
("undefined symbol: __cxa_atexit" for ctors_dtors.c test)
  • Loading branch information
yamt committed Jun 7, 2024
1 parent fbdc350 commit 062f80e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ LIBC_TOP_HALF_MUSL_SOURCES = \
$(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/complex/*.c)) \
$(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/crypt/*.c)

LIBC_NONLTO_SOURCES = \
$(addprefix $(LIBC_TOP_HALF_MUSL_SRC_DIR)/, \
exit/atexit.c \
)

ifeq ($(WASI_SNAPSHOT), p2)
LIBC_TOP_HALF_MUSL_SOURCES += \
$(addprefix $(LIBC_TOP_HALF_MUSL_SRC_DIR)/, \
Expand Down Expand Up @@ -474,6 +479,7 @@ LIBWASI_EMULATED_SIGNAL_MUSL_OBJS = $(call objs,$(LIBWASI_EMULATED_SIGNAL_MUSL_S
LIBDL_OBJS = $(call objs,$(LIBDL_SOURCES))
LIBSETJMP_OBJS = $(call objs,$(LIBSETJMP_SOURCES))
LIBC_BOTTOM_HALF_CRT_OBJS = $(call objs,$(LIBC_BOTTOM_HALF_CRT_SOURCES))
LIBC_NONLTO_OBJS = $(call objs,$(LIBC_NONLTO_SOURCES))

# These variables describe the locations of various files and
# directories in the generated sysroot tree.
Expand Down Expand Up @@ -652,6 +658,8 @@ $(SYSROOT_LIB)/libsetjmp.a: $(LIBSETJMP_OBJS)

$(PIC_OBJS): CFLAGS += -fPIC -fvisibility=default

$(LIBC_NONLTO_OBJS): CFLAGS += -fno-lto

$(MUSL_PRINTSCAN_OBJS): CFLAGS += \
-D__wasilibc_printscan_no_long_double \
-D__wasilibc_printscan_full_support_option="\"add -lc-printscan-long-double to the link command\""
Expand Down

0 comments on commit 062f80e

Please sign in to comment.