From 534eb3ddd8891730253947901140453d2d2db973 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Wed, 28 May 2014 17:40:30 +0200 Subject: [PATCH] Fix libk being built with -mmmx, -msse and -msse2 on x86_64. --- kernel/Makefile | 4 +--- libc/Makefile | 2 +- libc/stdio/vprintf_callback.cpp | 2 ++ libc/stdlib/atof.cpp | 4 +++- libc/stdlib/strtof.cpp | 4 +++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 621bac3d..c14857e6 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -36,7 +36,7 @@ endif ifeq ($(CPU),x64) X86FAMILY:=1 - CXXFLAGS:=$(CXXFLAGS) -mno-red-zone + CXXFLAGS:=$(CXXFLAGS) -mno-red-zone -mno-mmx -mno-sse -mno-sse2 CPUOBJS:=$(CPU)/boot.o $(CPU)/base.o $(CPU)/x64.o endif @@ -58,8 +58,6 @@ ifdef X86FAMILY x86-family/pat.o \ x86-family/float.o \ x86-family/x86-family.o - # TODO: Are these -m flags even needed in the first place? - CXXFLAGS:=$(CXXFLAGS) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow endif # Object files that constitute the kernel. diff --git a/libc/Makefile b/libc/Makefile index c1d59332..f55b7230 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -579,7 +579,7 @@ LIBK_FLAGS:=$(FLAGS) -ffreestanding LIBK_CFLAGS:=$(CFLAGS) LIBK_CXXFLAGS:=$(CXXFLAGS) ifeq ($(HOST),x86_64-sortix) - LIBK_FLAGS:=$(LIBK_FLAGS) -mno-red-zone + LIBK_FLAGS:=$(LIBK_FLAGS) -mno-red-zone -mno-mmx -mno-sse -mno-sse2 endif BINS=libc.a libdl.a libg.a libpthread.a librt.a $(CRTOBJ) diff --git a/libc/stdio/vprintf_callback.cpp b/libc/stdio/vprintf_callback.cpp index 5ac15fdc..f383535d 100644 --- a/libc/stdio/vprintf_callback.cpp +++ b/libc/stdio/vprintf_callback.cpp @@ -340,6 +340,7 @@ size_t vprintf_callback(size_t (*callback)(void*, const char*, size_t), else written++; } +#if !defined(__is_sortix_kernel) else if ( *format == 'e' || *format == 'E' || *format == 'f' || *format == 'F' || *format == 'g' || *format == 'G' || @@ -361,6 +362,7 @@ size_t vprintf_callback(size_t (*callback)(void*, const char*, size_t), goto unsupported_conversion; } +#endif else if ( *format == 'c' && (format++, true) ) { char c; diff --git a/libc/stdlib/atof.cpp b/libc/stdlib/atof.cpp index 092066f4..80950ddf 100644 --- a/libc/stdlib/atof.cpp +++ b/libc/stdlib/atof.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2013. + Copyright(C) Jonas 'Sortie' Termansen 2013, 2014. This file is part of the Sortix C Library. @@ -24,7 +24,9 @@ #include +#if !defined(__is_sortix_kernel) extern "C" double atof(const char* str) { return strtod(str, NULL); } +#endif diff --git a/libc/stdlib/strtof.cpp b/libc/stdlib/strtof.cpp index 5cde7c41..a41eec71 100644 --- a/libc/stdlib/strtof.cpp +++ b/libc/stdlib/strtof.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2013. + Copyright(C) Jonas 'Sortie' Termansen 2013, 2014. This file is part of the Sortix C Library. @@ -35,6 +35,7 @@ // this will do for now. It's a temporary measure until I get around to // writing a real strtod function - most of them are true horrors. +#if !defined(__is_sortix_kernel) extern "C" FLOAT STRTOF(const char* str, char** nptr) { int sign = *str == '-' ? (str++, -1) : 1; @@ -92,3 +93,4 @@ extern "C" FLOAT STRTOF(const char* str, char** nptr) goto out; } +#endif