Skip to content

Commit 493529c

Browse files
fjtrujyclaude
andcommitted
cleanup: [smap] drop bogus section("data") from extern decls
main.c declared _exp_smap and _exp_smapmodu as extern with __attribute__((section("data"))). Same pattern fixed in the previous commit for errno: a bare "data" section name (no leading dot) does not match the IRX linker script and ends up as an orphan that the IRX loader does not allocate. In this case the annotation was always harmless because the matching DECLARE_EXPORT_TABLE in iop/kernel/include/irx.h places the actual definition in .text via a section(".text\\n\\t#") asm trick. Section attributes on extern declarations are hints only; the symbol's address is governed by the definition. The smap.irx layout is unchanged: the linked output still has _exp_smap at .text (verified with nm), and srxfixup no longer warns. The cleanup just removes the misleading attribute and inline comment so the latent bug can't manifest if the export table macro or its placement is ever refactored. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f63adb5 commit 493529c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

iop/network/smap/src/main.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,17 @@ void PS2IPLinkStateDown(void)
270270
#endif
271271

272272
#if defined(BUILDING_SMAP_NETMAN) || defined(BUILDING_SMAP_NETDEV)
273-
// While the header of the export table is small, the large size of the export table (as a whole) places it in data instead of sdata.
274-
extern struct irx_export_table _exp_smap __attribute__((section("data")));
273+
/* DECLARE_EXPORT_TABLE in iop/kernel/include/irx.h places the export
274+
table in .text via a section(".text\n\t#") asm trick, so the extern
275+
declaration needs no section attribute. (The previous section("data")
276+
was misleading: a bare "data" name produces an orphan ELF section the
277+
IRX loader does not allocate; harmless here only because the actual
278+
definition lives in .text.) */
279+
extern struct irx_export_table _exp_smap;
275280
#endif
276281

277282
#ifdef BUILDING_SMAP_MODULAR
278-
extern struct irx_export_table _exp_smapmodu __attribute__((section("data")));
283+
extern struct irx_export_table _exp_smapmodu;
279284
#endif
280285

281286
int _start(int argc, char *argv[])

0 commit comments

Comments
 (0)