From ff5d40392f371e5d7648aef49cd3ce3834e48611 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Wed, 21 Apr 2021 20:12:54 +0300 Subject: 13816 loader: BIOS build should not use -fPIC Reviewed by: Yuri Pankov Approved by: Dan McDonald --- usr/src/boot/Makefile.version | 2 +- usr/src/boot/lib/libstand/Makefile.inc | 122 +++++++++++++++++------ usr/src/boot/lib/libstand/crypto/Makefile.inc | 28 +++--- usr/src/boot/lib/libstand/zfs/Makefile.inc | 30 +++--- usr/src/boot/sys/boot/Makefile.inc | 8 +- usr/src/boot/sys/boot/Makefile.lib | 34 +++++++ usr/src/boot/sys/boot/efi/Makefile.inc | 2 +- usr/src/boot/sys/boot/efi/loader/Makefile.com | 43 ++++++-- usr/src/boot/sys/boot/efi/loader/Makefile.common | 30 ------ usr/src/boot/sys/boot/efi/loader/amd64/Makefile | 2 + usr/src/boot/sys/boot/efi/loader/i386/Makefile | 4 +- usr/src/boot/sys/boot/i386/libi386/Makefile | 27 ++--- usr/src/boot/sys/boot/libficl/Makefile.com | 28 ++---- usr/src/boot/sys/boot/libficl/amd64/Makefile | 5 +- usr/src/boot/sys/boot/libficl/i386/Makefile | 6 +- usr/src/boot/sys/boot/libstand/Makefile | 6 +- usr/src/boot/sys/boot/libstand/Makefile.com | 57 +++++------ usr/src/boot/sys/boot/libstand/amd64/Makefile | 22 ++-- usr/src/boot/sys/boot/libstand/i386/Makefile | 17 ++-- 19 files changed, 276 insertions(+), 197 deletions(-) create mode 100644 usr/src/boot/sys/boot/Makefile.lib delete mode 100644 usr/src/boot/sys/boot/efi/loader/Makefile.common (limited to 'usr/src/boot') diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 5f2a2b4676..1f4b347809 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -34,4 +34,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2021.06.15.1 +BOOT_VERSION = $(LOADER_VERSION)-2021.07.27.1 diff --git a/usr/src/boot/lib/libstand/Makefile.inc b/usr/src/boot/lib/libstand/Makefile.inc index 633005d142..2acb9ef490 100644 --- a/usr/src/boot/lib/libstand/Makefile.inc +++ b/usr/src/boot/lib/libstand/Makefile.inc @@ -21,25 +21,25 @@ # # standalone components and stuff we have modified locally -SRCS= $(ZLIB)/gzguts.h $(ZLIB)/zutil.h +SRCS += $(ZLIB)/gzguts.h $(ZLIB)/zutil.h SRCS += $(SASRC)/__main.c $(SASRC)/abort.c $(SASRC)/assert.c SRCS += $(SASRC)/bcd.c $(SASRC)/environment.c SRCS += $(SASRC)/getopt.c $(SASRC)/random.c SRCS += $(SASRC)/sbrk.c $(SASRC)/twiddle.c SRCS += $(SASRC)/zalloc.c $(SASRC)/zalloc_malloc.c -OBJS= __main.o abort.o assert.o bcd.o environment.o \ +OBJECTS += __main.o abort.o assert.o bcd.o environment.o \ getopt.o gets.o globals.o pager.o panic.o printf.o \ strdup.o strerror.o strtol.o strtoll.o strtoul.o strtoull.o random.o \ sbrk.o twiddle.o zalloc.o zalloc_malloc.o # private (pruned) versions of libc string functions SRCS += $(SASRC)/strcasecmp.c -OBJS += strcasecmp.o +OBJECTS += strcasecmp.o # from libc SRCS += $(LIBSRC)/libc/net/ntoh.c -OBJS += ntoh.o +OBJECTS += ntoh.o # string functions from libc SRCS += $(LIBSRC)/libc/string/bcmp.c $(LIBSRC)/libc/string/bcopy.c @@ -61,7 +61,7 @@ SRCS += $(LIBSRC)/libc/string/swab.c SRCS += $(SASRC)/qdivrem.c -OBJS += bcmp.o bcopy.o bzero.o ffs.o fls.o \ +OBJECTS += bcmp.o bcopy.o bzero.o ffs.o fls.o \ memccpy.o memchr.o memcmp.o memcpy.o memmove.o memset.o \ qdivrem.o strcat.o strchr.o strcmp.o strcpy.o stpcpy.o stpncpy.o \ strcspn.o strlcat.o strlcpy.o strlen.o strncat.o strncmp.o strncpy.o \ @@ -75,22 +75,57 @@ SRCS += $(LIBSRC)/libc/uuid/uuid_is_nil.c SRCS += $(SASRC)/uuid_from_string.c SRCS += $(SASRC)/uuid_to_string.c -OBJS += uuid_create_nil.o uuid_equal.o uuid_from_string.o uuid_is_nil.o \ +OBJECTS += uuid_create_nil.o uuid_equal.o uuid_from_string.o uuid_is_nil.o \ uuid_to_string.o # decompression functionality from libbz2 # NOTE: to actually test this functionality after libbz2 upgrade compile # loader(8) with LOADER_BZIP2_SUPPORT defined -_bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o bzipfs.o \ -:= CFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +objs/_bzlib.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +objs/_bzlib.o := CPPFLAGS += -I$(SRC)/common/bzip2 +objs/_bzlib.o: libstand_bzlib_private.h +pics/_bzlib.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +pics/_bzlib.o := CPPFLAGS += -I$(SRC)/common/bzip2 +pics/_bzlib.o: libstand_bzlib_private.h +objs/_crctable.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +objs/_crctable.o := CPPFLAGS += -I$(SRC)/common/bzip2 +objs/_crctable.o: libstand_bzlib_private.h +pics/_crctable.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +pics/_crctable.o := CPPFLAGS += -I$(SRC)/common/bzip2 +pics/_crctable.o: libstand_bzlib_private.h +objs/_decompress.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +objs/_decompress.o := CPPFLAGS += -I$(SRC)/common/bzip2 +objs/_decompress.o: libstand_bzlib_private.h +pics/_decompress.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +pics/_decompress.o := CPPFLAGS += -I$(SRC)/common/bzip2 +pics/_decompress.o: libstand_bzlib_private.h +objs/_huffman.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +objs/_huffman.o := CPPFLAGS += -I$(SRC)/common/bzip2 +objs/_huffman.o: libstand_bzlib_private.h +pics/_huffman.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +pics/_huffman.o := CPPFLAGS += -I$(SRC)/common/bzip2 +pics/_huffman.o: libstand_bzlib_private.h +objs/_randtable.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +objs/_randtable.o := CPPFLAGS += -I$(SRC)/common/bzip2 +objs/_randtable.o: libstand_bzlib_private.h +pics/_randtable.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +pics/_randtable.o := CPPFLAGS += -I$(SRC)/common/bzip2 +pics/_randtable.o: libstand_bzlib_private.h +objs/bzipfs.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +objs/bzipfs.o := CPPFLAGS += -I$(SRC)/common/bzip2 +objs/bzipfs.o: libstand_bzlib_private.h +pics/bzipfs.o := CPPFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS +pics/bzipfs.o := CPPFLAGS += -I$(SRC)/common/bzip2 +pics/bzipfs.o: libstand_bzlib_private.h SRCS += libstand_bzlib_private.h # too hairy -_inflate.o := SMATCH=off +objs/_inflate.o := SMATCH=off +pics/_inflate.o := SMATCH=off SRCS += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c -OBJS += _bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o -CLEANFILES += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c +OBJECTS += _bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o +CLEANFILES += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c _bzlib.c: $(SRC)/common/bzip2/bzlib.c sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ @@ -112,11 +147,33 @@ libstand_bzlib_private.h: $(SRC)/common/bzip2/bzlib_private.h sed -e 's||"stand.h"|' $^ > $@ # decompression functionality from zlib -adler32.o crc32.o _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o \ -gzipfs.o gzip.o := CPPFLAGS += -I$(ZLIB) +objs/adler32.o := CPPFLAGS += -I$(ZLIB) +pics/adler32.o := CPPFLAGS += -I$(ZLIB) +objs/crc32.o := CPPFLAGS += -I$(ZLIB) +pics/crc32.o := CPPFLAGS += -I$(ZLIB) +objs/_infback.o := CPPFLAGS += -I$(ZLIB) +pics/_infback.o := CPPFLAGS += -I$(ZLIB) +objs/_infback.o pics/_infback.o: libstand_zutil.h libstand_gzguts.h +objs/_inffast.o := CPPFLAGS += -I$(ZLIB) +pics/_inffast.o := CPPFLAGS += -I$(ZLIB) +objs/_inffast.o pics/_inffast.o: libstand_zutil.h libstand_gzguts.h +objs/_inflate.o := CPPFLAGS += -I$(ZLIB) +pics/_inflate.o := CPPFLAGS += -I$(ZLIB) +objs/_inflate.o pics/_inflate.o: libstand_zutil.h libstand_gzguts.h +objs/_inftrees.o := CPPFLAGS += -I$(ZLIB) +pics/_inftrees.o := CPPFLAGS += -I$(ZLIB) +objs/_inftrees.o pics/_inftrees.o: libstand_zutil.h libstand_gzguts.h +objs/_zutil.o := CPPFLAGS += -I$(ZLIB) +pics/_zutil.o := CPPFLAGS += -I$(ZLIB) +objs/_zutil.o pics/_zutil.o: libstand_zutil.h libstand_gzguts.h +objs/gzipfs.o := CPPFLAGS += -I$(ZLIB) +pics/gzipfs.o := CPPFLAGS += -I$(ZLIB) +objs/gzip.o := CPPFLAGS += -I$(ZLIB) +pics/gzip.o := CPPFLAGS += -I$(ZLIB) + SRCS += $(ZLIB)/adler32.c $(ZLIB)/crc32.c \ libstand_zutil.h libstand_gzguts.h -OBJS += adler32.o crc32.o +OBJECTS += adler32.o crc32.o _infback.c: $(ZLIB)/infback.c sed -e "s|zutil\.h|libstand_zutil.h|" \ @@ -140,8 +197,8 @@ _zutil.c: $(ZLIB)/zutil.c $^ > $@ SRCS += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c -OBJS += _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o -CLEANFILES += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c +OBJECTS += _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o +CLEANFILES += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c # depend on stand.h being able to be included multiple times libstand_zutil.h: $(ZLIB)/zutil.h @@ -163,9 +220,10 @@ libstand_gzguts.h: $(ZLIB)/gzguts.h CLEANFILES += libstand_zutil.h libstand_gzguts.h # lz4 decompression functionality -lz4.o := CPPFLAGS += -I$(LZ4) +pics/lz4.o := CPPFLAGS += -I$(LZ4) +objs/lz4.o := CPPFLAGS += -I$(LZ4) SRCS += $(LZ4)/lz4.c -OBJS += lz4.o +OBJECTS += lz4.o # io routines SRCS += $(SASRC)/closeall.c $(SASRC)/dev.c \ @@ -174,7 +232,7 @@ SRCS += $(SASRC)/closeall.c $(SASRC)/dev.c \ $(SASRC)/lseek.c $(SASRC)/open.c $(SASRC)/read.c \ $(SASRC)/write.c $(SASRC)/readdir.c -OBJS += closeall.o dev.o ioctl.o nullfs.o stat.o fstat.o close.o lseek.o \ +OBJECTS += closeall.o dev.o ioctl.o nullfs.o stat.o fstat.o close.o lseek.o \ open.o read.o write.o readdir.o # network routines @@ -182,12 +240,12 @@ SRCS += $(SASRC)/arp.c $(SASRC)/ether.c $(SASRC)/ip.c \ $(SASRC)/inet_ntoa.c $(SASRC)/in_cksum.c \ $(SASRC)/net.c $(SASRC)/udp.c $(SASRC)/netif.c \ $(SASRC)/rpc.c -OBJS += arp.o ether.o ip.o inet_ntoa.o in_cksum.o net.o udp.o netif.o rpc.o +OBJECTS += arp.o ether.o ip.o inet_ntoa.o in_cksum.o net.o udp.o netif.o rpc.o # network info services: SRCS += $(SASRC)/bootp.c $(SASRC)/rarp.c \ $(SASRC)/bootparam.c -OBJS += bootp.o rarp.o bootparam.o +OBJECTS += bootp.o rarp.o bootparam.o # boot filesystems SRCS += $(SASRC)/ufs.c @@ -197,12 +255,16 @@ SRCS += $(SASRC)/tftp.c SRCS += $(SASRC)/gzipfs.c SRCS += $(SASRC)/bzipfs.c SRCS += $(SASRC)/dosfs.c -OBJS += ufs.o -OBJS += nfs.o -OBJS += cd9660.o -OBJS += tftp.o -OBJS += gzipfs.o -OBJS += bzipfs.o -OBJS += dosfs.o -# -.PARALLEL: +OBJECTS += ufs.o +OBJECTS += nfs.o +OBJECTS += cd9660.o +OBJECTS += tftp.o +OBJECTS += gzipfs.o +OBJECTS += bzipfs.o +OBJECTS += dosfs.o + +# utility +SRCS += (SRC)/common/util/explicit_bzero.c +SRCS += (SRC)/common/util/memmem.c +OBJECTS += explicit_bzero.o +OBJECTS += memmem.o diff --git a/usr/src/boot/lib/libstand/crypto/Makefile.inc b/usr/src/boot/lib/libstand/crypto/Makefile.inc index 6a8dadc313..3cff3ecdb6 100644 --- a/usr/src/boot/lib/libstand/crypto/Makefile.inc +++ b/usr/src/boot/lib/libstand/crypto/Makefile.inc @@ -21,32 +21,32 @@ SRCS += $(COMDIR)/edonr/edonr.c SRCS += $(COMDIR)/skein/skein.c SRCS += $(COMDIR)/skein/skein_iv.c SRCS += $(COMDIR)/skein/skein_block.c -OBJS += digest.o -OBJS += sha1.o -OBJS += edonr.o -OBJS += skein.o -OBJS += skein_iv.o -OBJS += skein_block.o +OBJECTS += digest.o +OBJECTS += sha1.o +OBJECTS += edonr.o +OBJECTS += skein.o +OBJECTS += skein_iv.o +OBJECTS += skein_block.o -digest.o := CPPFLAGS += -I../../common +objs/digest.o pics/digest.o := CPPFLAGS += -I../../common # Do not unroll skein loops, reduce code size -skein_block.o := CPPFLAGS += -DSKEIN_LOOP=111 +objs/skein_block.o pics/skein_block.o := CPPFLAGS += -DSKEIN_LOOP=111 -%.o: $(COMDIR)/edonr/%.c +objs/%.o pics/%.o: $(COMDIR)/edonr/%.c $(COMPILE.c) -o $@ $< -%.o: $(COMDIR)/skein/%.c +objs/%.o pics/%.o: $(COMDIR)/skein/%.c $(COMPILE.c) -o $@ $< -%.o: $(CRYPTOSRC)/%.c +objs/%.o pics/%.o: $(CRYPTOSRC)/%.c $(COMPILE.c) -o $@ $< -%.o: $(COMDIR)/sha1/%.c - $(COMPILE.c) $< +objs/%.o pics/%.o: $(COMDIR)/sha1/%.c + $(COMPILE.c) -o $@ $< sha1-x86_64.s: $(COMDIR)/sha1/amd64/sha1-x86_64.pl $(PERL) $? $@ -sha1-x86_64.o: sha1-x86_64.s +pics/sha1-x86_64.o: sha1-x86_64.s $(COMPILE.s) -o $@ ${@F:.o=.s} diff --git a/usr/src/boot/lib/libstand/zfs/Makefile.inc b/usr/src/boot/lib/libstand/zfs/Makefile.inc index fd054a9411..a33a42d703 100644 --- a/usr/src/boot/lib/libstand/zfs/Makefile.inc +++ b/usr/src/boot/lib/libstand/zfs/Makefile.inc @@ -13,23 +13,25 @@ # Copyright 2021 Toomas Soome # -SRCS += $(ZFSSRC)/zfs.c -SRCS += $(ZFSSRC)/gzip.c -SRCS += $(SRC)/common/list/list.c -OBJS += zfs.o -OBJS += gzip.o -OBJS += nvlist.o -OBJS += list.o +SRCS += $(ZFSSRC)/zfs.c +SRCS += $(ZFSSRC)/gzip.c +SRCS += $(SRC)/common/list/list.c +OBJECTS += zfs.o +OBJECTS += gzip.o +OBJECTS += nvlist.o +OBJECTS += list.o -zfs.o := CPPFLAGS += -I../../common -zfs.o := CPPFLAGS += -I../../../cddl/boot/zfs -I$(LZ4) -zfs.o := CPPFLAGS += -I$(SRC)/uts/common/fs/zfs -nvlist.o := CPPFLAGS += -I../../common -I../../../cddl/boot/zfs +objs/zfs.o pics/zfs.o := CPPFLAGS += -I../../common +objs/zfs.o pics/zfs.o := CPPFLAGS += -I../../../cddl/boot/zfs -I$(LZ4) +objs/zfs.o pics/zfs.o := CPPFLAGS += -I$(SRC)/uts/common/fs/zfs +objs/zfs.o pics/zfs.o := CPPFLAGS += -I$(CRYPTOSRC) +objs/nvlist.o pics/nvlist.o := CPPFLAGS += -I../../common +objs/nvlist.o pics/nvlist.o := CPPFLAGS += -I../../../cddl/boot/zfs -%.o: $(ZFSSRC)/%.c +pics/%.o objs/%.o: $(ZFSSRC)/%.c $(COMPILE.c) -o $@ $< -%.o: $(SRC)/common/list/%.c - $(COMPILE.c) -DNDEBUG $< +pics/%.o objs/%.o: $(SRC)/common/list/%.c + $(COMPILE.c) -DNDEBUG -o $@ $< zfs.o: $(ZFSSRC)/zfsimpl.c diff --git a/usr/src/boot/sys/boot/Makefile.inc b/usr/src/boot/sys/boot/Makefile.inc index 83a480c156..c6b5320866 100644 --- a/usr/src/boot/sys/boot/Makefile.inc +++ b/usr/src/boot/sys/boot/Makefile.inc @@ -49,14 +49,14 @@ AS_CPPFLAGS= CPPFLAGS= -D_STANDALONE -_gcc=-nostdinc CFLAGS64= -_gcc=-mno-red-zone -CFLAGS= -_gcc=-Os -_gcc=-fPIC -_gcc=-ffreestanding -_gcc=-fno-builtin +CFLAGS= -_gcc=-Os -_gcc=-ffreestanding -_gcc=-fno-builtin CFLAGS += -_gcc=-ffunction-sections -_gcc=-fdata-sections CFLAGS += -_gcc=-mno-mmx -_gcc=-mno-3dnow -_gcc=-mno-sse -_gcc=-mno-sse2 CFLAGS += -_gcc=-mno-sse3 -_gcc=-msoft-float CFLAGS += -_gcc=-mno-avx -_gcc=-mno-aes CFLAGS += -_gcc=-Wall CFLAGS += $(CCNOAUTOINLINE) $(CCNOREORDER) $(CSTD_GNU99) -CCASFLAGS= -fPIC -Wa,--divide +CCASFLAGS= -Wa,--divide ASFLAGS= --divide SMATCH_ = @@ -64,11 +64,11 @@ SMATCH_on = SMATCH_off = -_smatch=off # SMATCH_ARGS will bring in set of -Wno-* options. -#CFLAGS += $(SMATCH_ARGS:%=-_smatch=%) +SMATCH_ARGS = --timeout=0 +CFLAGS += $(SMATCH_ARGS:%=-_smatch=%) CFLAGS += $(SMOFF:%=-_smatch=--disable=%) CFLAGS += $(SMATCH_$(MACHINE)) CFLAGS += $(SMATCH_$(SMATCH)) -CFLAGS += -_smatch=--timeout=0 COMPILE.S= $(CC) $(SMATCH_off) $(CCASFLAGS) $(CPPFLAGS) -c diff --git a/usr/src/boot/sys/boot/Makefile.lib b/usr/src/boot/sys/boot/Makefile.lib new file mode 100644 index 0000000000..baa97a1513 --- /dev/null +++ b/usr/src/boot/sys/boot/Makefile.lib @@ -0,0 +1,34 @@ +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2021 Toomas Soome +# + +OBJS= $(OBJECTS:%=objs/%) +PICS= $(OBJECTS:%=pics/%) + +.PARALLEL: $(OBJS) $(PICS) DUMMY + +$(PICS) := CFLAGS += -_gcc=-fPIC +$(PICS) := CCASFLAGS += -_gcc=-fPIC + +$(OBJS) $(PICS): machine x86 + +objs pics: + -@mkdir -p $@ + +$(LIBRARY): objs .WAIT $$(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +$(DYNLIB): pics .WAIT $$(PICS) + $(AR) $(ARFLAGS) $@ $(PICS) + +CLEANFILES += $(OBJS) $(PICS) $(LIBRARY) $(DYNLIB) diff --git a/usr/src/boot/sys/boot/efi/Makefile.inc b/usr/src/boot/sys/boot/efi/Makefile.inc index 4201600ac3..ad29e53249 100644 --- a/usr/src/boot/sys/boot/efi/Makefile.inc +++ b/usr/src/boot/sys/boot/efi/Makefile.inc @@ -14,6 +14,6 @@ # # Options used when building app-specific efi components -CFLAGS += -_gcc=-fshort-wchar +CFLAGS += -_gcc=-fshort-wchar $(C_BIGPICFLAGS) .PARALLEL: diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile.com b/usr/src/boot/sys/boot/efi/loader/Makefile.com index 8d05cdfbe6..555cfa0db7 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile.com +++ b/usr/src/boot/sys/boot/efi/loader/Makefile.com @@ -13,7 +13,6 @@ # Copyright 2016 Toomas Soome # -include $(SRC)/Makefile.master include $(SRC)/boot/Makefile.version include $(SRC)/boot/sys/boot/Makefile.inc @@ -89,18 +88,46 @@ smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID # Use network-endian UUID format for backward compatibility. #CPPFLAGS += -DSMBIOS_NETWORK_ENDIAN_UUID -DPLIBSTAND= ../../../libstand/$(MACHINE)/libstand.a -LIBSTAND= -L../../../libstand/$(MACHINE) -lstand +DPLIBSTAND= ../../../libstand/$(MACHINE)/libstand_pics.a +LIBSTAND= -L../../../libstand/$(MACHINE) -lstand_pics BOOT_FORTH= yes CPPFLAGS += -DBOOT_FORTH CPPFLAGS += -I$(SRC)/common/ficl CPPFLAGS += -I../../../libficl -DPLIBFICL= ../../../libficl/$(MACHINE)/libficl.a -LIBFICL= -L../../../libficl/$(MACHINE) -lficl +DPLIBFICL= ../../../libficl/$(MACHINE)/libficl_pics.a +LIBFICL= -L../../../libficl/$(MACHINE) -lficl_pics # Always add MI sources -include ../Makefile.common +# +SRCS += boot.c commands.c console.c devopen.c interp.c +SRCS += interp_backslash.c interp_parse.c ls.c misc.c +SRCS += module.c linenoise.c zfs_cmd.c + +OBJS += boot.o commands.o console.o devopen.o interp.o \ + interp_backslash.o interp_parse.o ls.o misc.o \ + module.o linenoise.o zfs_cmd.o + +SRCS += load_elf32.c load_elf32_obj.c reloc_elf32.c +SRCS += load_elf64.c load_elf64_obj.c reloc_elf64.c + +OBJS += load_elf32.o load_elf32_obj.o reloc_elf32.o \ + load_elf64.o load_elf64_obj.o reloc_elf64.o + +SRCS += disk.c part.c dev_net.c vdisk.c +OBJS += disk.o part.o dev_net.o vdisk.o +CPPFLAGS += -DLOADER_DISK_SUPPORT +CPPFLAGS += -DLOADER_GPT_SUPPORT +CPPFLAGS += -DLOADER_MBR_SUPPORT + +part.o := CPPFLAGS += -I$(ZLIB) + +SRCS += bcache.c +OBJS += bcache.o + +# Forth interpreter +SRCS += interp_forth.c +OBJS += interp_forth.o CPPFLAGS += -I../../../common # For multiboot2.h, must be last, to avoid conflicts @@ -116,7 +143,7 @@ LDFLAGS = -nostdlib --eh-frame-hdr LDFLAGS += -shared --hash-style=both --enable-new-dtags LDFLAGS += -T$(LDSCRIPT) -Bsymbolic -CLEANFILES= loader.sym loader.bin +CLEANFILES= $(EFIPROG) loader.sym loader.bin CLEANFILES += $(FONT).c vers.c NEWVERSWHAT= "EFI loader" $(MACHINE) @@ -158,7 +185,7 @@ x86: $(SYMLINK) ../../../../x86/include x86 clean clobber: - $(RM) $(CLEANFILES) $(OBJS) + $(RM) $(CLEANFILES) $(OBJS) machine x86 %.o: ../%.c $(COMPILE.c) $< diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile.common b/usr/src/boot/sys/boot/efi/loader/Makefile.common deleted file mode 100644 index 9399748591..0000000000 --- a/usr/src/boot/sys/boot/efi/loader/Makefile.common +++ /dev/null @@ -1,30 +0,0 @@ -# - -SRCS += boot.c commands.c console.c devopen.c interp.c -SRCS += interp_backslash.c interp_parse.c ls.c misc.c -SRCS += module.c linenoise.c zfs_cmd.c - -OBJS += boot.o commands.o console.o devopen.o interp.o \ - interp_backslash.o interp_parse.o ls.o misc.o \ - module.o linenoise.o zfs_cmd.o - -SRCS += load_elf32.c load_elf32_obj.c reloc_elf32.c -SRCS += load_elf64.c load_elf64_obj.c reloc_elf64.c - -OBJS += load_elf32.o load_elf32_obj.o reloc_elf32.o \ - load_elf64.o load_elf64_obj.o reloc_elf64.o - -SRCS += disk.c part.c dev_net.c vdisk.c -OBJS += disk.o part.o dev_net.o vdisk.o -CFLAGS += -DLOADER_DISK_SUPPORT -CFLAGS += -DLOADER_GPT_SUPPORT -CFLAGS += -DLOADER_MBR_SUPPORT - -part.o := CPPFLAGS += -I$(ZLIB) - -SRCS += bcache.c -OBJS += bcache.o - -# Forth interpreter -SRCS += interp_forth.c -OBJS += interp_forth.o diff --git a/usr/src/boot/sys/boot/efi/loader/amd64/Makefile b/usr/src/boot/sys/boot/efi/loader/amd64/Makefile index 8022b364f2..a7894b50ca 100644 --- a/usr/src/boot/sys/boot/efi/loader/amd64/Makefile +++ b/usr/src/boot/sys/boot/efi/loader/amd64/Makefile @@ -14,6 +14,8 @@ # Copyright 2016 RackTop Systems. # +include $(SRC)/Makefile.master + MACHINE= $(MACH64) EFIPROG= loader64.efi diff --git a/usr/src/boot/sys/boot/efi/loader/i386/Makefile b/usr/src/boot/sys/boot/efi/loader/i386/Makefile index 42885ca81f..b2f086971a 100644 --- a/usr/src/boot/sys/boot/efi/loader/i386/Makefile +++ b/usr/src/boot/sys/boot/efi/loader/i386/Makefile @@ -14,6 +14,8 @@ # Copyright 2016 RackTop Systems. # +include $(SRC)/Makefile.master + MACHINE= $(MACH) EFIPROG= loader32.efi @@ -28,8 +30,6 @@ efi_main.o := CPPFLAGS += -DLOADER_EFI=L\"loader32.efi\" CFLAGS += -m32 CCASFLAGS += -m32 -CLEANFILES += machine x86 $(EFIPROG) - $(OBJS): machine x86 %.o: ../../../i386/libi386/%.c diff --git a/usr/src/boot/sys/boot/i386/libi386/Makefile b/usr/src/boot/sys/boot/i386/libi386/Makefile index aa11fc2276..4b6d501c95 100644 --- a/usr/src/boot/sys/boot/i386/libi386/Makefile +++ b/usr/src/boot/sys/boot/i386/libi386/Makefile @@ -105,48 +105,39 @@ SRCS += $(ZFSSRC)/devicename_stubs.c OBJS += devicename_stubs.o BOOT_COMCONSOLE_PORT= 0x3f8 -CFLAGS += -DCOMPORT=${BOOT_COMCONSOLE_PORT} +CPPFLAGS += -DCOMPORT=${BOOT_COMCONSOLE_PORT} BOOT_COMCONSOLE_SPEED= 9600 -CFLAGS += -DCOMSPEED=${BOOT_COMCONSOLE_SPEED} +CPPFLAGS += -DCOMSPEED=${BOOT_COMCONSOLE_SPEED} # Make the disk code more talkative -# CFLAGS+= -DDISK_DEBUG +# CPPFLAGS+= -DDISK_DEBUG # Export serial numbers, UUID, and asset tag from loader. -smbios.o := CFLAGS += -DSMBIOS_SERIAL_NUMBERS +smbios.o := CPPFLAGS += -DSMBIOS_SERIAL_NUMBERS # Use little-endian UUID format as defined in SMBIOS 2.6. -smbios.o := CFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID +smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID # Use network-endian UUID format for backward compatibility. -#CFLAGS += -DSMBIOS_NETWORK_ENDIAN_UUID +#CPPFLAGS += -DSMBIOS_NETWORK_ENDIAN_UUID # XXX: make alloca() useable -CFLAGS += -Dalloca=__builtin_alloca +CPPFLAGS += -Dalloca=__builtin_alloca -CFLAGS += -I$(SRC)/common/ficl -I../../libficl \ +CPPFLAGS += -I$(SRC)/common/ficl -I../../libficl \ -I../../common -I../common \ -I../btx/lib \ -I$(SRC)/uts/intel/sys/acpi \ -I../../.. -I. # the location of libstand -CFLAGS += -I../../../../lib/libstand/ +CPPFLAGS += -I../../../../lib/libstand/ multiboot.o := CPPFLAGS += -I../../../cddl/boot/zfs multiboot2.o := CPPFLAGS += -I../../../cddl/boot/zfs devicename.o := CPPFLAGS += -I../../../cddl/boot/zfs devicename_stubs.o := CPPFLAGS += -I../../../cddl/boot/zfs -# Handle FreeBSD specific %b and %D printf format specifiers -#FORMAT_EXTENSIONS=-D__printf__=__freebsd_kprintf__ -#CFLAGS += ${FORMAT_EXTENSIONS} - CLEANFILES += machine x86 -# XXX: clang integrated-as doesn't grok .codeNN directives yet -# CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS} -# CFLAGS.multiboot_tramp.S= ${CLANG_NO_IAS} -# CFLAGS += ${CFLAGS.${.IMPSRC:T}} - include ../Makefile.inc # For multiboot2.h, must be last, to avoid conflicts diff --git a/usr/src/boot/sys/boot/libficl/Makefile.com b/usr/src/boot/sys/boot/libficl/Makefile.com index 0cd051356f..564403516d 100644 --- a/usr/src/boot/sys/boot/libficl/Makefile.com +++ b/usr/src/boot/sys/boot/libficl/Makefile.com @@ -34,20 +34,14 @@ HEADERS= $(FICLDIR)/ficl.h $(FICLDIR)/ficlplatform/unix.h ../ficllocal.h # # disable inner loop variable 'fw' check -vm.o := SMOFF += check_check_deref - -.PARALLEL: +objs/vm.o := SMOFF += check_check_deref +pics/vm.o := SMOFF += check_check_deref MAJOR = 4 MINOR = 1.0 -lib: libficl.a - -vm.o := CFLAGS += -_gcc=-Wno-clobbered - -# static library build -libficl.a: $(OBJECTS) - $(AR) $(ARFLAGS) libficl.a $(OBJECTS) +objs/vm.o := CFLAGS += -_gcc=-Wno-clobbered +pics/vm.o := CFLAGS += -_gcc=-Wno-clobbered machine: $(RM) machine @@ -57,17 +51,17 @@ x86: $(RM) x86 $(SYMLINK) ../../../x86/include x86 -%.o: ../softcore/%.c $(HEADERS) - $(COMPILE.c) $< +objs/%.o pics/%.o: ../softcore/%.c $(HEADERS) + $(COMPILE.c) -o $@ $< -%.o: $(FICLDIR)/%.c $(HEADERS) - $(COMPILE.c) $< +objs/%.o pics/%.o: $(FICLDIR)/%.c $(HEADERS) + $(COMPILE.c) -o $@ $< -%.o: $(FICLDIR)/ficlplatform/%.c $(HEADERS) - $(COMPILE.c) $< +objs/%.o pics/%.o: $(FICLDIR)/ficlplatform/%.c $(HEADERS) + $(COMPILE.c) -o $@ $< # # generic cleanup code # clobber clean: FRC - $(RM) *.o *.a libficl.* ficl machine x86 + $(RM) $(CLEANFILES) machine x86 diff --git a/usr/src/boot/sys/boot/libficl/amd64/Makefile b/usr/src/boot/sys/boot/libficl/amd64/Makefile index ef560fa39b..2f006575f7 100644 --- a/usr/src/boot/sys/boot/libficl/amd64/Makefile +++ b/usr/src/boot/sys/boot/libficl/amd64/Makefile @@ -17,13 +17,14 @@ include $(SRC)/Makefile.master MACHINE= $(MACH64) +DYNLIB= libficl_pics.a -all install: lib +all install: $(DYNLIB) include ../Makefile.com CFLAGS += -m64 $(CFLAGS64) -$(OBJECTS): machine x86 +include $(SRC)/boot/sys/boot/Makefile.lib FRC: diff --git a/usr/src/boot/sys/boot/libficl/i386/Makefile b/usr/src/boot/sys/boot/libficl/i386/Makefile index f4478a4c50..6ad5f9467d 100644 --- a/usr/src/boot/sys/boot/libficl/i386/Makefile +++ b/usr/src/boot/sys/boot/libficl/i386/Makefile @@ -17,13 +17,15 @@ include $(SRC)/Makefile.master MACHINE= $(MACH) +LIBRARY= libficl.a +DYNLIB= libficl_pics.a -all install: lib +all install: $(LIBRARY) $(DYNLIB) include ../Makefile.com CFLAGS += -m32 -$(OBJECTS): machine x86 +include $(SRC)/boot/sys/boot/Makefile.lib FRC: diff --git a/usr/src/boot/sys/boot/libstand/Makefile b/usr/src/boot/sys/boot/libstand/Makefile index 41e614a3ec..01b0b02cab 100644 --- a/usr/src/boot/sys/boot/libstand/Makefile +++ b/usr/src/boot/sys/boot/libstand/Makefile @@ -13,8 +13,6 @@ # Copyright 2015 Toomas Soome # -.KEEP_STATE: - include $(SRC)/Makefile.master SUBDIRS = $(MACH) $(MACH64) @@ -24,9 +22,9 @@ clean := TARGET = clean clobber := TARGET = clobber install := TARGET = install -all clean clobber: $(SUBDIRS) +.KEEP_STATE: -install: all +all clean clobber install: $(SUBDIRS) .PARALLEL: diff --git a/usr/src/boot/sys/boot/libstand/Makefile.com b/usr/src/boot/sys/boot/libstand/Makefile.com index 9294460253..d282deedaa 100644 --- a/usr/src/boot/sys/boot/libstand/Makefile.com +++ b/usr/src/boot/sys/boot/libstand/Makefile.com @@ -14,37 +14,23 @@ # Copyright 2019 Joyent, Inc. # -include $(SRC)/Makefile.master include $(SRC)/boot/sys/boot/Makefile.inc CPPFLAGS += -I../../../../include -I$(SASRC) -CPPFLAGS += -I../../.. -I. -I$(SRC)/common/bzip2 - -$(LIBRARY): $(SRCS) $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) +CPPFLAGS += -I../../.. -I. include $(SASRC)/Makefile.inc include $(CRYPTOSRC)/Makefile.inc include $(ZFSSRC)/Makefile.inc -LIBCSRC= $(SRC)/lib/libc -OBJS += explicit_bzero.o -OBJS += memmem.o - CPPFLAGS += -I$(SRC)/uts/common -# needs work -printf.o := SMOFF += 64bit_shift - -# too hairy -_inflate.o := SMATCH=off - # 64-bit smatch false positive :/ SMOFF += uninitialized -clean: clobber -clobber: - $(RM) $(CLEANFILES) $(OBJS) machine $(LIBRARY) +# needs work +objs/printf.o := SMOFF += 64bit_shift +pics/printf.o := SMOFF += 64bit_shift machine: $(RM) machine @@ -54,23 +40,30 @@ x86: $(RM) x86 $(SYMLINK) ../../../x86/include x86 -%.o: $(SASRC)/%.c - $(COMPILE.c) $< +pics/%.o objs/%.o: %.c + $(COMPILE.c) -o $@ $< + +pics/%.o objs/%.o: $(SASRC)/%.c + $(COMPILE.c) -o $@ $< -%.o: $(LIBSRC)/libc/net/%.c - $(COMPILE.c) $< +pics/%.o objs/%.o: $(LIBSRC)/libc/net/%.c + $(COMPILE.c) -o $@ $< -%.o: $(LIBSRC)/libc/string/%.c - $(COMPILE.c) $< +pics/%.o objs/%.o: $(LIBSRC)/libc/string/%.c + $(COMPILE.c) -o $@ $< -%.o: $(LIBSRC)/libc/uuid/%.c - $(COMPILE.c) $< +pics/%.o objs/%.o: $(LIBSRC)/libc/uuid/%.c + $(COMPILE.c) -o $@ $< -%.o: $(ZLIB)/%.c - $(COMPILE.c) $< +pics/%.o objs/%.o: $(ZLIB)/%.c + $(COMPILE.c) -o $@ $< -%.o: $(LZ4)/%.c - $(COMPILE.c) $< +pics/%.o objs/%.o: $(LZ4)/%.c + $(COMPILE.c) -o $@ $< -%.o: $(SRC)/common/util/%.c - $(COMPILE.c) $< +pics/%.o objs/%.o: $(SRC)/common/util/%.c + $(COMPILE.c) -o $@ $< + +clean: clobber +clobber: + $(RM) $(CLEANFILES) machine x86 diff --git a/usr/src/boot/sys/boot/libstand/amd64/Makefile b/usr/src/boot/sys/boot/libstand/amd64/Makefile index 8c28ac3dda..ec11ff2156 100644 --- a/usr/src/boot/sys/boot/libstand/amd64/Makefile +++ b/usr/src/boot/sys/boot/libstand/amd64/Makefile @@ -14,10 +14,12 @@ # Copyright 2016 RackTop Systems. # +include $(SRC)/Makefile.master + MACHINE= $(MACH64) -LIBRARY= libstand.a +DYNLIB= libstand_pics.a -all install: $(LIBRARY) +all install: $(DYNLIB) include ../Makefile.com @@ -25,17 +27,17 @@ ASFLAGS = $(amd64_AS_XARCH) -I$(SRC)/uts/common -D_ASM CFLAGS += -m64 $(CFLAGS64) CCASFLAGS += -m64 -CLEANFILES += x86 sha1-x86_64.s - # _setjmp/_longjmp SRCS += $(SASRC)/amd64/_setjmp.S -OBJS += _setjmp.o +OBJECTS += _setjmp.o SRCS += sha1-x86_64.s -OBJS += sha1-x86_64.o +OBJECTS += sha1-x86_64.o + +CLEANFILES += sha1-x86_64.s -$(LIBRARY): $(SRCS) $(OBJS) +pics/%.o: $(SASRC)/amd64/%.S + $(COMPILE.S) -o $@ $< -$(OBJS): machine x86 +include $(SRC)/boot/sys/boot/Makefile.lib -%.o: $(SASRC)/amd64/%.S - $(COMPILE.S) $< +FRC: diff --git a/usr/src/boot/sys/boot/libstand/i386/Makefile b/usr/src/boot/sys/boot/libstand/i386/Makefile index 4837c0eb4d..aa55779a26 100644 --- a/usr/src/boot/sys/boot/libstand/i386/Makefile +++ b/usr/src/boot/sys/boot/libstand/i386/Makefile @@ -14,25 +14,26 @@ # Copyright 2016 RackTop Systems. # +include $(SRC)/Makefile.master + MACHINE= $(MACH) LIBRARY= libstand.a +DYNLIB= libstand_pics.a -all install: $(LIBRARY) +all install: $(LIBRARY) $(DYNLIB) include ../Makefile.com CFLAGS += -m32 CCASFLAGS += -m32 -CLEANFILES += x86 - # _setjmp/_longjmp SRCS += $(SASRC)/i386/_setjmp.S -OBJS += _setjmp.o +OBJECTS += _setjmp.o -$(LIBRARY): $(SRCS) $(OBJS) +pics/%.o objs/%.o: $(SASRC)/i386/%.S + $(COMPILE.S) -o $@ $< -$(OBJS): machine x86 +include $(SRC)/boot/sys/boot/Makefile.lib -%.o: $(SASRC)/i386/%.S - $(COMPILE.S) $< +FRC: -- cgit v1.2.3