Skip to content

Commit 294911f

Browse files
authored
Merge pull request #830 from fjtrujy/fix/data-section-attribute
fix: place exported variables in `.data` instead of bogus `section("data")`
2 parents 586784c + 493529c commit 294911f

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

common/include/errno.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,6 @@ char *file_errors[] = {
428428
#define error_to_string(errnum) (file_errors[errnum * -1])
429429
#endif
430430

431-
extern int errno __attribute__((section("data")));
431+
extern int errno __attribute__((section(".data")));
432432

433433
#endif /* __ERRNO_H__ */

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)