WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Clean up linker flag definitions.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Clean up linker flag definitions.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Oct 2006 18:01:20 +0000
Delivery-date: Wed, 18 Oct 2006 11:01:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 307e5ed9657e3efa81dd337c7722ea877c5e5ba9
# Parent  05bf8693c7354d224867f62adeda698140919095
Clean up linker flag definitions.

 1. GNU ld does not understand -m{32,64}. It must be cooked for it by
    the GCC driver program.
 2. Where GNU ld is directly called we must use -melf_{i386,x86_64}.
 3. We cannot avoid calling GNU ld directly in some cases (e.g., when
    specifying GNU-specific linker scripts) as on some host
    architectures the GCC driver is configured to call the host
    linker.
 4. We cannot add -melf_{i386,x86_64} to LDFLAGS as the option is
    not recognised by GCC.

Hence we define new LDFLAGS_DIRECT, to be added to the command line
only when invoking GNU ld directly.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 config/x86_32.mk                  |    4 +++-
 config/x86_64.mk                  |    4 +++-
 tools/firmware/hvmloader/Makefile |    4 ++--
 tools/firmware/vmxassist/Makefile |    3 +--
 xen/Rules.mk                      |    3 +++
 xen/arch/x86/Rules.mk             |    2 --
 6 files changed, 12 insertions(+), 8 deletions(-)

diff -r 05bf8693c735 -r 307e5ed9657e config/x86_32.mk
--- a/config/x86_32.mk  Wed Oct 18 16:08:58 2006 +0100
+++ b/config/x86_32.mk  Wed Oct 18 16:56:27 2006 +0100
@@ -7,5 +7,7 @@ CONFIG_IOEMU := y
 CONFIG_IOEMU := y
 
 CFLAGS += -m32 -march=i686
-LDFLAGS += -m32
 LIBDIR := lib
+
+# Use only if calling $(LD) directly.
+LDFLAGS_DIRECT += -melf_i386
diff -r 05bf8693c735 -r 307e5ed9657e config/x86_64.mk
--- a/config/x86_64.mk  Wed Oct 18 16:08:58 2006 +0100
+++ b/config/x86_64.mk  Wed Oct 18 16:56:27 2006 +0100
@@ -7,5 +7,7 @@ CONFIG_IOEMU := y
 CONFIG_IOEMU := y
 
 CFLAGS += -m64
-LDFLAGS += -m64
 LIBDIR = $(LIB64DIR)
+
+# Use only if calling $(LD) directly.
+LDFLAGS_DIRECT += -melf_x86_64
diff -r 05bf8693c735 -r 307e5ed9657e tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Wed Oct 18 16:08:58 2006 +0100
+++ b/tools/firmware/hvmloader/Makefile Wed Oct 18 16:56:27 2006 +0100
@@ -38,7 +38,7 @@ CFLAGS  += $(call test-gcc-flag,$(CC),-f
 
 OBJCOPY  = objcopy
 CFLAGS  += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
-LDFLAGS  = -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
+LDFLAGS  = -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
 
 SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c
 OBJS = $(patsubst %.c,%.o,$(SRCS))
@@ -48,7 +48,7 @@ all: hvmloader
 
 hvmloader: roms.h $(SRCS)
        $(CC) $(CFLAGS) -c $(SRCS)
-       $(CC) $(LDFLAGS) -o hvmloader.tmp $(OBJS)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o hvmloader.tmp $(OBJS)
        $(OBJCOPY) hvmloader.tmp hvmloader
        rm -f hvmloader.tmp
 
diff -r 05bf8693c735 -r 307e5ed9657e tools/firmware/vmxassist/Makefile
--- a/tools/firmware/vmxassist/Makefile Wed Oct 18 16:08:58 2006 +0100
+++ b/tools/firmware/vmxassist/Makefile Wed Oct 18 16:56:27 2006 +0100
@@ -39,7 +39,6 @@ CPP      = cpp -P
 CPP      = cpp -P
 OBJCOPY  = objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0
 CFLAGS  += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
-LDFLAGS  = -m elf_i386
 
 OBJECTS = head.o trap.o vm86.o setup.o util.o
 
@@ -48,7 +47,7 @@ all: vmxassist.bin
 
 vmxassist.bin: vmxassist.ld $(OBJECTS)
        $(CPP) $(DEFINES) vmxassist.ld > vmxassist.tmp
-       $(LD) -o vmxassist $(LDFLAGS) -nostdlib --fatal-warnings -N -T 
vmxassist.tmp $(OBJECTS)
+       $(LD) -o vmxassist $(LDFLAGS_DIRECT) -nostdlib --fatal-warnings -N -T 
vmxassist.tmp $(OBJECTS)
        nm -n vmxassist > vmxassist.sym
        $(OBJCOPY) vmxassist vmxassist.tmp
        dd if=vmxassist.tmp of=vmxassist.bin ibs=512 conv=sync
diff -r 05bf8693c735 -r 307e5ed9657e xen/Rules.mk
--- a/xen/Rules.mk      Wed Oct 18 16:08:58 2006 +0100
+++ b/xen/Rules.mk      Wed Oct 18 16:56:27 2006 +0100
@@ -71,6 +71,9 @@ AFLAGS   := $(strip $(AFLAGS) $(AFLAGS-y
 AFLAGS   := $(strip $(AFLAGS) $(AFLAGS-y))
 AFLAGS   += $(patsubst -std=gnu%,,$(CFLAGS))
 
+# LDFLAGS are only passed directly to $(LD)
+LDFLAGS  += $(LDFLAGS_DIRECT)
+
 include Makefile
 
 # Ensure each subdirectory has exactly one trailing slash.
diff -r 05bf8693c735 -r 307e5ed9657e xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk     Wed Oct 18 16:08:58 2006 +0100
+++ b/xen/arch/x86/Rules.mk     Wed Oct 18 16:56:27 2006 +0100
@@ -34,7 +34,6 @@ endif
 endif
 
 ifeq ($(XEN_TARGET_ARCH),x86_32)
-LDFLAGS += -m elf_i386
 x86_32 := y
 x86_64 := n
 endif
@@ -45,7 +44,6 @@ CFLAGS  += -fno-asynchronous-unwind-tabl
 # -fvisibility=hidden reduces -fpic cost, if it's available
 CFLAGS  += $(shell $(CC) -v --help 2>&1 | grep " -fvisibility=" | \
              grep -q hidden && echo "-DGCC_HAS_VISIBILITY_ATTRIBUTE")
-LDFLAGS += -m elf_x86_64
 x86_32 := n
 x86_64 := y
 endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Clean up linker flag definitions., Xen patchbot-unstable <=