Hi,

When compiling GRUB with GCC 3.4.3, I had the problem that my modules
didn't work, apparently because the symbols grub_mod_init and
grub_mod_fini weren't in the modules' symbol tables.

Does the absence of these symbols indicate a bug in GCC, or does
"__attribute__ ((used))" not in fact guarantee placement in the symbol
table?

I got around the problem by making these functions non-static. Would this
be undesirable in the main code tree? (Obviously it would be a problem if
modules are to be linked together, but I don't know if this is ever done
in GRUB.)

BTW, does the call to grub_mod_init() from grub_##name##_init() not make
"((used))" unnecessary in the former (and likewise for *fini)?

I've included the macro from includes/grub/dl.h that generates these
functions below.

Regards,
Neil

#define GRUB_MOD_INIT(name)     \
void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ 
((used)); \
void grub_##name##_init (void); \
void \
grub_##name##_init (void) { grub_mod_init (0); } \
void \
grub_mod_init (grub_dl_t mod __attribute__ ((unused)))

#define GRUB_MOD_FINI(name)     \
void grub_mod_fini (void) __attribute__ ((used)); \
void grub_##name##_fini (void); \
void \
grub_##name##_fini (void) { grub_mod_fini (); } \
void \
grub_mod_fini (void)


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to