ps2dev / ps2sdk

Homebrew PS2 SDK
Other
935 stars 133 forks source link

[iop]: add script to check IRX source code for unused imports #636

Closed israpps closed 3 months ago

israpps commented 3 months ago

Will allow us to reduct binary size of some critical IRX by 16*unused_import_ammount bytes

Checking all our drivers src will be as simple as applying the following change on iop/Rules.bin.make and then call make inside iop/

IOP_BIN ?= $(shell basename $(CURDIR)).irx
IOP_BIN := $(IOP_BIN:%=$(IOP_BIN_DIR)%)

+IMPORT_CHECK_SCRIPT=$(PS2SDKSRC)/iop/check_imports.sh
+check-import::
+   exec $(IMPORT_CHECK_SCRIPT)

all:: $(IOP_BIN)

clean::
    rm -f -r $(IOP_OBJS_DIR) $(IOP_BIN_DIR)

-IMPORT_CHECK_SCRIPT=$(PS2SDKSRC)/iop/check_imports.sh
-check-import::
-   exec $(IMPORT_CHECK_SCRIPT)

a small example of the output:

image

it will not handle some edge cases, like udptty createsema (because its using a the createMutex helper function from the intrman header)

but it is still useful