fix biarch linking
PATCH 1/1 fix biarch linking
2006-04-18 Hollis Blanchard <[email protected]>
* Makefile.in (LDFLAGS): Add variable.
(LD): Remove variable.
* configure.ac: Add -m32 to LDFLAGS.
* genmk.rb (PModule#rule): Use $(CC) instead of $(LD).
* conf/powerpc-ieee1275.rmk (COMMON_LDFLAGS): Add variable. (grubof_LDFLAGS): Use $(COMMON_LDFLAGS). (_linux_mod_LDFLAGS, linux_mod_LDFLAGS, normal_mod_LDFLAGS, suspend_mod_LDFLAGS, reboot_mod_LDFLAGS, halt_mod_LDFLAGS): New variables.
Could somebody please confirm that x86 still builds and works with this patch? Thanks.
-Hollis
Index: Makefile.in
===================================================================
RCS file: /sources/grub/grub2/Makefile.in,v
retrieving revision 1.18
Makefile.in +1 -1
@@ -56,6 +56,7 @@ mkinstalldirs = $(srcdir)/mkinstalldirs CC = @CC@ CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ CPPFLAGS = -I. -Iinclude -I$(srcdir)/include -Wall -W BUILD_CC = @BUILD_CC@ BUILD_CFLAGS = -g -O2
@@ -64,7 +65,6 @@ BUILD_CPPFLAGS = -I. -Iinclude -I$(srcdi OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ NM = @NM@ -LD = @LD@ RUBY = @RUBY@ LIBCURSES = @LIBCURSES@ LIBLZO = @LIBLZO@
Index: configure.ac
===================================================================
RCS file: /sources/grub/grub2/configure.ac,v
retrieving revision 1.22
configure.ac +2 -0
@@ -89,6 +89,8 @@ if test "x$default_CFLAGS" = xyes; then if test "x$biarch32" = x1; then tmp_CFLAGS="$tmp_CFLAGS -m32" + LDFLAGS="$LDFLAGS -m32" + AC_SUBST(LDFLAGS) fi CFLAGS="$tmp_CFLAGS"
Index: genmk.rb
===================================================================
RCS file: /sources/grub/grub2/genmk.rb,v
retrieving revision 1.19
genmk.rb +2 -2
@@ -121,12 +121,12 @@ UNDSYMFILES += #{undsym} #{@name}: #{pre_obj} #{mod_obj} -rm -f $@ - $(LD) $(#{prefix}_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^ + $(CC) $(#{prefix}_LDFLAGS) $(LDFLAGS) -Wl,-r,-d -o $@ $^ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ #{pre_obj}: #{objs_str} -rm -f $@ - $(LD) $(#{prefix}_LDFLAGS) -r -d -o $@ $^ + $(CC) $(#{prefix}_LDFLAGS) $(LDFLAGS) -Wl,-r,-d -o $@ $^ #{mod_obj}: #{mod_src} $(CC) $(CPPFLAGS) $(CFLAGS) $(#{prefix}_CFLAGS) -c -o $@ $<
Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/powerpc-ieee1275.rmk,v retrieving revision 1.52
powerpc-ieee1275.rmk +9 -1
@@ -3,6 +3,7 @@ COMMON_ASFLAGS = -nostdinc -D__ASSEMBLY__ COMMON_CFLAGS = -ffreestanding -msoft-float +COMMON_LDFLAGS += -nostdlib # Images.
@@ -69,7 +70,8 @@ grubof_SOURCES = kern/powerpc/ieee1275/c grubof_HEADERS = grub/powerpc/ieee1275/ieee1275.h grubof_CFLAGS = $(COMMON_CFLAGS) grubof_ASFLAGS = $(COMMON_ASFLAGS) -grubof_LDFLAGS = -nostdlib -static-libgcc -lgcc -Wl,-N,-S,-Ttext,0x200000,-Bstatic +grubof_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ + -Wl,-N,-S,-Ttext,0x200000,-Bstatic # For genmoddep. genmoddep_SOURCES = util/genmoddep.c
@@ -91,10 +93,12 @@ pkgdata_MODULES = halt.mod \ # For _linux.mod. _linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c _linux_mod_CFLAGS = $(COMMON_CFLAGS) +_linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # For linux.mod. linux_mod_SOURCES = loader/powerpc/ieee1275/linux_normal.c linux_mod_CFLAGS = $(COMMON_CFLAGS) +linux_mod_LDFLAGS = $(COMMON_LDFLAGS) # For normal.mod. normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
@@ -103,18 +107,22 @@ normal_mod_SOURCES = normal/arg.c normal normal/menu_entry.c normal/misc.c grub_script.tab.c \ normal/script.c normal/powerpc/setjmp.S normal_mod_CFLAGS = $(COMMON_CFLAGS) +normal_mod_LDFLAGS = $(COMMON_LDFLAGS) normal_mod_ASFLAGS = $(COMMON_ASFLAGS) # For suspend.mod suspend_mod_SOURCES = commands/ieee1275/suspend.c suspend_mod_CFLAGS = $(COMMON_CFLAGS) +suspend_mod_LDFLAGS = $(COMMON_LDFLAGS) # For reboot.mod reboot_mod_SOURCES = commands/ieee1275/reboot.c reboot_mod_CFLAGS = $(COMMON_CFLAGS) +reboot_mod_LDFLAGS = $(COMMON_LDFLAGS) # For halt.mod halt_mod_SOURCES = commands/ieee1275/halt.c halt_mod_CFLAGS = $(COMMON_CFLAGS) +halt_mod_LDFLAGS = $(COMMON_LDFLAGS) include $(srcdir)/conf/common.mk
Quoted 2 lines · Hollis Blanchard
Could somebody please confirm that x86 still builds and works with this patch? Thanks.
It was necessary to add -nostdlib like you did for ppc. Then it seems fine.
Okuji
Hollis Blanchard <[email protected]> writes:
Hi Hollis,
Quoted 2 lines
Could somebody please confirm that x86 still builds and works with this patch? Thanks.
While compiling on my x86-64:
rm -f pre-_chain.o
gcc -melf_i386 -m32 -Wl,-r,-d -o pre-_chain.o _chain_mod-loader_i386_pc_chainloader.o /usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
make: *** [pre-_chain.o] Error 1
I haven't looked into this one yet, though.
--
Marco