Switch over to building everything with i686-elf-g++.

This commit is contained in:
Andreas Kling 2019-02-22 10:45:32 +01:00
parent afa6f88039
commit 75b100673f
Notes: sideshowbarker 2024-07-19 15:38:26 +09:00
17 changed files with 58 additions and 75 deletions

View file

@ -5,19 +5,18 @@ APP = About
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
LDFLAGS = -static
all: $(APP)

View file

@ -6,19 +6,18 @@ APP = FileManager
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
LDFLAGS = -static
all: $(APP)

View file

@ -6,7 +6,6 @@ APP = FontEditor
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
@ -14,11 +13,11 @@ INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
LDFLAGS = -static
all: $(APP)

View file

@ -5,7 +5,6 @@ APP = Launcher
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
@ -13,11 +12,11 @@ INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
LDFLAGS = -static
all: $(APP)

View file

@ -6,7 +6,6 @@ APP = Terminal
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
@ -14,11 +13,11 @@ INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
LDFLAGS = -static
all: $(APP)

View file

@ -66,9 +66,9 @@ BOOTLOADER = Boot/boot.bin
IMAGE = .floppy-image
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
KERNEL_FLAGS = -ffreestanding -fno-stack-protector -fno-builtin
KERNEL_FLAGS =
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -mregparm=3 -march=i686 -m32 -fno-exceptions -fno-rtti
FLAVOR_FLAGS = -mregparm=3 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I.
#SUGGEST_FLAGS = -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override #-Wsuggest-attribute=noreturn
@ -76,9 +76,9 @@ INCLUDE_FLAGS = -I.. -I.
DEFINES = -DSERENITY -DKERNEL -DSANITIZE_PTRS
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections
CXX = ~/opt/cross/bin/i686-elf-g++
LD = ~/opt/cross/bin/i686-elf-ld
LDFLAGS = -T linker.ld
all: $(KERNEL) $(IMAGE) kernel.map

View file

@ -16,8 +16,6 @@ $make_cmd -C ../Applications/Terminal clean && \
$make_cmd -C ../Applications/Terminal && \
$make_cmd -C ../Applications/FontEditor clean && \
$make_cmd -C ../Applications/FontEditor && \
$make_cmd -C ../Applications/Clock clean && \
$make_cmd -C ../Applications/Clock && \
$make_cmd -C ../Applications/Launcher clean && \
$make_cmd -C ../Applications/Launcher && \
$make_cmd -C ../Applications/FileManager clean && \

View file

@ -6,14 +6,6 @@ AK_OBJS = \
../AK/StdLibExtras.o \
../AK/kmalloc.o
SHAREDGRAPHICS_OBJS = \
../SharedGraphics/Painter.o \
../SharedGraphics/Font.o \
../SharedGraphics/Rect.o \
../SharedGraphics/GraphicsBitmap.o \
../SharedGraphics/CharacterBitmap.o \
../SharedGraphics/Color.o
LIBC_OBJS = \
stdio.o \
unistd.o \
@ -49,24 +41,24 @@ LIBC_OBJS = \
ASM_OBJS = setjmp.no
CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS) $(SHAREDGRAPHICS_OBJS)
CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS)
LIBRARY = LibC.a
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
LIBC_FLAGS = -ffreestanding -fno-stack-protector -fno-builtin
LIBC_FLAGS =
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I.
DEFINES = -DSERENITY -DUSERLAND -DSANITIZE_PTRS
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections
LDFLAGS = -T linker.ld
all: $(LIBRARY)

View file

@ -102,7 +102,7 @@ int memcmp(const void* v1, const void* v2, size_t n)
return 0;
}
void* memcpy(void* dest_ptr, const void* src_ptr, dword n)
void* memcpy(void* dest_ptr, const void* src_ptr, size_t n)
{
if (n >= 1024)
return mmx_memcpy(dest_ptr, src_ptr, n);
@ -130,7 +130,7 @@ void* memcpy(void* dest_ptr, const void* src_ptr, dword n)
return dest_ptr;
}
void* memset(void* dest_ptr, int c, dword n)
void* memset(void* dest_ptr, int c, size_t n)
{
dword dest = (dword)dest_ptr;
// FIXME: Support starting at an unaligned address.
@ -293,7 +293,5 @@ char* strpbrk(const char* s, const char* accept)
return nullptr;
}
}

View file

@ -17,7 +17,7 @@ typedef uint32_t uid_t;
typedef uint32_t gid_t;
typedef int16_t pid_t;
typedef uint32_t size_t;
typedef __SIZE_TYPE__ size_t;
typedef int32_t ssize_t;
typedef uint32_t ino_t;

View file

@ -37,19 +37,18 @@ LIBS = ../LibC/LibC.a
LIBRARY = LibGUI.a
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
LIBC_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I../LibC -I.. -I.
DEFINES = -DSERENITY -DUSERLAND -DSANITIZE_PTRS -DLIBGUI
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections
LDFLAGS =
all: $(LIBRARY)

View file

@ -23,11 +23,13 @@ I always wanted to write my own operating system, but I never took it seriously.
## How do I get it to run?
I've only tested this on an Ubuntu 18.10 host with clang, so I'm not sure it works anywhere else. If you'd like to run it, here's how you'd get it to boot:
You need a cross-compiler for the i686-elf target.
I've only tested this on an Ubuntu 18.10 host with GCC, so I'm not sure it works anywhere else.
If you'd like to run it, here's how you'd get it to boot:
cd Kernel
./makeall.sh
sudo ./sync.sh
./run q # Runs in QEMU
./run # Runs in bochs

View file

@ -120,7 +120,7 @@ bool Font::write_to_file(const String& path)
header.glyph_width = m_glyph_width;
header.glyph_height = m_glyph_height;
header.type = 0;
memcpy(header.name, m_name.characters(), min(m_name.length(), 63u));
memcpy(header.name, m_name.characters(), min(m_name.length(), (size_t)63));
size_t bytes_per_glyph = sizeof(unsigned) * m_glyph_height;

View file

@ -71,19 +71,19 @@ APPS = \
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector
USERLAND_FLAGS =
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I. -I../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
LDFLAGS = -static -e _start
all: $(OBJS) $(APPS)

View file

@ -19,7 +19,7 @@ struct GlobalState {
char hostname[32];
pid_t sid;
uid_t uid;
termios termios;
struct termios termios;
bool was_interrupted { false };
};
static GlobalState* g;
@ -159,7 +159,7 @@ static int sh_mp(int, char**)
return 1;
}
printf("mapped file @ %p\n", data);
printf("contents: %c%c%c%c%c%c%c...\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
printf("contents: %c%c%c%c%c%c%c%c...\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
printf("leaving it open :)\n");
return 0;

View file

@ -52,7 +52,7 @@ int show_all()
perror("opendir");
return 1;
}
char pathbuf[256];
char pathbuf[PATH_MAX];
while (auto* de = readdir(dirp)) {
if (de->d_name[0] == '.')

View file

@ -24,17 +24,16 @@ OBJS = $(SHAREDGRAPHICS_OBJS) $(WINDOWSERVER_OBJS)
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I. -I../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = clang
LD = ld
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
CXX = i686-elf-g++
LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections