From 8639b1fb66e546194dfa0e57304f99e00fda5d35 Mon Sep 17 00:00:00 2001 From: Alberto Date: Fri, 21 Aug 2026 23:44:33 +0200 Subject: [PATCH] Discard `.pdr` in the PSP linker script `.pdr` holds MIPS procedure-descriptor debug data. It is not allocated, so `--gc-sections` does not collect it, but the relocations kept for it by the target's `--emit-relocs` still refer to the functions that were collected. rust-lld reports each of those as "relocation refers to a discarded section"; a hello-world picks up 70 such warnings, now that cargo no longer suppresses linker output. Nothing on the PSP reads `.pdr`, so discard it alongside the other non-loadable sections already listed. This also drops ~9% off the resulting EBOOT. Fixes https://github.com/overdrivenpotato/rust-psp/issues/203 (in part) --- .../src/spec/targets/mipsel_sony_psp_linker_script.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp_linker_script.ld b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp_linker_script.ld index 9eb35ad9f5d2e..1d0d7e537b2e7 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp_linker_script.ld +++ b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp_linker_script.ld @@ -41,5 +41,5 @@ SECTIONS .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } .bss : { *(.bss .bss.*) } - /DISCARD/ : { *(.rel.sceStub.text .MIPS.abiflags .reginfo) } + /DISCARD/ : { *(.rel.sceStub.text .MIPS.abiflags .reginfo .pdr) } }