]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
set SEARCH_PATH for the linker script from output of ld --verbose -v
authorJuan Quintela <quintela@redhat.com>
Wed, 22 Jul 2009 20:37:40 +0000 (22:37 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 27 Jul 2009 19:10:56 +0000 (14:10 -0500)
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 files changed:
Makefile
alpha.ld
arm.ld
configure
hppa.ld
i386.ld
ia64.ld
m68k.ld
mips.ld
ppc.ld
ppc64.ld
s390.ld
sparc.ld
sparc64.ld
x86_64.ld

index ed9a08d6e9626c7463373e12cbf80f3f9f0f5b35..c510ff3feac93d828da0ecde69b3943a7eb7e80a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -225,7 +225,7 @@ clean:
         done
 
 distclean: clean
-       rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi qemu-img-cmds.texi
+       rm -f config-host.mak config-host.h config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi
        rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
        for d in $(TARGET_DIRS) libhw32 libhw64; do \
        rm -rf $$d || exit 1 ; \
index 09754430666bce1b0735f133dca8ee2d566fb539..906d76bba11348e688fff5bf9f12394f79b6b0ad 100644 (file)
--- a/alpha.ld
+++ b/alpha.ld
@@ -2,7 +2,6 @@ OUTPUT_FORMAT("elf64-alpha", "elf64-alpha",
              "elf64-alpha")
 OUTPUT_ARCH(alpha)
 ENTRY(__start)
-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
diff --git a/arm.ld b/arm.ld
index 93285d697960def2f9243e6c4a43ec86b54cde3e..12b3edb5bbe66ea94f96678eb92807cf2253de93 100644 (file)
--- a/arm.ld
+++ b/arm.ld
@@ -2,7 +2,6 @@ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm",
              "elf32-littlearm")
 OUTPUT_ARCH(arm)
 ENTRY(_start)
-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
index 02cf9e77444b032a20d022c8b09056197cf7251d..8160bed173e15fbaebbc1039d6167aba9e47beba 100755 (executable)
--- a/configure
+++ b/configure
@@ -1477,6 +1477,7 @@ fi
 
 config_host_mak="config-host.mak"
 config_host_h="config-host.h"
+config_host_ld="config-host.ld"
 
 #echo "Creating $config_host_mak and $config_host_h"
 
@@ -1784,6 +1785,18 @@ if test -f ${config_host_h}~ ; then
   fi
 fi
 
+# generate list of library paths for linker script
+
+$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
+
+if test -f ${config_host_ld}~ ; then
+  if cmp -s $config_host_ld ${config_host_ld}~ ; then
+    mv ${config_host_ld}~ $config_host_ld
+  else
+    rm ${config_host_ld}~
+  fi
+fi
+
 for target in $target_list; do
 target_dir="$target"
 config_mak=$target_dir/config.mak
@@ -2049,7 +2062,7 @@ if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
   case "$ARCH" in
   i386)
     if test "$gprof" = "yes" -o "$static" = "yes" ; then
-      ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld'
+      ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
     else
       # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
       # that the kernel ELF loader considers as an executable. I think this
@@ -2059,20 +2072,20 @@ if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
     ;;
   sparc)
     # -static is used to avoid g1/g3 usage by the dynamic linker
-    ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
     ;;
   ia64)
-    ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
     ;;
   x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
-    ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld'
+    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
     ;;
   esac
 fi
 if test "$target_softmmu" = "yes" ; then
   case "$ARCH" in
   ia64)
-    ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
     ;;
   esac
 fi
diff --git a/hppa.ld b/hppa.ld
index 8ef7fa572833576d32398735e79726d30e257a5a..9a4b22c022edbcc2548a478e0763b468f16e7698 100644 (file)
--- a/hppa.ld
+++ b/hppa.ld
@@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-hppa-linux", "elf32-hppa-linux",
              "elf32-hppa-linux")
 OUTPUT_ARCH(hppa:hppa1.1)
 ENTRY(_start)
-SEARCH_DIR("/usr/hppa-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
diff --git a/i386.ld b/i386.ld
index 9f4cb5b136caabd5d409e0b2d1ea3047e7d6a02c..f2dafecc1a5f3ca01d96830670212ee7fddb07b3 100644 (file)
--- a/i386.ld
+++ b/i386.ld
@@ -3,7 +3,6 @@
  */
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 ENTRY(_start)
 SECTIONS
 {
diff --git a/ia64.ld b/ia64.ld
index 8d2ede2d3dfecc4b1fdf980835a11448582a8be2..0c377967cd433a93c4c62150095c68d5e77938ba 100644 (file)
--- a/ia64.ld
+++ b/ia64.ld
@@ -3,9 +3,7 @@ OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little",
              "elf64-ia64-little")
 OUTPUT_ARCH(ia64)
 ENTRY(_start)
-SEARCH_DIR("/usr/ia64-linux/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;    */
+/* __DYNAMIC = 0;    */
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
diff --git a/m68k.ld b/m68k.ld
index 28da902fd5e648cad065957dbf342f3a36e2369d..0e3d9deb5a6be17610e72988b58d4fdb94655e2e 100644 (file)
--- a/m68k.ld
+++ b/m68k.ld
@@ -3,9 +3,7 @@ OUTPUT_FORMAT("elf32-m68k", "elf32-m68k",
              "elf32-m68k")
 OUTPUT_ARCH(m68k)
 ENTRY(_start)
-SEARCH_DIR("/usr/local/m68k-linux/lib");
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;    */
+/* __DYNAMIC = 0;    */
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
diff --git a/mips.ld b/mips.ld
index 94fa63be4b74cd3619c9d2c9ef301bebacac9fb8..4294761c199b234faf204f6269a55db8fd788e1f 100644 (file)
--- a/mips.ld
+++ b/mips.ld
@@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips",
              "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 ENTRY(__start)
-SEARCH_DIR("/usr/mips-linux-gnu/lib");
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
diff --git a/ppc.ld b/ppc.ld
index 1e6bbe9a626cfc8982bdf376b39e4bed6c228bce..5248ef15a540c272f16e3b6247ce7b5f86ce7d78 100644 (file)
--- a/ppc.ld
+++ b/ppc.ld
@@ -3,7 +3,6 @@
  */
 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
 OUTPUT_ARCH(powerpc:common)
-SEARCH_DIR(/usr/powerpc-linux-gnu/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib)
 ENTRY(_start)
 SECTIONS
 {
index 1ba88830152389e287ad5558864152f6a04284b0..dea0dbda21c29b0e2377d937dfb0d1ae3b5dd814 100644 (file)
--- a/ppc64.ld
+++ b/ppc64.ld
@@ -3,13 +3,7 @@ OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc",
              "elf64-powerpc")
 OUTPUT_ARCH(powerpc:common64)
 ENTRY(_start)
-SEARCH_DIR("/usr/powerpc64-unknown-linux-gnu/lib64");
-SEARCH_DIR("/usr/lib/binutils/powerpc64-unknown-linux-gnu/2.16.164");
-SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64");
-SEARCH_DIR("/usr/powerpc64-unknown-linux-gnu/lib");
-SEARCH_DIR("/usr/lib/binutils/powerpc64-unknown-linux-gnu/2.16.1");
-SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); /* Do we
-need any of these for elf? +   __DYNAMIC = 0;    */
+/* __DYNAMIC = 0;    */
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
diff --git a/s390.ld b/s390.ld
index ccae2e71df2a6a47f17c54ceba8f70a3c7cee534..a9c53707f1681d1dafca4541382d4e658f86a422 100644 (file)
--- a/s390.ld
+++ b/s390.ld
@@ -2,9 +2,7 @@ OUTPUT_FORMAT("elf32-s390", "elf32-s390",
              "elf32-s390")
 OUTPUT_ARCH(s390:31-bit)
 ENTRY(_start)
-SEARCH_DIR("/usr/s390-redhat-linux/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib");
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;    */
+/* __DYNAMIC = 0;    */
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
index 26ab4151fef92be6834c0821ea6ab675de68f558..5aed1c2aaff133f663f8eea8880a7af15adcb5c4 100644 (file)
--- a/sparc.ld
+++ b/sparc.ld
@@ -1,7 +1,6 @@
 OUTPUT_FORMAT("elf32-sparc", "elf32-sparc",
               "elf32-sparc")
 OUTPUT_ARCH(sparc)
-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 ENTRY(_start)
 SECTIONS
 {
index f7286346c3f86c3bbd712ef16a4338f47c0602e1..9ea41431e8c1bb5601b07654607713424c0c1496 100644 (file)
@@ -1,7 +1,6 @@
 OUTPUT_FORMAT("elf64-sparc", "elf64-sparc",
               "elf64-sparc")
 OUTPUT_ARCH(sparc:v9)
-SEARCH_DIR(/lib64); SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib64); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib64); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 ENTRY(_start)
 SECTIONS
 {
index 878dafbe79cf886cf6a613c7242dff55c96d00d0..24ea77dadf7f7526f3ca8a819beca18da8f2ba9f 100644 (file)
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -2,7 +2,6 @@
 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
 OUTPUT_ARCH(i386:x86-64)
 ENTRY(_start)
-SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */