Project

General

Profile

Bug #12285

kpti_trampolines.s does not build with binutils 2.34

Added by Andy Fiddaman 13 days ago. Updated 12 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
kernel
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:

Description

/data/omnios-build/omniosorg/bloody/illumos/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/aw -P -xarch=amd64 -P -Ui386 -U__i386 -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64  -D_DDI_STRICT -Dsun -D__sun -D__SVR4 -Di86pc -D_MACHDEP -DOPTERON_ERRATUM_88 -DOPTERON_ERRATUM_91 -DOPTERON_ERRATUM_93 -DOPTERON_ERRATUM_95 -DOPTERON_ERRATUM_99 -DOPTERON_ERRATUM_100 -DOPTERON_ERRATUM_101 -DOPTERON_ERRATUM_108 -DOPTERON_ERRATUM_109 -DOPTERON_ERRATUM_121 -DOPTERON_ERRATUM_122 -DOPTERON_ERRATUM_123 -DOPTERON_ERRATUM_131 -DOPTERON_WORKAROUND_6336786 -DOPTERON_WORKAROUND_6323525 -DOPTERON_ERRATUM_172 -DOPTERON_ERRATUM_298 -DOPTERON_ERRATUM_721     -D_ASM -D__STDC__=0   -I../../i86pc -I/data/omnios-build/omniosorg/bloody/illumos/usr/src/common -I../../i86xpv -I../../common/xen -I../../intel -I../../common -I../../i86pc/genassym/debug64  -o debug64/kpti_trampolines.o ../../i86pc/ml/kpti_trampolines.s
../../i86pc/ml/kpti_trampolines.s: Assembler messages:
../../i86pc/ml/kpti_trampolines.s:283: Error: unsupported instruction `sysexit'
*** Error code 1
make: Fatal error: Command failed for target `debug64/kpti_trampolines.o'

This is because kpti_trampolines.s uses sysexit which is not a valid instruction on the 64-bit AMD architecture.
A fix is to assemble this file with -mintel64 since the instructions therein are not executed on AMD processors.

The following works (just a prototype, needs cleaning up)

--- a/usr/src/tools/aw/aw.c
+++ b/usr/src/tools/aw/aw.c
@@ -656,9 +656,12 @@ main(int argc, char *argv[])
                         * architectures.
                         */
                        if (strcmp(arg, "-xarch=amd64") == 0 ||
+                           strcmp(arg, "-xarch=intel64") == 0 ||
                            strcmp(arg, "-xarch=generic64") == 0) {
                                as64++;
                                fixae_arg(as->ael_head, as64_pgm);
+                               if (strcmp(arg, "-xarch=intel64") == 0)
+                                       newae(as, "-mintel64");
                                break;
                        }
                        /*
diff --git a/usr/src/uts/i86pc/Makefile.rules b/usr/src/uts/i86pc/Makefile.rules
index 48d6fc8701f..127d10100e9 100644
--- a/usr/src/uts/i86pc/Makefile.rules
+++ b/usr/src/uts/i86pc/Makefile.rules
@@ -165,6 +165,9 @@ $(OBJS_DIR)/%.o:            $(UTSBASE)/i86pc/io/tzmon/%.c
 $(OBJS_DIR)/%.o:               $(UTSBASE)/i86pc/ml/%.s
        $(COMPILE.s) -o $@ $<

+$(OBJS_DIR)/kpti_trampolines.o:                $(UTSBASE)/i86pc/ml/kpti_trampolines.s
+       $(COMPILE.s) -xarch=intel64 -o $@ $(UTSBASE)/i86pc/ml/kpti_trampolines.s
+
 $(OBJS_DIR)/%.o:               $(UTSBASE)/i86pc/os/%.c
        $(COMPILE.c) -_gcc=-fno-stack-protector -o $@ $<
        $(CTFCONVERT_O)

Also available in: Atom PDF