diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 401e671..a8770cc 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -100,8 +100,10 @@ CWARNFLAGS += -Wno-unknown-pragmas .if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" CLANG_NO_IAS = -no-integrated-as -CLANG_OPT_SMALL = -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \ - -mllvm -enable-load-pre=false +CLANG_OPT_SMALL = -mllvm -stack-alignment=8 \ + -mllvm -inline-threshold=3 \ + -mllvm -enable-load-pre=false \ + -mllvm -simplifycfg-dup-ret .endif .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \ diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index 68e49ed..5cec4b5 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -26,6 +26,8 @@ CFLAGS= -Os \ -fno-guess-branch-probability \ -fomit-frame-pointer \ -fno-unit-at-a-time \ + -ffunction-sections \ + -fdata-sections \ -mno-align-long-strings \ -mrtd \ -mregparm=3 \ diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c index 8291249..37314f1 100644 --- a/sys/boot/i386/boot2/boot2.c +++ b/sys/boot/i386/boot2/boot2.c @@ -148,8 +148,8 @@ static int xputc(int); static int xgetc(int); static inline int getc(int); -static void memcpy(void *, const void *, int); -static void +static __noinline void memcpy(void *, const void *, int); +static __noinline void memcpy(void *dst, const void *src, int len) { const char *s = src; @@ -223,10 +223,7 @@ main(void) { uint8_t autoboot; ino_t ino; - size_t nbyte; - opts = 0; - kname = NULL; dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); v86.ctl = V86_FLAGS; v86.efl = PSL_RESERVED_DEFAULT | PSL_I; @@ -242,10 +239,8 @@ main(void) autoboot = 1; if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) { - nbyte = fsread(ino, cmd, sizeof(cmd) - 1); - cmd[nbyte] = '\0'; - } + (ino = lookup(PATH_DOTCONFIG))) + fsread(ino, cmd, sizeof(cmd) - 1); if (*cmd) { memcpy(cmddup, cmd, sizeof(cmd));