While trying to update grub2 to grub-1.99 on x86_64 I got an assembler error which I reduced to the following. The original test case had no warnings and compiles without problems without O2 or with -mcmodel=large - and thus also on 32-bit. $ cat test.c static f0 (struct s *ps, int n) { int i; for (i = 0; i < n; i++) { b (ps, c (), i); } } f (int p1, int edit, int n, struct s *ps) { x (p1); f0 (ps, n); x (p1); } $ gcc -mcmodel=large -O2 -c test.c test.c:1:19: warning: ‘struct s’ declared inside parameter list [enabled by default] test.c:1:19: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] test.c:9:36: warning: ‘struct s’ declared inside parameter list [enabled by default] test.c: In function ‘f’: test.c:12:3: warning: passing argument 1 of ‘f0’ from incompatible pointer type [enabled by default] test.c:1:8: note: expected ‘struct s *’ but argument is of type ‘struct s *’ test.s: Assembler messages: test.s:70: Error: immediate operand illegal with absolute jump gcc-4.6.1-3.fc16.x86_64 gcc (GCC) 4.6.1 20110715 (Red Hat 4.6.1-3)
s/ with -mcmodel=large / without -mcmodel=large /
Tracking upstream. Why does grub use -mcmodel=large, out of curiosity?
It seems to be assumed that it is required for 64bit EFI. I'm sure mjg59 know the details. configure.ac: if test "$target_cpu"-"$platform" = x86_64-efi; then # Use large model to support 4G memory AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ SAVED_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -m64 -mcmodel=large" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [grub_cv_cc_mcmodel=yes], [grub_cv_cc_mcmodel=no]) ]) if test "x$grub_cv_cc_mcmodel" = xno; then AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) else TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" fi grub-core/Makefile.am : efiemu64_c.o: efiemu/runtime/efiemu.c $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ efiemu64_s.o: efiemu/runtime/efiemu.S $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ (Grub has a lot of compile flags hardcoded. Some of them probably for good reasons, but it causes trouble when it is combined with standard rpm CFLAGS.)
gcc-4.6.1-4.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/gcc-4.6.1-4.fc16
gcc-4.6.1-7.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report.