qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT 9abbdbf] Fix build on Solaris and WIN32


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 9abbdbf] Fix build on Solaris and WIN32
Date: Thu, 14 May 2009 22:06:49 -0000

From: Anthony Liguori <address@hidden>

Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/configure b/configure
index 8fbe35b..4111e7c 100755
--- a/configure
+++ b/configure
@@ -1691,6 +1691,29 @@ bsd)
 ;;
 esac
 
+# Determine what linker flags to use to force archive inclusion
+check_linker_flags()
+{
+    $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 
2>/dev/null
+}
+
+cat > $TMPC << EOF
+int main(void) { }
+EOF
+if check_linker_flags --whole-archive --no-whole-archive ; then
+    # GNU ld
+    echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
+    echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
+elif check_linker_flags -z,allextract -z,defaultextract ; then
+    # Solaris ld
+    echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
+    echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
+else
+    echo "Error: your linker does not support --whole-archive or -z."
+    echo "Please report to address@hidden"
+    exit 1
+fi
+
 tools=
 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
   tools="qemu-img\$(EXESUF) $tools"
diff --git a/rules.mak b/rules.mak
index 8471d40..8d6d96e 100644
--- a/rules.mak
+++ b/rules.mak
@@ -8,10 +8,7 @@
 %.o: %.m
        $(call quiet-command,$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  OBJC  
$(TARGET_DIR)$@")
 
-WAS=-Wl,--whole-archive
-WAE=-Wl,--no-whole-archive
-
-LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(1) $(LIBS) $(WAS) 
$(ARLIBS) $(WAE),"  LINK  $(TARGET_DIR)$@")
+LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) 
$(ARLIBS) $(ARLIBS_END) $(LIBS),"  LINK  $(TARGET_DIR)$@")
 
 %$(EXESUF): %.o
        $(call LINK,$^)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]