Fix build error by adding -fno-stack-protector to CFLAGS in usr/LBuild (#63)
[lunaix-os.git] / lunaix-os / usr / LBuild
index 4b0617cbab5417a0b167cb0f7a0ca6ed6b9c236a..a349e7d498c5aeb1a5d1a4efc988a46019c2c839 100644 (file)
@@ -1,4 +1,4 @@
-sources([
+src.c += (
     "testp",
     "ls",
     "signal_demo",
@@ -9,36 +9,45 @@ sources([
     "maze",
     "mkdir",
     "rm",
-])
+    "fragfile",
+)
 
-compile_opts([
+flag.cc += (
     "-ffreestanding",
-    "-fno-pie"
-])
+    "-fno-pie",
+    "-fno-stack-protector",
+    "-Werror"
+)
 
-linking_opts([
+flag.ld += (
     "-nostdlib", 
     "-nolibc", 
     "-z noexecstack", 
     "-no-pie", 
-])
+)
 
-linking_opts([
+flag.ld += (
     "-Wl,--build-id=none"
-])
+)
 
-if config("arch") == "x86_64":
-    compile_opts([
-        "-m64", 
-        "-fno-unwind-tables", 
-        "-fno-asynchronous-unwind-tables",
-        "-mcmodel=large"
-    ])
-    linking_opts([
-        "-m64",
-    ])
-else:
-    compile_opts("-m32")
-    linking_opts("-m32")
+match env.ARCH:
+    case "x86_64":
+        flag.cc += (
+            "-m64", 
+            "-fno-unwind-tables", 
+            "-fno-asynchronous-unwind-tables",
+            "-mcmodel=large",
+            "-DCONFIG_ARCH_X86_64"
+        )
+        flag.ld += (
+            "-m64",
+        )
+    case "i386":
+        flag.cc += "-m32", "-DCONFIG_ARCH_X86_32"
+        flag.ld += "-m32"
 
-compile_opts("-mno-sse")
\ No newline at end of file
+flag.cc += "-mno-sse"
+
+flag.cc += (
+    "-Wno-discarded-qualifiers"
+)