chore: Fix build process

This commit is contained in:
EnderIce2 2024-11-26 03:27:08 +02:00
parent ce4ebaf6c5
commit 00a37325f6
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
18 changed files with 392 additions and 781 deletions

View File

@ -77,7 +77,7 @@ jobs:
if: steps.cache-cross.outputs.cache-hit != 'true' if: steps.cache-cross.outputs.cache-hit != 'true'
run: | run: |
cd tools cd tools
rm -rf binutils-gdb gcc build-binutils64 build-gcc64 build-binutils32 build-gcc32 rm -rf binutils-gdb gcc
compilegnuefi: compilegnuefi:
name: Build GNU-EFI name: Build GNU-EFI

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ tools/*
!tools/website !tools/website
!tools/Makefile !tools/Makefile
!tools/*.c !tools/*.c
!tools/*.patch
!tools/*.cpp !tools/*.cpp
!tools/*.cfg !tools/*.cfg
!tools/SSDT1.dat !tools/SSDT1.dat

View File

@ -1,5 +1,5 @@
{ {
"C_Cpp.errorSquiggles": "Enabled", "C_Cpp.errorSquiggles": "enabled",
"C_Cpp.autocompleteAddParentheses": true, "C_Cpp.autocompleteAddParentheses": true,
"C_Cpp.codeAnalysis.clangTidy.enabled": true, "C_Cpp.codeAnalysis.clangTidy.enabled": true,
"C_Cpp.clang_format_style": "Visual Studio", "C_Cpp.clang_format_style": "Visual Studio",

View File

@ -1,6 +1,6 @@
BSD 3-Clause License BSD 3-Clause License
Copyright (c) 2022, EnderIce2 Copyright (c) 2024, EnderIce2
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -5,108 +5,6 @@
} }
], ],
"settings": { "settings": {
"debug.allowBreakpointsEverywhere": true, "debug.allowBreakpointsEverywhere": true
"cSpell.words": [
"ABAR",
"ABSPOINTER",
"AHCI",
"BIST",
"Cardbus",
"CFIEN",
"cmdret",
"cmpb",
"driverinfo",
"ECTRL",
"EEPROM",
"Fennix",
"GETVERSION",
"HBAPRDT",
"IFCS",
"inportb",
"inportl",
"inportw",
"INTX",
"KAPI",
"LEDS",
"LPBK",
"LSTA",
"mminb",
"mminl",
"mminq",
"mminw",
"mmioin",
"mmioout",
"mmoutb",
"mmoutl",
"mmoutw",
"NABM",
"NABMB",
"NABMBOFF",
"outportb",
"outportl",
"outportw",
"PCIBAR",
"PCMOUT",
"PCNET",
"PCTRL",
"PMCF",
"PORTHB",
"PRDT",
"Prefetchable",
"RCTL",
"RCTRL",
"RDMTS",
"RDTR",
"rpci",
"RSRPD",
"RTCL",
"RTLC",
"RTLIB",
"RTLIL",
"RTLIW",
"RTLOB",
"RTLOL",
"RTLOW",
"RXDCTL",
"RXDESCHEAD",
"RXDESCHI",
"RXDESCLEN",
"RXDESCLO",
"RXDESCTAIL",
"Sata",
"SATAPI",
"SECRC",
"SEMB",
"SWXOFF",
"tclo",
"TCTL",
"TCTRL",
"TFES",
"TIPG",
"TSAD",
"TSTA",
"TXDESCHEAD",
"TXDESCHI",
"TXDESCLEN",
"TXDESCLO",
"TXDESCTAIL",
"TYPEMATIC",
"ubit",
"Virtio",
"Wmissing"
],
"files.associations": {
"*.su": "tsv",
"driver.h": "c",
"base.h": "c",
"types.h": "c",
"syscall.h": "c",
"aip.h": "c",
"input.h": "c",
"errno.h": "c",
"io.h": "c",
"rtl8139.hpp": "c",
"net.h": "c"
}
} }
} }

View File

@ -6,512 +6,6 @@
], ],
"settings": { "settings": {
"debug.allowBreakpointsEverywhere": true, "debug.allowBreakpointsEverywhere": true,
"files.associations": {
"*.su": "tsv",
"thread": "cpp",
"bitset": "cpp",
"initializer_list": "cpp",
"semaphore": "cpp",
"memory": "cpp",
"limits": "cpp",
"climits": "cpp",
"iterator": "cpp",
"ranges": "cpp",
"cassert": "cpp",
"concepts": "cpp",
"cctype": "cpp",
"tuple": "cpp",
"streambuf": "cpp",
"system_error": "cpp",
"coroutine": "cpp",
"static_vector": "cpp",
"string_view": "cpp",
"compare": "cpp",
"limine.h": "c",
"types.h": "c",
"binfo.h": "c",
"liballoc_1_1.h": "c",
"cstring": "cpp",
"cargs.h": "c",
"memory.hpp": "c",
"convert.h": "c",
"limits.h": "c",
"assert.h": "c",
"cwalk.h": "c",
"md5.h": "c",
"stdint.h": "c",
"debug.h": "c",
"ubsan.h": "c",
"kernel.h": "c",
"filesystem.hpp": "c",
"vector.hpp": "c",
"string.hpp": "c",
"nc.hpp": "c",
"vector": "c",
"task.hpp": "c",
"recovery.hpp": "c",
"symbols.hpp": "c",
"cstddef": "cpp",
"atomic.hpp": "c",
"atomic": "cpp",
"syscalls.h": "c",
"cmath": "cpp",
"typeinfo": "c",
"exception": "cpp",
"errno.h": "c",
"float.h": "c",
"mutex": "cpp",
"type_trails": "cpp",
"utility": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"stdio.h": "c",
"string": "cpp",
"list": "cpp",
"stdexcept": "cpp",
"unistd.h": "c",
"unordered_map": "cpp",
"sched.h": "c",
"mman.h": "c",
"string.h": "c",
"macro.hpp": "c",
"stddef.h": "c",
"cfloat": "c",
"type_traits": "cpp",
"stdlib.h": "c",
"new": "cpp",
"ostream": "cpp",
"iostream": "cpp",
"istream": "cpp",
"ios": "cpp",
"locale": "cpp",
"unwind.h": "c",
"memory.h": "c",
"physical.hpp": "c",
"swap_pt.hpp": "c",
"brk.hpp": "c",
"bitmap.hpp": "c",
"lock.hpp": "c",
"virtual.hpp": "c",
"table.hpp": "c",
"vma.hpp": "c",
"abi.h": "c",
"kstack.hpp": "c",
"stack.hpp": "c",
"optional": "cpp"
},
"cSpell.words": [
"AABBCC",
"AAFF",
"AAFFAA",
"ABAR",
"ABIVERSION",
"ABSPOINTER",
"ACPI",
"ACPINVS",
"addralign",
"AEFF",
"AFAFAF",
"AHBA",
"AHCI",
"ALTLBA",
"APERF",
"apic",
"APICID",
"archaux",
"AROS",
"ARRAYSZ",
"auxv",
"BABABA",
"BADRAM",
"BGRT",
"bimi",
"binfo",
"biosdev",
"BIST",
"BITALG",
"BLOCKDEV",
"BLOCKDEVICE",
"BNDCFGS",
"bochs",
"bootanim",
"bootdev",
"Bootloader",
"brontobyte",
"CACACA",
"calloc",
"Cardbus",
"CCCCCCCPU",
"CHARDEV",
"CHARDEVICE",
"charsize",
"clac",
"CLOUDABI",
"CMCI",
"CMOS",
"cntvct",
"COMNULL",
"copydoc",
"cpudata",
"CPUID",
"crashdata",
"CSTAR",
"CTLS",
"cutlim",
"DADADA",
"daif",
"daifclr",
"daifset",
"DAPI",
"DBGP",
"DEBUGCTL",
"defragment",
"dfdesc",
"dialup",
"Didx",
"DLAB",
"Drivermemcpy",
"Drivermemset",
"Driversprintf",
"drvdir",
"DRVER",
"DSDT",
"DUID",
"dynstr",
"dynsym",
"EBDA",
"edid",
"EEPROM",
"EFER",
"Ehdr",
"ehsize",
"EISA",
"ELFABI",
"ELFCLASS",
"ELFDATA",
"ELFMAG",
"ELFOSABI",
"EMMINTRIN",
"endregion",
"Ensoniq",
"EVTSEL",
"EXECFN",
"exobyte",
"EXTD",
"FADT",
"FAFAFA",
"FAFAFAI",
"Fargc",
"Fargv",
"fcreat",
"fctprintf",
"Femto",
"FENIXOS",
"FENNIX",
"FFAA",
"FFAAAA",
"FFSMBIOS",
"FFXSR",
"filestatus",
"FMAPS",
"fonthdr",
"Framebuffer",
"FSGSBASE",
"fsmi",
"fxrstor",
"fxsave",
"Gamepad",
"Gameport",
"geopbyte",
"GETVERSION",
"GFNI",
"haddpd",
"headersize",
"HIPROC",
"HPET",
"hwaddress",
"ICRHI",
"ICRLO",
"IDIV",
"idtd",
"IFHLNK",
"infloop",
"inportb",
"inportl",
"inportw",
"INTFASTX",
"INTLEASTX",
"INTX",
"invlpg",
"ioapic",
"ioapicirq",
"IOCTLFS",
"IPCID",
"IRET",
"iretq",
"isdelim",
"ishld",
"ishst",
"itimerspec",
"itrfb",
"JMPREL",
"KAPI",
"KAPIPCI",
"kcalloc",
"kcon",
"kdentry",
"kdirent",
"kernelctl",
"kfree",
"klog",
"kmalloc",
"kproc",
"krealloc",
"kthrd",
"lapic",
"lfanew",
"LFLR",
"lgdt",
"liballoc",
"LIBLIST",
"lidt",
"limine",
"LMSLE",
"LOPROC",
"lsacpi",
"LSTAR",
"MADT",
"MADTIO",
"malloc",
"MCFG",
"memdbg",
"memmap",
"memsz",
"MEMTEST",
"mfence",
"MIDR",
"mminb",
"mminl",
"mminq",
"mminw",
"mmioin",
"mmioout",
"mmoutb",
"mmoutl",
"mmoutq",
"mmoutw",
"modbg",
"Modulememcpy",
"Modulememset",
"Modulesprintf",
"movaps",
"movddup",
"movdqa",
"movdqu",
"movntdq",
"movntdqa",
"movw",
"MPERF",
"MSRID",
"MTRR",
"MTRRCAP",
"multiboot",
"MWAIT",
"newfstatat",
"NIDENT",
"NOBITS",
"nullfd",
"nullptr",
"objptr",
"OEMID",
"Ofast",
"okstat",
"oldfd",
"OPENVOS",
"OPTMZ",
"OSABI",
"OSFXSR",
"OSXMMEXCPT",
"OSXSAVE",
"Outof",
"outportb",
"outportl",
"outportw",
"PAGESZ",
"palignr",
"PCIDE",
"pcmpistri",
"PCNET",
"PDBR",
"PDPTE",
"PEBS",
"PERFEVTSEL",
"PEXIT",
"PFLA",
"Phdrs",
"pheader",
"PHENT",
"phentsize",
"phnum",
"phoff",
"PHYSBASE",
"PHYSMASK",
"Pico",
"PINBASED",
"Pipefd",
"PKRU",
"PLTGOT",
"PLTREL",
"PLTRELSZ",
"POPCNT",
"PORTHB",
"powerline",
"Prefetchable",
"PREINIT",
"PROCBASED",
"PROGBITS",
"PTMX",
"ptys",
"pushfl",
"pushfq",
"Raphson",
"RARP",
"RBSTART",
"rdmsr",
"RDRAND",
"rdseed",
"rdtsc",
"readcr",
"readxcr",
"realloc",
"Realtek",
"RELAENT",
"RELASZ",
"RELSZ",
"Rodata",
"RPCI",
"rpmalloc",
"RRGGBB",
"RSDP",
"RSDT",
"RTIT",
"SATA",
"schedbg",
"SERCOS",
"serialports",
"sfence",
"sgdt",
"SGXLEPUBKEYHASH",
"Shdr",
"Sheader",
"shentsize",
"shnum",
"shoff",
"showbuf",
"shstrndx",
"shstrtab",
"sidt",
"SIGCOMP",
"sigsetsize",
"SIVR",
"SMAP",
"SMBASE",
"SMBIOSBIOS",
"SMEP",
"SMRR",
"SMXE",
"SNTP",
"SRAT",
"SSDT",
"sspt",
"SSSE",
"stac",
"strdbg",
"STRSZ",
"SVME",
"swapgs",
"Symbios",
"SYMENT",
"SYSENTER",
"sysret",
"sysretq",
"Tamsyn",
"targp",
"TCCR",
"TCLO",
"TCPA",
"TDCR",
"TEXIT",
"TEXTREL",
"Thrd",
"TICR",
"tlbi",
"Touchpad",
"tracepagetable",
"tskdbg",
"ttbr",
"uarch",
"uartmemdmp",
"ubsan",
"UINTFASTX",
"UINTLEASTX",
"UINTX",
"ultoa",
"UMIP",
"UMWAIT",
"UNMAP",
"Unmaskable",
"Unreserving",
"unseek",
"Unswap",
"unsynchronized",
"UPDT",
"UPID",
"uroot",
"UTID",
"VAES",
"VBMI",
"vectorize",
"vfctprintf",
"vfsdbg",
"Vidx",
"Virtio",
"VMCS",
"VMFUNC",
"vmouse",
"VMXE",
"VNNI",
"VNNIW",
"VPCLMULQDQ",
"VPID",
"VPOKE",
"VPOPCNTDQ",
"WAET",
"weakrefalias",
"Wignored",
"Wmissing",
"writecr",
"writexcr",
"wrmsr",
"WWVB",
"WWVH",
"Xalloc",
"xallocv",
"Xclac",
"xgetbv",
"Xmemcpy",
"Xmemset",
"XSDT",
"Xsize",
"XSLC",
"XSLF",
"XSLM",
"XSLR",
"Xstac",
"Xuintptr",
"yottabyte",
"zettabyte"
],
"editor.tabCompletion": "on", "editor.tabCompletion": "on",
"diffEditor.codeLens": true, "diffEditor.codeLens": true,
"editor.quickSuggestionsDelay": 100, "editor.quickSuggestionsDelay": 100,
@ -529,4 +23,4 @@
"editor.cursorStyle": "line", "editor.cursorStyle": "line",
"editor.cursorWidth": 2 "editor.cursorWidth": 2
} }
} }

View File

@ -5,18 +5,6 @@
} }
], ],
"settings": { "settings": {
"debug.allowBreakpointsEverywhere": true, "debug.allowBreakpointsEverywhere": true
"files.associations": {
"*.su": "tsv",
"limine.h": "c"
},
"cSpell.words": [
"Bootloader",
"COMNULL",
"CPUID",
"FENNIX",
"JMPREL",
"UBSAN"
]
} }
} }

View File

@ -5,67 +5,6 @@
} }
], ],
"settings": { "settings": {
"debug.allowBreakpointsEverywhere": true, "debug.allowBreakpointsEverywhere": true
"files.associations": {
"*.su": "tsv",
"thread": "cpp",
"bitset": "cpp",
"initializer_list": "cpp",
"fex.hpp": "c",
"types.h": "c",
"dlfcn.h": "c",
"aux.h": "c",
"stddef.h": "c",
"stdio.h": "c",
"syscalls.h": "c",
"syslib.h": "c",
"sysfile.h": "c",
"ipc.h": "c",
"sysbase.h": "c",
"inttypes.h": "c",
"doomkeys.h": "c",
"doomgeneric.h": "c",
"elf.h": "c",
"init.h": "c",
"unused_code": "cpp",
"liballoc_1_1.h": "c",
"errno.h": "c",
"stdlib.h": "c",
"stdarg.h": "c",
"printf.h": "c",
"ctype.h": "c",
"unistd.h": "c",
"stat.h": "c",
"wait.h": "c",
"base.h": "c",
"ld.h": "c",
"syscall.h": "c",
"stdint.h": "c",
"setjmp.h": "c",
"limits.h": "c",
"fcntl.h": "c",
"pty.h": "c",
"string.h": "c",
"time.h": "c",
"reboot.h": "c",
"*.in": "c",
"signal.h": "c",
"alltypes.h": "c",
"pr44328.C": "cpp"
},
"cSpell.words": [
"auxv",
"cmpq",
"FENNIX",
"JMPREL",
"Krnl",
"liballoc",
"libinit",
"oldpath",
"preinit",
"Shdr",
"vfctprintf",
"WAITSTATUS"
]
} }
} }

View File

@ -5,31 +5,6 @@
} }
], ],
"settings": { "settings": {
"debug.allowBreakpointsEverywhere": true, "debug.allowBreakpointsEverywhere": true
"files.associations": {
"*.su": "tsv",
"thread": "cpp",
"bitset": "cpp",
"initializer_list": "cpp",
"semaphore": "cpp",
"memory": "cpp",
"limits": "cpp",
"climits": "cpp",
"iterator": "cpp",
"ranges": "cpp",
"cassert": "cpp",
"concepts": "cpp",
"cctype": "cpp",
"tuple": "cpp",
"streambuf": "cpp",
"system_error": "cpp",
"coroutine": "cpp",
"static_vector": "cpp",
"string_view": "cpp",
"compare": "cpp",
"ostream": "cpp",
"unordered_map": "cpp",
"vector": "cpp"
}
} }
} }

View File

@ -1,6 +1,6 @@
BSD 3-Clause License BSD 3-Clause License
Copyright (c) 2022, EnderIce2 Copyright (c) 2024, EnderIce2
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,6 @@
BSD 3-Clause License BSD 3-Clause License
Copyright (c) 2022, EnderIce2 Copyright (c) 2024, EnderIce2
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -19,7 +19,7 @@ KERNEL_VERSION = dev
BOOTLOADER = grub BOOTLOADER = grub
BUILD_KERNEL = 1 BUILD_KERNEL = 1
BUILD_USERSPACE = 1 #BUILD_USERSPACE = 1
BUILD_DRIVERS = 1 BUILD_DRIVERS = 1
QUIET_BUILD = 1 QUIET_BUILD = 1

View File

@ -1,6 +1,6 @@
BSD 3-Clause License BSD 3-Clause License
Copyright (c) 2023, EnderIce2 Copyright (c) 2024, EnderIce2
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -30,23 +30,6 @@ ifeq ($(DEBUG), 1)
MUSL_CONFIGURE_FLAGS += --enable-debug MUSL_CONFIGURE_FLAGS += --enable-debug
endif endif
build_musl:
ifeq ($(wildcard cache/musl),)
mkdir -p cache/musl
cd cache/musl && \
../../musl/configure --prefix=$(PREFIX) \
--target=$(TARGET) --includedir=$(PREFIX)/include \
$(MUSL_CONFIGURE_FLAGS)
make -C cache/musl -j$(shell nproc)
endif
$(info Installing musl libc)
cd cache/musl && make TARGET=$(TARGET) install
# cp out/lib/crt1.o out/lib/crt0.o
cd out/lib && ln -s /lib/libc.so ./ld-musl-x86_64.so.1 && \
ln -s /lib/libc.so ./ld.so
mkdir -p out/include/fennix
cp ../Kernel/include/interface/syscalls.h out/include/fennix/syscall.h
create_out: create_out:
rm -rf out rm -rf out
mkdir -p out mkdir -p out
@ -60,11 +43,7 @@ create_out:
mkdir -p out/usr/include mkdir -p out/usr/include
build: create_out build: create_out
ifeq ($(USE_LIBC), internal)
make -C libc build make -C libc build
else ifeq ($(USE_LIBC), musl)
$(MAKE) build_musl
endif
make -C libs build make -C libs build
make -C apps build make -C apps build

@ -1 +0,0 @@
Subproject commit 718f363bc2067b6487900eddc9180c84e7739f80

View File

@ -4,79 +4,133 @@ export PATH := $(CROSS_DIR):$(PATH)
QEMU_VERSION = 8.1.2 QEMU_VERSION = 8.1.2
all: do_rep do_ep do_limine clone_all do_binutils_64 do_gcc_64 do_binutils_32 do_gcc_32 do_qemu all: do_tools do_limine __clone_all do_binutils_64 do_gcc_64 do_binutils_32 do_gcc_32 do_qemu
clean: clean:
rm -f rep ep fex rm -f rep ep
do_rep: do_tools:
gcc -w ReadEthernetPackets.c -o rep gcc -w ReadEthernetPackets.c -o rep
chmod +x rep
do_ep:
g++ -w ErrorParser.cpp -o ep g++ -w ErrorParser.cpp -o ep
chmod +x rep
chmod +x ep chmod +x ep
do_limine: do_limine:
git clone https://github.com/limine-bootloader/limine.git --branch=v6.x-branch-binary --depth=1 ifeq ("$(wildcard ./limine)", "")
git clone https://github.com/limine-bootloader/limine.git --branch=v6.x-branch-binary --depth=1 limine
else
$(info > TOOLS: Skipping cloning limine because directory already exists.)
endif
__clone_qemu: __clone_qemu:
ifeq ("$(wildcard ./qemu)", "")
wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz
tar xvJf qemu-${QEMU_VERSION}.tar.xz tar xvJf qemu-${QEMU_VERSION}.tar.xz
rm -f qemu-${QEMU_VERSION}.tar.xz rm -f qemu-${QEMU_VERSION}.tar.xz
mv qemu-${QEMU_VERSION} qemu mv qemu-${QEMU_VERSION} qemu
else
$(info > TOOLS: Skipping cloning qemu because directory already exists.)
endif
__clone_all_no_qemu: .PHONY: all clean __clone_binutils __clone_gcc __prep_cross __patch_cross __patch_cross_binutils __patch_cross_gcc
git clone -b binutils-2_42-branch --single-branch https://github.com/Fennix-Project/binutils-gdb.git binutils-gdb
git clone -b releases/gcc-13 --single-branch https://github.com/Fennix-Project/gcc.git gcc __clone_binutils:
cd gcc && $(shell ./contrib/download_prerequisites) ifeq ("$(wildcard ./binutils-gdb)", "")
git clone --depth 1 -b binutils-2_43_1 --single-branch git://sourceware.org/git/binutils-gdb.git binutils-gdb
else
$(info > TOOLS: Reseting binutils-gdb...)
cd binutils-gdb && \
git fetch origin && \
git reset --hard binutils-2_43_1 && \
git clean -dfx
$(info > TOOLS: Operation completed for binutils-gdb)
endif
__clone_gcc:
ifeq ("$(wildcard ./gcc)", "")
git clone --depth 1 -b releases/gcc-14.2.0 --single-branch git://gcc.gnu.org/git/gcc.git gcc
else
$(info > TOOLS: Reseting gcc...)
cd gcc && \
git fetch origin && \
git reset --hard releases/gcc-14.2.0 && \
git clean -dfx
$(info > TOOLS: Operation completed for gcc)
endif
__patch_cross_binutils: __clone_binutils
$(info > TOOLS: Patching binutils-gcc)
cd binutils-gdb && git apply ../binutils-gdb.patch
$(info > TOOLS: Running automake for binutils-gdb/ld)
cd binutils-gdb/ld && automake
__patch_cross_gcc: __clone_gcc
$(info > TOOLS: Patching gcc)
cd gcc && git apply ../gcc.patch
cd gcc && ./contrib/download_prerequisites
$(info > TOOLS: Running autoconf for gcc/libstdc++-v3)
cd gcc/libstdc++-v3 && autoconf
__patch_cross: __patch_cross_binutils __patch_cross_gcc
__prep_cross:
mkdir -p cross mkdir -p cross
mkdir -p build-binutils64 mkdir -p binutils-gdb/__build
mkdir -p build-gcc64 mkdir -p gcc/__build
mkdir -p build-binutils32
mkdir -p build-gcc32
clone_all: __clone_qemu __clone_all_no_qemu __clone_all_no_qemu: __clone_binutils __clone_gcc
do_qemu: __clone_all: __clone_qemu __clone_all_no_qemu
do_qemu: __prep_cross
cd qemu && \ cd qemu && \
bash ./configure --target-list=x86_64-softmmu,i386-softmmu,aarch64-softmmu \ bash ./configure --target-list=x86_64-softmmu,i386-softmmu,aarch64-softmmu \
--prefix="$(CROSS_DIR)" \ --prefix="$(CROSS_DIR)" \
--enable-gtk --disable-tools \ --enable-gtk --disable-tools \
--disable-gio --disable-virtfs --disable-vnc \ --disable-gio --disable-virtfs --disable-vnc \
--disable-opengl && \ --disable-opengl && \
make -j$(shell nproc) && make install make --quiet -j$(shell nproc) && make --quiet install
do_binutils_64: do_binutils_64:
cd build-binutils64 && \ $(MAKE) __patch_cross_binutils
../binutils-gdb/configure --target=x86_64-fennix \ $(MAKE) __prep_cross
--prefix="$(CROSS_DIR)" --disable-nls \ cd binutils-gdb/__build && \
../configure --target=x86_64-fennix \
--prefix="$(CROSS_DIR)" --disable-nls --quiet \
--with-sysroot --enable-shared --disable-werror && \ --with-sysroot --enable-shared --disable-werror && \
make all -j$(shell nproc) && make install make --quiet all -j$(shell nproc) && \
make --quiet install
do_gcc_64: do_gcc_64:
cd build-gcc64 && \ $(MAKE) __patch_cross_gcc
../gcc/configure --target=x86_64-fennix \ $(MAKE) __prep_cross
cd gcc/__build && \
../configure --target=x86_64-fennix --quiet \
--prefix="$(CROSS_DIR)" --disable-nls --enable-default-pie \ --prefix="$(CROSS_DIR)" --disable-nls --enable-default-pie \
--enable-languages=c,c++ --enable-shared --without-headers && \ --enable-languages=c,c++ --enable-shared --without-headers && \
make all-gcc -j$(shell nproc) && \ make --quiet all-gcc -j$(shell nproc) && \
make all-target-libgcc -j$(shell nproc) && \ make --quiet all-target-libgcc -j$(shell nproc) && \
make install-gcc -j$(shell nproc) && \ make --quiet install-gcc -j$(shell nproc) && \
make install-target-libgcc -j$(shell nproc) make --quiet install-target-libgcc -j$(shell nproc)
do_binutils_32: do_binutils_32:
cd build-binutils32 && \ $(MAKE) __patch_cross_binutils
../binutils-gdb/configure --target=i386-fennix \ $(MAKE) __prep_cross
--prefix="$(CROSS_DIR)" --disable-nls \ cd binutils-gdb/__build && \
../configure --target=i386-fennix \
--prefix="$(CROSS_DIR)" --disable-nls --quiet \
--with-sysroot --enable-shared --disable-werror && \ --with-sysroot --enable-shared --disable-werror && \
make all -j$(shell nproc) && make install make --quiet all -j$(shell nproc) && \
make --quiet install
do_gcc_32: do_gcc_32:
cd build-gcc32 && \ $(MAKE) __patch_cross_gcc
../gcc/configure --target=i386-fennix \ $(MAKE) __prep_cross
cd gcc/__build && \
../configure --target=i386-fennix --quiet \
--prefix="$(CROSS_DIR)" --disable-nls --enable-default-pie \ --prefix="$(CROSS_DIR)" --disable-nls --enable-default-pie \
--enable-languages=c,c++ --enable-shared --without-headers && \ --enable-languages=c,c++ --enable-shared --without-headers && \
make all-gcc -j$(shell nproc) && \ make --quiet all-gcc -j$(shell nproc) && \
make all-target-libgcc -j$(shell nproc) && \ make --quiet all-target-libgcc -j$(shell nproc) && \
make install-gcc -j$(shell nproc) && \ make --quiet install-gcc -j$(shell nproc) && \
make install-target-libgcc -j$(shell nproc) make --quiet install-target-libgcc -j$(shell nproc)

127
tools/binutils-gdb.patch Normal file
View File

@ -0,0 +1,127 @@
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6553aac1e99..40429e9bf43 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -1502,6 +1502,20 @@ case "${targ}" in
;;
#endif
+ i[3-7]86-*-fennix*)
+ targ_defvec=i386_elf32_vec
+ targ_selvecs=
+ targ64_selvecs=x86_64_elf64_vec
+ ;;
+
+#ifdef BFD64
+ x86_64-*-fennix*)
+ targ_defvec=x86_64_elf64_vec
+ targ_selvecs=i386_elf32_vec
+ want64=true
+ ;;
+#endif
+
# END OF targmatch.h
bpf-*-*)
echo "*** Configuration $targ is not fully supported." >&2
diff --git a/config.sub b/config.sub
index 2c6a07ab3c3..d279b50dc8b 100755
--- a/config.sub
+++ b/config.sub
@@ -1768,7 +1768,7 @@ case $os in
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
- | fiwix* | mlibc* | cos* | mbr* | ironclad* )
+ | fiwix* | mlibc* | cos* | mbr* | ironclad* | fennix* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff --git a/gas/configure.tgt b/gas/configure.tgt
index d58f21873a3..fa4215b9cff 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -267,6 +267,7 @@ case ${generic_target} in
i386-*-*nt*) fmt=coff em=pe ;;
i386-*-rdos*) fmt=elf ;;
i386-*-darwin*) fmt=macho ;;
+ i386-*-fennix*) fmt=elf em=gnu ;;
ia16-*-elf*) fmt=elf ;;
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 6a9833e5775..fb4f866ef55 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -279,6 +279,7 @@ ALL_EMULATION_SOURCES = \
eelf_i386.c \
eelf_i386_be.c \
eelf_i386_fbsd.c \
+ eelf_i386_fennix.c \
eelf_i386_haiku.c \
eelf_i386_ldso.c \
eelf_i386_sol2.c \
@@ -463,6 +464,7 @@ ALL_64_EMULATION_SOURCES = \
eelf_x86_64.c \
eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
+ eelf_x86_64_fennix.c \
eelf_x86_64_haiku.c \
eelf_x86_64_sol2.c \
ehppa64linux.c \
diff --git a/ld/configure.tgt b/ld/configure.tgt
index f937f78b876..ea5491a1447 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -409,6 +409,11 @@ i[3-7]86-*-elf* | i[3-7]86-*-rtems* | i[3-7]86-*-genode*)
i[3-7]86-*-dragonfly*) targ_emul=elf_i386
targ_extra_emuls="elf_iamcu i386bsd"
;;
+i[3-7]86-*-fennix*)
+ targ_emul=elf_i386_fennix
+ targ_extra_emuls=elf_i386
+ targ64_extra_emuls="elf_x86_64_fennix elf_x86_64"
+ ;;
i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_emul=elf_i386_fbsd
targ_extra_emuls="elf_i386 elf_iamcu i386bsd"
@@ -1045,6 +1050,9 @@ x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*)
x86_64-*-dragonfly*) targ_emul=elf_x86_64
targ_extra_emuls="elf_i386 elf_iamcu"
;;
+x86_64-*-fennix*) targ_emul=elf_x86_64_fennix
+ targ_extra_emuls="elf_i386_fennix elf_x86_64 elf_i386"
+ ;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_emul=elf_x86_64_fbsd
targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386 elf_iamcu"
@@ -1112,6 +1120,10 @@ case "${target}" in
NATIVE_LIB_DIRS='/lib /usr/lib /usr/pkg/lib /usr/local/lib'
;;
+*-*-fennix*)
+ NATIVE_LIB_DIRS='/lib /usr/lib'
+ ;;
+
*-*-freebsd*)
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
;;
diff --git a/ld/emulparams/elf_i386_fennix.sh b/ld/emulparams/elf_i386_fennix.sh
new file mode 100644
index 00000000000..19b75a06cf9
--- /dev/null
+++ b/ld/emulparams/elf_i386_fennix.sh
@@ -0,0 +1,4 @@
+source_sh ${srcdir}/emulparams/elf_i386.sh
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+TEXT_START_ADDR=0x400000
diff --git a/ld/emulparams/elf_x86_64_fennix.sh b/ld/emulparams/elf_x86_64_fennix.sh
new file mode 100644
index 00000000000..1509ec7fe53
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_fennix.sh
@@ -0,0 +1,4 @@
+source_sh ${srcdir}/emulparams/elf_x86_64.sh
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+TEXT_START_ADDR=0x400000

157
tools/gcc.patch Normal file
View File

@ -0,0 +1,157 @@
diff --git a/config.sub b/config.sub
index 38f3d037a78..e15a98ae991 100755
--- a/config.sub
+++ b/config.sub
@@ -1749,7 +1749,7 @@ case $os in
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
- | fiwix* )
+ | fiwix* | fennix* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 95c91ee02be..2f3e3b006dd 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -825,6 +825,14 @@ case ${target} in
rust_target_objs="${rust_target_objs} dragonfly-rust.o"
target_has_targetrustm=yes
;;
+*-*-fennix*)
+ tmake_file="t-fennix "
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ use_gcc_stdint=provide
+ native_system_header_dir=/include
+ ;;
*-*-freebsd*)
# This is the generic ELF configuration of FreeBSD. Later
# machine-specific sections may refine and add to this
@@ -1981,6 +1989,14 @@ x86_64-*-openbsd*)
gas=yes
gnu_ld=yes
;;
+i[34567]86-*-fennix*)
+ tmake_file="${tmake_file} i386/t-fennix"
+ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h glibc-stdint.h i386/i386elf.h fennix.h"
+ ;;
+x86_64-*-fennix*)
+ tmake_file="${tmake_file} i386/t-fennix"
+ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h fennix.h"
+ ;;
i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
# Intel 80386's running GNU/*
# with ELF format using glibc 2
diff --git a/gcc/config/fennix.h b/gcc/config/fennix.h
new file mode 100644
index 00000000000..3739abe7983
--- /dev/null
+++ b/gcc/config/fennix.h
@@ -0,0 +1,59 @@
+
+#undef TARGET_FENNIX
+#define TARGET_FENNIX 1
+
+#undef LIB_SPEC
+#define LIB_SPEC "-lc"
+
+#undef CPP_SPEC
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+ "crti.o%s \
+ %{!shared: \
+ %{!static: \
+ crtbeginS.o%s Scrt1.o%s \
+ } \
+ } \
+ %{static:crtbegin.o%s crt1.o%s}"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+ "crtn.o%s \
+ %{!shared: \
+ %{!static: \
+ crtendS.o%s \
+ } \
+ } \
+ %{static:crtend.o%s}"
+
+#undef STANDARD_STARTFILE_PREFIX
+#define STANDARD_STARTFILE_PREFIX "/lib/"
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{shared:-shared} \
+ %{static:-static} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ } \
+ } \
+ %{!static: \
+ %{!dynamic-linker: \
+ -dynamic-linker=/lib/ld.so \
+ } \
+ } \
+ -z max-page-size=4096"
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define("__fennix__"); \
+ builtin_define("__unix__"); \
+ builtin_assert("system=fennix"); \
+ builtin_assert("system=unix"); \
+ builtin_assert("system=posix"); \
+ } while (0);
diff --git a/gcc/config/i386/t-fennix b/gcc/config/i386/t-fennix
new file mode 100644
index 00000000000..8223e63c0c9
--- /dev/null
+++ b/gcc/config/i386/t-fennix
@@ -0,0 +1,2 @@
+MULTILIB_OPTIONS += mno-red-zone
+MULTILIB_DIRNAMES += no-red-zone
diff --git a/libgcc/config.host b/libgcc/config.host
index e75a7af647f..12ecba7be60 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -760,6 +760,14 @@ x86_64-*-dragonfly*)
tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
md_unwind_header=i386/dragonfly-unwind.h
;;
+i[34567]86-*-fennix*)
+ extra_parts="$extra_parts crti.o crtn.o crtbegin.o crtend.o crtbeginS.o crtendS.o"
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
+x86_64-*-fennix*)
+ extra_parts="$extra_parts crti.o crtn.o crtbegin.o crtend.o crtbeginS.o crtendS.o"
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
i[34567]86-*-freebsd*)
tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
md_unwind_header=i386/freebsd-unwind.h
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index b3269cb88e0..de1f886b9a6 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -88,6 +88,13 @@ case "${host}" in
AC_DEFINE(HAVE_HYPOT)
;;
+ *-fennix*)
+ GLIBCXX_CHECK_COMPILER_FEATURES
+ GLIBCXX_CHECK_LINKER_FEATURES
+ GLIBCXX_CHECK_MATH_SUPPORT
+ GLIBCXX_CHECK_STDLIB_SUPPORT
+ ;;
+
*-freebsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
AC_SUBST(SECTION_FLAGS)