Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
PoloNX committed Jul 9, 2024
1 parent c489a0b commit 39cbb11
Showing 1 changed file with 54 additions and 7 deletions.
61 changes: 54 additions & 7 deletions toolchain/devkitA64.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
local triple = "aarch64-unknown-none-elf"

local buildflags = {
"-march=armv8-a+crc+crypto+simd",
"-mcpu=cortex-a57",
"-mtune=cortex-a57",
"-ftls-model=local-exec",
"-ffunction-sections",
"-fdata-sections",
"-fstack-protector-strong",
"-fPIC",
"-D__SWITCH__=1",
"-D__SWITCH=1",
"-DLIBNX_NO_DEPRECATION",
"-D_GNU_SOURCE=1",
"-D_LIBC",
"-D_NEWLIB_VERSION=4.3.0",
"-D__NEWLIB__=4"
}

local sharedlinkflags = {
"-Wl,-Bdynamic",
"-fPIC",
"-Wl,--gc-sections",
"-Wl,-z,text",
"-Wl,--build-id=sha1",
"-Wl,--no-dynamic-linker",
"-Wl,--as-needed",
"-Wl,--eh-frame-hdr",
"-fvisibility=hidden"
}

local executablelinkflags = {
"-Wl,-Bsymbolic",
"-fPIE",
"-Wl,-pie",
"-Wl,--gc-sections",
"-Wl,-z,text",
"-Wl,--build-id=sha1",
"-Wl,--no-dynamic-linker",
"-Wl,--as-needed",
"-Wl,--eh-frame-hdr",
"-fvisibility=hidden",
}

toolchain("devkita64")
add_defines("__SWITCH__")
Expand All @@ -22,16 +64,19 @@ toolchain("devkita64")
set_toolset("ranlib", "aarch64-none-elf-ranlib")
set_toolset("as", "aarch64-none-elf-gcc")

on_check("check")
add_cxflags(buildflags)
add_asflags(buildflags)
add_ldflags(executablelinkflags)
add_shflags(sharedlinkflags)

local DEVKITPRO = os.getenv("DEVKITPRO")
if not DEVKITPRO then
echo("Please set DEVKITPRO var")
return
end

--add_linkdirs(path.join(DEVKITPRO, "/libnx/lib"), path.join(DEVKITPRO, "/portlibs/switch/lib"))
--add_includedirs(path.join(DEVKITPRO, "/libnx/include"), path.join(DEVKITPRO, "/portlibs/switch/include"))

on_check("check")

on_load(function(toolchain)
toolchain:add("defines", "SWITCH", "HAVE_LIBNX")
toolchain:add("defines", "SWITCH", "__SWITCH__", "HAVE_LIBNX")
toolchain:add("arch", "-march=armv8-a+crc+crypto", "-mtune=cortex-a57", "-mtp=soft", "-fPIE")

toolchain:add("cflags", "-g", "-Wall", "-O2", "-ffunction-sections", "-fdata-sections", {force = true})
Expand All @@ -41,5 +86,7 @@ toolchain("devkita64")
toolchain:add("asflags", "-g", "-march=armv8-a+crc+crypto", "-mtune=cortex-a57", "-mtp=soft", "-fPIE", {force = true})
toolchain:add("ldflags", "-specs=" .. path.join(DEVKITPRO, "/libnx/switch.specs"), "-g", "-W", "-fPIC","$(notdir $*.map)", {force = true})

-- toolchain:add("linkdirs", path.join(DEVKITPRO, "/libnx/lib"), path.join(DEVKITPRO, "/portlibs/switch/lib"))
toolchain:add("syslinks", "gcc", "c", "m")
-- toolchain:add("links", "deko3d")
end)

0 comments on commit 39cbb11

Please sign in to comment.