Remove hardcoded -O2
Use default ar
Don't use LTO
Remove warning clang doesn't understand
Remove -ldl

Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -28,13 +28,14 @@ endif
 # Windows cross compilation from Linux
 #CONFIG_WIN32=y
 # use link time optimization (smaller and faster executables but slower build)
-CONFIG_LTO=y
+#CONFIG_LTO=y
 # consider warnings as errors (for development)
 #CONFIG_WERROR=y
 # force 32 bit build for some utilities
 #CONFIG_M32=y
 # cosmopolitan build (see https://github.com/jart/cosmopolitan)
 #CONFIG_COSMO=y
+CONFIG_DEFAULT_AR=y
 
 # installation directory
 PREFIX?=/usr/local
@@ -98,8 +99,8 @@ else ifdef CONFIG_COSMO
 else
   HOST_CC=gcc
   CC=$(CROSS_PREFIX)gcc
-  CFLAGS+=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
-  CFLAGS += -Wno-array-bounds -Wno-format-truncation
+  CFLAGS+=-Wall -MMD -MF $(OBJDIR)/$(@F).d
+  CFLAGS += -Wno-array-bounds
   ifdef CONFIG_LTO
     AR=$(CROSS_PREFIX)gcc-ar
   else
@@ -122,7 +123,7 @@ endif
 CFLAGS+=$(DEFINES)
 CFLAGS_DEBUG=$(CFLAGS) -O0
 CFLAGS_SMALL=$(CFLAGS) -Os
-CFLAGS_OPT=$(CFLAGS) -O2
+CFLAGS_OPT=$(CFLAGS)
 CFLAGS_NOLTO:=$(CFLAGS_OPT)
 ifdef CONFIG_COSMO
 LDFLAGS+=-s # better to strip by default
@@ -194,10 +195,10 @@ ifdef CONFIG_BIGNUM
 QJS_OBJS+=$(OBJDIR)/qjscalc.o
 endif
 
-HOST_LIBS=-lm -ldl -lpthread
+HOST_LIBS=-lm -lpthread
 LIBS=-lm
 ifndef CONFIG_WIN32
-LIBS+=-ldl -lpthread
+LIBS+=-lpthread
 endif
 LIBS+=$(EXTRA_LIBS)
 
