-
-
Notifications
You must be signed in to change notification settings - Fork 143
More xmake work. #2055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
More xmake work. #2055
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -161,6 +161,7 @@ __attribute__((section(".preinit_array"))) static fptr pi_heap[] = { | |||||
|
|
||||||
| // we're not going to care about exit cleanup | ||||||
| __attribute__((weak)) void __cxa_atexit(void (*func)(void*), void* arg, void* dso_handle) {} | ||||||
| __attribute__((weak)) void atexit(void (*func)(void)) {} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Mismatch in The standard C library signature for 🐛 Proposed fix-__attribute__((weak)) void atexit(void (*func)(void)) {}
+__attribute__((weak)) int atexit(void (*func)(void)) { return 0; }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| // no, we're not going to have shared libraries | ||||||
| __attribute__((weak)) void* __dso_handle = NULL; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| local root = path.join(os.scriptdir(), "..", "..", "..") | ||
| local mips = path.join(os.scriptdir(), "..") | ||
|
|
||
| set_allowedmodes("debug", "dev", "release") | ||
| includes(path.join(root, "tools", "exe2iso")) | ||
| includes(path.join(root, "tools", "ps1-packer")) | ||
| includes(mips) | ||
|
|
||
| target("helloworld", function() | ||
| set_kind("binary") | ||
| add_rules("nugget") | ||
| add_files("main/**.c") | ||
| end) | ||
|
|
||
| target("helloworld.ps-exe", function() | ||
| add_deps("helloworld") | ||
| add_rules("pcsx.ps1-packer.psexe") | ||
| end) | ||
|
|
||
| target("helloworld.iso", function() | ||
| add_deps("helloworld.ps-exe") | ||
| add_rules("pcsx.exe2iso.iso") | ||
| end) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| local psyqo = path.join(os.scriptdir(), "..", "..") | ||
|
|
||
| includes(psyqo) | ||
|
|
||
| target("hello", function() | ||
| add_rules("psyqo.app") | ||
| add_files("*.cpp") | ||
| end) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| local root = path.join(os.scriptdir(), "..", "..", "..") | ||
| local mips = path.join(os.scriptdir(), "..") | ||
| local psyqo = path.join(os.scriptdir()) | ||
|
|
||
| set_allowedmodes("debug", "dev", "release") | ||
| includes(mips) | ||
|
|
||
| set_languages("c11", "c++26") | ||
|
|
||
| rule("psyqo.app", function () | ||
| add_deps("nugget") | ||
| on_load(function(target) | ||
| target:add("values", "c++", true) | ||
| target:set("kind", "binary") | ||
| target:add("files", path.join(psyqo, "src", "*.c")) | ||
| target:add("files", path.join(psyqo, "src", "*.cpp")) | ||
| target:add("files", path.join(psyqo, "src", "**/*.cpp")) | ||
| target:add("files", path.join(mips, "common", "hardware", "flushcache.s")) | ||
| target:add("files", path.join(mips, "common", "psxlibc", "ucontext.s")) | ||
| target:add("files", path.join(mips, "common", "util", "*.cc")) | ||
| target:add("files", path.join(root, "third_party", "EASTL", "source", "*.cpp")) | ||
| target:add("includedirs", path.join(root, "third_party", "EASTL", "include")) | ||
| target:add("includedirs", path.join(root, "third_party", "EABase", "include", "Common")) | ||
| end) | ||
| end) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| /* | ||
|
|
||
| MIT License | ||
|
|
||
| Copyright (c) 2026 PCSX-Redux authors | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. | ||
|
|
||
| */ | ||
|
|
||
| EXTERN(_start) | ||
| ENTRY(_start) | ||
|
|
||
| RAM_SIZE = DEFINED(RAM_SIZE) ? RAM_SIZE : 2M; | ||
| TLOAD_ADDR = DEFINED(TLOAD_ADDR) ? TLOAD_ADDR : 0x80010000; | ||
|
|
||
| MEMORY { | ||
| ram (rwx) : ORIGIN = TLOAD_ADDR, LENGTH = RAM_SIZE - (TLOAD_ADDR - 0x80000000) | ||
| dcache : ORIGIN = 0x1f800000, LENGTH = 0x400 | ||
| } | ||
|
|
||
| __ram_top = ORIGIN(ram) + LENGTH(ram); | ||
| __sp = __ram_top - 0x100; | ||
|
|
||
| __dcache = ORIGIN(dcache); | ||
| __dcache_top = ORIGIN(dcache) + LENGTH(dcache); | ||
|
|
||
| __bss_len = (__bss_end - __bss_start); | ||
| __ftext_len = (__ftext_end - __ftext_start); | ||
| __fdata_len = (__fdata_end - __fdata_start); | ||
|
|
||
| __stack_start = ORIGIN(ram) + LENGTH(ram); | ||
|
|
||
| SECTIONS { | ||
| __ftext_start = ABSOLUTE(.); | ||
| .text TLOAD_ADDR : { | ||
| *(.start) | ||
| *(.init) | ||
| KEEP (*(SORT_NONE(.fini))) | ||
| *(.text.unlikely .text.*_unlikely .text.unlikely.*) | ||
| *(.text.exit .text.exit.*) | ||
| *(.text.startup .text.startup.*) | ||
| *(.text.hot .text.hot.*) | ||
| *(.text .stub .text.* .gnu.linkonce.t.*) | ||
|
|
||
| . = ALIGN(16); | ||
| KEEP(*(.init)) | ||
| . = ALIGN(16); | ||
| KEEP(*(.fini)) | ||
| } > ram | ||
|
|
||
| . = ALIGN(16); | ||
| __text_end = .; | ||
| __ftext_end = ABSOLUTE(.); | ||
|
|
||
| __fdata_start = ABSOLUTE(.); | ||
|
|
||
| .rodata : { | ||
| *(.rodata .rodata.* .rdata .rdata.* .gnu.linkonce.r.*) | ||
| . = ALIGN(16); | ||
| __preinit_array_start = .; | ||
| KEEP (*(.preinit_array)) | ||
| __preinit_array_end = .; | ||
|
|
||
| . = ALIGN(16); | ||
| __init_array_start = .; | ||
| KEEP (*(SORT(.init_array.*))) | ||
| KEEP (*(.init_array)) | ||
|
|
||
| . = ALIGN(16); | ||
| KEEP (*crtbegin.o(.ctors)) | ||
| KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) | ||
| KEEP (*(SORT(.ctors.*))) | ||
| KEEP (*crtend.o(.ctors)) | ||
| __init_array_end = .; | ||
|
|
||
| . = ALIGN(16); | ||
| __fini_array_start = .; | ||
| KEEP (*(.fini_array)) | ||
| KEEP (*(SORT(.fini_array.*))) | ||
|
|
||
| KEEP (*crtbegin.o(.dtors)) | ||
| KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) | ||
| KEEP (*(SORT(.dtors.*))) | ||
| KEEP (*crtend.o(.dtors)) | ||
| __fini_array_end = .; | ||
| __build_id = .; | ||
| *(.note.gnu.build-id) | ||
| __build_id_end = .; | ||
| } > ram | ||
|
|
||
| .rodata1 : { | ||
| *(.rodata1) | ||
| } > ram | ||
|
|
||
| __data_start = .; | ||
| .data : { | ||
| KEEP (*(.data .data.* .gnu.linkonce.d.*)) | ||
| KEEP (*(.data1)) | ||
| KEEP (*(.sdata .sdata.* .gnu.linkonce.s.*)) | ||
| KEEP (*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)) | ||
| KEEP (*(.got.plt)) | ||
| KEEP (*(.got)) | ||
| } > ram | ||
|
|
||
| __data_end = .; | ||
| __fdata_end = .; | ||
| __bss_start = .; | ||
| .sbss (NOLOAD) : { | ||
| *(.dynsbss) | ||
| *(.sbss .sbss.* .gnu.linkonce.sb.*) | ||
| *(.scommon) | ||
| *(.dynbss) | ||
| *(.bss .bss.* .gnu.linkonce.b.*) | ||
| *(COMMON) | ||
| } > ram | ||
|
|
||
| . = ALIGN(4); | ||
| __bss_end = .; | ||
|
|
||
| __heap_start = __heap_base; | ||
|
|
||
| . = ADDR(.text) - 0x800; | ||
| __end = .; | ||
|
|
||
| /DISCARD/ : { *(.MIPS.abiflags) } | ||
|
|
||
| /* Everything is statically linked, so discard PLTs. */ | ||
| /DISCARD/ : { *(.rel.iplt) *(.rela.iplt) *(.rel.plt) *(.rela.plt) *(.plt) *(.iplt) } | ||
|
|
||
| /* Discard things that the standard link script drops, too. */ | ||
| /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } | ||
|
|
||
| .scratchpad (NOLOAD) : { | ||
| *(.scratchpad) | ||
| } > dcache | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| local root = path.join(os.scriptdir(), "..", "..") | ||
| local mips = path.join(os.scriptdir()) | ||
|
|
||
| includes(path.join(root, "third_party", "xmake-psx")) | ||
|
|
||
| rule("nugget", function() | ||
| add_deps("psx") | ||
| on_load(function(target) | ||
| target:add("includedirs", mips) | ||
| target:add("values", "psx.no_crt", true) | ||
| target:add("values", "psx.no_ldscript", true) | ||
| target:add("values", "psx.nogp", true) | ||
| end) | ||
| before_config(function (target) | ||
| if target:get("kind") == "binary" then | ||
| if target:values("c++") then | ||
| target:add("files", path.join(mips, "common", "crt0", "crt0cxx.s")) | ||
| target:add("files", path.join(mips, "common", "crt0", "cxxglue.c")) | ||
| else | ||
| target:add("files", path.join(mips, "common", "crt0", "crt0.s")) | ||
| end | ||
| target:add("files", path.join(mips, "common", "crt0", "memory-c.c")) | ||
| target:add("files", path.join(mips, "common", "crt0", "memory-s.s")) | ||
| target:add("files", path.join(mips, "common", "syscalls", "printf.s")) | ||
| target:add("files", path.join(mips, "xmake.ld")) | ||
| target:add("files", path.join(mips, "nooverlay.ld")) | ||
| end | ||
| end) | ||
| end) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| local support_root = path.join(os.scriptdir(), "..", "..") | ||
|
|
||
| includes(path.join(support_root, "tools", "xmake")) | ||
|
|
||
| common_rules() | ||
|
|
||
| target("pcsx.authoring", function () | ||
| common_tool() | ||
| add_includedirs(path.join(support_root, "third_party", "ucl", "include")) | ||
| end) | ||
|
|
||
| rule("pcsx.authoring.iso", function() | ||
| generic_conversion("pcsx.authoring", ".iso", "authoring") | ||
| end) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| local support_root = path.join(os.scriptdir(), "..", "..") | ||
|
|
||
| includes(path.join(support_root, "tools", "xmake")) | ||
|
|
||
| common_rules() | ||
|
|
||
| target("pcsx.exe2iso", common_tool) | ||
|
|
||
| rule("pcsx.exe2iso.iso", function() | ||
| generic_conversion("pcsx.exe2iso", ".iso", "iso conversion") | ||
| end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win
Preserve complete whitelisted subtrees.
Because
findruns with-depth, the current predicates preserve only the directory entries foruC-sdk,psxlua, andxmake-psx; their descendants still match and are deleted. The second pass repeats the same faulty filters, so the exported history can lose required dependency sources.Add
/*exclusions for each preserved subtree in both commands, matching the existingEABase/EASTLpatterns.Proposed predicate fix
🤖 Prompt for AI Agents