Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162606098
D44872.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D44872.diff
View Options
diff --git a/stand/defs.mk b/stand/defs.mk
--- a/stand/defs.mk
+++ b/stand/defs.mk
@@ -83,6 +83,12 @@
# Standard options:
CFLAGS+= -nostdinc
+CFLAGS+= -flto
+.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
+# This options is for the sake of EFI, which mandates 16-bit wchars. Just to make sure
+# we are generating ABI-compatible code while compiling common libs.
+CFLAGS+= -fshort-wchar
+.endif
# Allow CFLAGS_EARLY.file/target so that code that needs specific stack
# of include paths can set them up before our include paths. Normally
# the only thing that should be there are -I directives, and as few of
diff --git a/stand/efi/Makefile.inc b/stand/efi/Makefile.inc
--- a/stand/efi/Makefile.inc
+++ b/stand/efi/Makefile.inc
@@ -6,12 +6,10 @@
LDFLAGS+= -nostdlib
.if ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+= -fshort-wchar
CFLAGS+= -mno-red-zone
.endif
.if ${MACHINE_CPUARCH} == "aarch64"
-CFLAGS+= -fshort-wchar
CFLAGS+= -fPIC
.endif
diff --git a/stand/efi/boot1/Makefile b/stand/efi/boot1/Makefile
--- a/stand/efi/boot1/Makefile
+++ b/stand/efi/boot1/Makefile
@@ -69,6 +69,9 @@
LDFLAGS+= -Wl,--no-dynamic-linker
.endif
+LDSYM_SCRIPT= ${.CURDIR}/../loader/Symbol.map
+LDFLAGS+= -Wl,--version-script=${LDSYM_SCRIPT}
+
.if ${MACHINE_CPUARCH} == "aarch64"
CFLAGS+= -mgeneral-regs-only
.endif
@@ -86,7 +89,7 @@
DPADD+= ${LIBEFI} ${LIBSA}
LDADD+= ${LIBEFI} ${LIBSA}
-DPADD+= ${LDSCRIPT}
+DPADD+= ${LDSCRIPT} ${LDSYM_SCRIPT}
CLEANFILES+= ${BOOT1}.efi
diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile
--- a/stand/efi/loader/Makefile
+++ b/stand/efi/loader/Makefile
@@ -126,6 +126,9 @@
LDFLAGS+= -Wl,--threads=1
.endif
+LDSYM_SCRIPT= ${.CURDIR}/../loader/Symbol.map
+LDFLAGS+= -Wl,--version-script=${LDSYM_SCRIPT}
+
CLEANFILES+= ${LOADER}.efi
${LOADER}.efi: ${PROG}
@@ -150,5 +153,6 @@
DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBSAFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT}
LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBSAFDT} ${LIBEFI_FDT} ${LIBSA}
.endif
+DPADD+= ${LDSYM_SCRIPT}
.include <bsd.prog.mk>
diff --git a/stand/efi/loader/Symbol.map b/stand/efi/loader/Symbol.map
new file mode 100644
--- /dev/null
+++ b/stand/efi/loader/Symbol.map
@@ -0,0 +1,4 @@
+EFILOADER_1.0 {
+ global: efi_main;
+ local: *;
+};
diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile
--- a/stand/i386/loader/Makefile
+++ b/stand/i386/loader/Makefile
@@ -98,6 +98,9 @@
LDFLAGS+= -Wl,-z,nostart-stop-gc
.endif
+LDSYM_SCRIPT= ${.CURDIR}/../loader/Symbol.map
+LDFLAGS+= -Wl,--version-script=${LDSYM_SCRIPT}
+
# i386 standalone support library
LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a
CFLAGS+= -I${BOOTSRC}/i386
@@ -145,7 +148,7 @@
# if someone has set a larger default linker max page size via /etc/src.conf.
LDFLAGS+= -Wl,-z,max-page-size=0x1000
-DPADD= ${LDR_INTERP32} ${LIBI386} ${LIBSA32}
+DPADD= ${LDR_INTERP32} ${LIBI386} ${LIBSA32} ${LDSYM_SCRIPT}
LDADD= ${LDR_INTERP32} ${LIBI386} ${LIBSA32}
.if ${MACHINE_CPUARCH} == "amd64"
diff --git a/stand/i386/loader/Symbol.map b/stand/i386/loader/Symbol.map
new file mode 100644
--- /dev/null
+++ b/stand/i386/loader/Symbol.map
@@ -0,0 +1,4 @@
+BIOSLOADER_1.0 {
+ global: main;
+ local: *;
+};
diff --git a/stand/userboot/Symbol.map b/stand/userboot/Symbol.map
new file mode 100644
--- /dev/null
+++ b/stand/userboot/Symbol.map
@@ -0,0 +1,4 @@
+USERBOOT_1.0 {
+ global: loader_main;
+ local: *;
+};
diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile
--- a/stand/userboot/userboot/Makefile
+++ b/stand/userboot/userboot/Makefile
@@ -56,6 +56,8 @@
NEWVERSWHAT= "User boot ${LOADER_INTERP}" ${MACHINE_CPUARCH}
VERSION_FILE?= ${.CURDIR}/../userboot/version
+LDSYM_SCRIPT= ${.CURDIR}/../Symbol.map
+LDFLAGS+= -Wl,--version-script=${LDSYM_SCRIPT}
.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
LINKS+= ${BINDIR}/${SHLIB_NAME} ${BINDIR}/userboot.so
@@ -75,7 +77,7 @@
# Always add MI sources
.include "${BOOTSRC}/loader.mk"
CFLAGS+= -I.
-DPADD+= ${LDR_INTERP} ${LIBSA}
+DPADD+= ${LDR_INTERP} ${LIBSA} ${LDSYM_SCRIPT}
LDADD+= ${LDR_INTERP} ${LIBSA}
.include <bsd.lib.mk>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 15, 11:43 PM (11 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35119403
Default Alt Text
D44872.diff (4 KB)
Attached To
Mode
D44872: Use LTO/symbol versioning to optimize (de-clutter) boot bits and pieces
Attached
Detach File
Event Timeline
Log In to Comment