From f9dcdf5cc985f422949809b25ce9dfdef765abeb Mon Sep 17 00:00:00 2001 From: Curle Date: Wed, 24 Jul 2019 21:50:26 +0100 Subject: [PATCH] Update compiler script. It all works now. \o/ --- compile.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/compile.py b/compile.py index 657735b..3a70b70 100644 --- a/compile.py +++ b/compile.py @@ -15,22 +15,24 @@ HFILES = "-Iinclude/ -Iinclude/reqs/ -Iinclude/bitfont/" OBJECTS = "" with open('c_files.txt') as file: - line = file.readline() + line = file.readline().strip() while line: - line = line[:-3] + line = line[:-2] if line == "kernel\interrupts": print(f'{HFILES}') - subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mgeneral-regs-only', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns="{line}.out"', f'-MT"{line}.o"', '-o', f'{line}.o', f'{line}.c'], shell=True) + subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mgeneral-regs-only', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns={line}.out', f'-MT{line}.o', '-o', f'{line}.o', f'{line}.c'], shell=True) else: print(f'{HFILES}') - subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mavx2', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns="{line}.out"', f'-MT"{line}.o"', '-o', f'{line}.o', f'{line}.c'], shell=True) - OBJECTS = line + ".o" - OBJECTS.replace('\\', '/') - OBJECTS.replace(' ', '') + subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mavx2', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns={line}.out', f'-MT{line}.o', '-o', f'{line}.o', f'{line}.c'], shell=True) + OBJECTS = line + ".o " + + os.path.normpath(OBJECTS) + with open('objects.list', 'a') as objectsfile: - objectsfile.write(OBJECTS) + ofile = OBJECTS.replace('\\', '/') + objectsfile.write(ofile + "\n") - line = file.readline() + line = file.readline().strip() -subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', "-march=skylake", "-mavx2", "-s", "-nostdlib", "-Wl,-e,kernel_main", "-Wl,--dynamicbase,--export-all-symbols", "-Wl,--subsystem,10", "-Wl,-Map=output.map", "-Wl,--gc-sections", "-o \"Sync.exe\"", "@\"objects.list\""]) +subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', "-march=skylake", "-mavx2", "-s", "-nostdlib", "-static-pie", "-Wl,--allow-multiple-definition", "-Wl,-e,kernel_main", "-Wl,--dynamicbase,--export-all-symbols", "-Wl,--subsystem,10", "-Wl,-Map=output.map", "-Wl,--gc-sections", "-o Sync.exe", "@objects.list"])