Index: kernel/arch/amd64/meson.build
===================================================================
--- kernel/arch/amd64/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/amd64/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -27,18 +27,4 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-
-# TODO: Red Zone is only a problem if we allow interrupts to land on an active
-#       stack. Using separate stack for interrupts and ensuring that we never
-#       enable interrupts on an interrupt stack would allow us to get rid of
-#       the argument.
-
-kernel_c_args += [ '-mno-sse', '-mno-sse2', '-mcmodel=' + MEMORY_MODEL, '-mno-red-zone', '-fno-unwind-tables', '-fno-omit-frame-pointer' ]
-
-# TODO: fix this
-kernel_link_args += [ '-Wl,--no-gc-sections' ]
-
-if PROCESSOR == 'opteron'
-	kernel_c_args += '-march=opteron'
-endif
 
 arch_src += files(
Index: kernel/arch/arm32/meson.build
===================================================================
--- kernel/arch/arm32/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/arm32/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -26,15 +26,4 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-
-
-atsign = '%'
-
-kernel_c_args += [ '-fno-omit-frame-pointer', '-mapcs-frame', '-mno-unaligned-access', '-mfpu=vfpv3' ]
-
-if CONFIG_FPU
-	# This is necessary to allow vmsr insn and fpexc manipulation
-	# Use vfp32 to allow context save/restore of d16-d31 regs.
-	kernel_c_args += [ '-mfloat-abi=hard' ]
-endif
 
 arch_src += files(
Index: kernel/arch/arm64/meson.build
===================================================================
--- kernel/arch/arm64/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/arm64/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -26,6 +26,4 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-
-kernel_c_args += [ '-fno-omit-frame-pointer', '-march=armv8-a+nofp+nosimd', '-mgeneral-regs-only' ]
 
 arch_src += files(
Index: kernel/arch/ia32/meson.build
===================================================================
--- kernel/arch/ia32/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/ia32/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -26,9 +26,4 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-
-kernel_c_args += [ '-mno-mmx', '-mno-sse', '-mno-sse2', '-mno-sse3', '-mno-3dnow' ]
-
-# TODO: fix this
-kernel_link_args += [ '-Wl,--no-gc-sections' ]
 
 arch_src += files(
Index: kernel/arch/ia64/meson.build
===================================================================
--- kernel/arch/ia64/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/ia64/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -27,7 +27,4 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-
-kernel_c_args += [ '-mconstant-gp', '-fno-unwind-tables', '-mfixed-range=f32-f127' ]
-kernel_link_args += [ '-Wl,-EL' ]
 
 arch_src += files(
@@ -60,7 +57,4 @@
 endif
 
-if MACHINE == 'i460GX'
-	kernel_c_args += [ '-DI460GX' ]
-endif
 
 _check_headers = [
Index: kernel/arch/mips32/meson.build
===================================================================
--- kernel/arch/mips32/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/mips32/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -26,14 +26,4 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-
-kernel_c_args += [
-	'-msoft-float',
-	'-mno-abicalls',
-	'-G', '0',
-	'-fno-zero-initialized-in-bss',
-	'-mabi=32',
-]
-
-as_prolog = '.module softfloat;'
 
 arch_src += files(
@@ -71,4 +61,5 @@
 endif
 
+
 _check_headers = [
 	'include/arch/istate_struct.h',
Index: kernel/arch/ppc32/meson.build
===================================================================
--- kernel/arch/ppc32/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/ppc32/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -27,8 +27,4 @@
 #
 
-# FIXME: enable gc-sections
-kernel_c_args += [ '-msoft-float', '-fno-function-sections' ]
-kernel_link_args += [ '-Wl,--no-check-sections', '-Wl,--no-gc-sections' ]
-
 arch_src += files(
 	'src/context.S',
@@ -54,4 +50,5 @@
 )
 
+
 _check_headers = [
 	'include/arch/istate_struct.h',
Index: kernel/arch/riscv64/meson.build
===================================================================
--- kernel/arch/riscv64/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/arch/riscv64/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -27,6 +27,4 @@
 #
 
-kernel_c_args += [ '-mcmodel=medany' ]
-
 arch_src += files(
 	'src/boot/boot.S',
@@ -49,4 +47,5 @@
 )
 
+
 _check_headers = [
 	'include/arch/istate_struct.h',
Index: kernel/genarch/meson.build
===================================================================
--- kernel/genarch/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/genarch/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -164,5 +164,4 @@
 
 genarch_src = []
-genarch_check_headers = []
 
 foreach f : _src
Index: kernel/meson.build
===================================================================
--- kernel/meson.build	(revision 2c38a55b26e626af124660c860fe4f936f614b31)
+++ kernel/meson.build	(revision 63660a336967f7913b801317917bd93b4fb20796)
@@ -1,24 +1,15 @@
 
-## The at-sign
-#
-# The `atsign` variable holds the ASCII character representing the at-sign
-# ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
-# don't use '@' for starting a comment, `atsign` is merely '@'. However, on
-# those that do use it for starting a comment (e.g. arm32), `atsign` must be
-# defined as the percentile-sign ('%') in the architecture-dependent files.
-#
-atsign = '@'
-
-## Some architectures need a particular string at the beginning of assembly files.
-as_prolog = ''
-
-kernel_c_args = []
-kernel_link_args = []
-kernel_includes = []
 arch_src = []
 
+# Fills arch_src.
 subdir('arch' / h_arch)
+
+# Defines genarch_src.
 subdir('genarch')
+
+# Defines generic_src, instrumentable_src.
 subdir('generic')
+
+# Defines test_src
 subdir('test')
 
@@ -27,5 +18,5 @@
 symtab_section = '.section symtab.data, "a", ' + atsign + 'progbits;'
 
-kernel_includes += include_directories(
+kernel_include_dirs = include_directories(
 	'generic/include',
 	'genarch/include',
@@ -46,4 +37,5 @@
 ]
 
+# Preprocess linker script using C preprocessor.
 kernel_ldscript = custom_target('_link.ld',
 	input: 'arch' / h_arch / '_link.ld.in',
@@ -63,5 +55,5 @@
 )
 
-kernel_link_args += [
+kernel_link_args = arch_kernel_link_args + [
 	'-Wl,--nmagic',
 	'-T', meson.current_build_dir() / '_link.ld',
@@ -73,5 +65,5 @@
 endif
 
-kernel_c_args += kernel_defs + [
+kernel_c_args = arch_kernel_c_args + kernel_defs + [
 	'-ffreestanding',
 	# TODO: remove this flag
@@ -88,5 +80,5 @@
 
 instrumentables = static_library('instrumentables', instrumentable_src,
-	include_directories: kernel_includes,
+	include_directories: kernel_include_dirs,
 	implicit_include_directories: false,
 	c_args: kernel_c_args + (CONFIG_TRACE ? [ '-finstrument-functions' ] : []),
@@ -95,5 +87,5 @@
 
 noninstrumentables = static_library('noninstrumentables', arch_src, genarch_src, generic_src, test_src,
-	include_directories: kernel_includes,
+	include_directories: kernel_include_dirs,
 	implicit_include_directories: false,
 	c_args: kernel_c_args,
@@ -129,5 +121,5 @@
 	output: 'empty_map.S',
 	capture: true,
-	command: [ 'echo', as_prolog + symtab_section ],
+	command: [ 'echo', kernel_as_prolog + symtab_section ],
 )
 
@@ -139,5 +131,5 @@
 
 	kernel_elf = executable(kernel_name + '.elf', kernel_map_S,
-		include_directories: kernel_includes,
+		include_directories: kernel_include_dirs,
 		implicit_include_directories: false,
 		c_args: kernel_c_args,
@@ -170,5 +162,5 @@
 			output: kernel_map_S_name,
 			capture: true,
-			command: [ 'echo', as_prolog + symtab_section + ' .incbin "@INPUT@"' ],
+			command: [ 'echo', kernel_as_prolog + symtab_section + ' .incbin "@INPUT@"' ],
 		)
 	endif
