Commit 4bf6b55b346d33ff16dd25f75bbea8e21f95dfa6

Authored by Juan Quintela
Committed by Anthony Liguori
1 parent fa282484

set SEARCH_PATH for the linker script from output of ld --verbose -v

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Makefile
@@ -225,7 +225,7 @@ clean: @@ -225,7 +225,7 @@ clean:
225 done 225 done
226 226
227 distclean: clean 227 distclean: clean
228 - rm -f config-host.mak config-host.h $(DOCS) qemu-options.texi qemu-img-cmds.texi 228 + rm -f config-host.mak config-host.h config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi
229 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} 229 rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
230 for d in $(TARGET_DIRS) libhw32 libhw64; do \ 230 for d in $(TARGET_DIRS) libhw32 libhw64; do \
231 rm -rf $$d || exit 1 ; \ 231 rm -rf $$d || exit 1 ; \
alpha.ld
@@ -2,7 +2,6 @@ OUTPUT_FORMAT(&quot;elf64-alpha&quot;, &quot;elf64-alpha&quot;, @@ -2,7 +2,6 @@ OUTPUT_FORMAT(&quot;elf64-alpha&quot;, &quot;elf64-alpha&quot;,
2 "elf64-alpha") 2 "elf64-alpha")
3 OUTPUT_ARCH(alpha) 3 OUTPUT_ARCH(alpha)
4 ENTRY(__start) 4 ENTRY(__start)
5 -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);  
6 SECTIONS 5 SECTIONS
7 { 6 {
8 /* Read-only sections, merged into text segment: */ 7 /* Read-only sections, merged into text segment: */
@@ -2,7 +2,6 @@ OUTPUT_FORMAT(&quot;elf32-littlearm&quot;, &quot;elf32-littlearm&quot;, @@ -2,7 +2,6 @@ OUTPUT_FORMAT(&quot;elf32-littlearm&quot;, &quot;elf32-littlearm&quot;,
2 "elf32-littlearm") 2 "elf32-littlearm")
3 OUTPUT_ARCH(arm) 3 OUTPUT_ARCH(arm)
4 ENTRY(_start) 4 ENTRY(_start)
5 -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);  
6 SECTIONS 5 SECTIONS
7 { 6 {
8 /* Read-only sections, merged into text segment: */ 7 /* Read-only sections, merged into text segment: */
configure
@@ -1477,6 +1477,7 @@ fi @@ -1477,6 +1477,7 @@ fi
1477 1477
1478 config_host_mak="config-host.mak" 1478 config_host_mak="config-host.mak"
1479 config_host_h="config-host.h" 1479 config_host_h="config-host.h"
  1480 +config_host_ld="config-host.ld"
1480 1481
1481 #echo "Creating $config_host_mak and $config_host_h" 1482 #echo "Creating $config_host_mak and $config_host_h"
1482 1483
@@ -1784,6 +1785,18 @@ if test -f ${config_host_h}~ ; then @@ -1784,6 +1785,18 @@ if test -f ${config_host_h}~ ; then
1784 fi 1785 fi
1785 fi 1786 fi
1786 1787
  1788 +# generate list of library paths for linker script
  1789 +
  1790 +$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
  1791 +
  1792 +if test -f ${config_host_ld}~ ; then
  1793 + if cmp -s $config_host_ld ${config_host_ld}~ ; then
  1794 + mv ${config_host_ld}~ $config_host_ld
  1795 + else
  1796 + rm ${config_host_ld}~
  1797 + fi
  1798 +fi
  1799 +
1787 for target in $target_list; do 1800 for target in $target_list; do
1788 target_dir="$target" 1801 target_dir="$target"
1789 config_mak=$target_dir/config.mak 1802 config_mak=$target_dir/config.mak
@@ -2049,7 +2062,7 @@ if test &quot;$target_linux_user&quot; = &quot;yes&quot; -o &quot;$target_linux_user&quot; = &quot;yes&quot; ; then @@ -2049,7 +2062,7 @@ if test &quot;$target_linux_user&quot; = &quot;yes&quot; -o &quot;$target_linux_user&quot; = &quot;yes&quot; ; then
2049 case "$ARCH" in 2062 case "$ARCH" in
2050 i386) 2063 i386)
2051 if test "$gprof" = "yes" -o "$static" = "yes" ; then 2064 if test "$gprof" = "yes" -o "$static" = "yes" ; then
2052 - ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld' 2065 + ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
2053 else 2066 else
2054 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object 2067 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
2055 # that the kernel ELF loader considers as an executable. I think this 2068 # that the kernel ELF loader considers as an executable. I think this
@@ -2059,20 +2072,20 @@ if test &quot;$target_linux_user&quot; = &quot;yes&quot; -o &quot;$target_linux_user&quot; = &quot;yes&quot; ; then @@ -2059,20 +2072,20 @@ if test &quot;$target_linux_user&quot; = &quot;yes&quot; -o &quot;$target_linux_user&quot; = &quot;yes&quot; ; then
2059 ;; 2072 ;;
2060 sparc) 2073 sparc)
2061 # -static is used to avoid g1/g3 usage by the dynamic linker 2074 # -static is used to avoid g1/g3 usage by the dynamic linker
2062 - ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static' 2075 + ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2063 ;; 2076 ;;
2064 ia64) 2077 ia64)
2065 - ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static' 2078 + ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2066 ;; 2079 ;;
2067 x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64) 2080 x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
2068 - ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld' 2081 + ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
2069 ;; 2082 ;;
2070 esac 2083 esac
2071 fi 2084 fi
2072 if test "$target_softmmu" = "yes" ; then 2085 if test "$target_softmmu" = "yes" ; then
2073 case "$ARCH" in 2086 case "$ARCH" in
2074 ia64) 2087 ia64)
2075 - ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static' 2088 + ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2076 ;; 2089 ;;
2077 esac 2090 esac
2078 fi 2091 fi
@@ -3,7 +3,6 @@ OUTPUT_FORMAT(&quot;elf32-hppa-linux&quot;, &quot;elf32-hppa-linux&quot;, @@ -3,7 +3,6 @@ OUTPUT_FORMAT(&quot;elf32-hppa-linux&quot;, &quot;elf32-hppa-linux&quot;,
3 "elf32-hppa-linux") 3 "elf32-hppa-linux")
4 OUTPUT_ARCH(hppa:hppa1.1) 4 OUTPUT_ARCH(hppa:hppa1.1)
5 ENTRY(_start) 5 ENTRY(_start)
6 -SEARCH_DIR("/usr/hppa-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");  
7 SECTIONS 6 SECTIONS
8 { 7 {
9 /* Read-only sections, merged into text segment: */ 8 /* Read-only sections, merged into text segment: */
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 */ 3 */
4 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 4 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
5 OUTPUT_ARCH(i386) 5 OUTPUT_ARCH(i386)
6 -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);  
7 ENTRY(_start) 6 ENTRY(_start)
8 SECTIONS 7 SECTIONS
9 { 8 {
@@ -3,9 +3,7 @@ OUTPUT_FORMAT(&quot;elf64-ia64-little&quot;, &quot;elf64-ia64-little&quot;, @@ -3,9 +3,7 @@ OUTPUT_FORMAT(&quot;elf64-ia64-little&quot;, &quot;elf64-ia64-little&quot;,
3 "elf64-ia64-little") 3 "elf64-ia64-little")
4 OUTPUT_ARCH(ia64) 4 OUTPUT_ARCH(ia64)
5 ENTRY(_start) 5 ENTRY(_start)
6 -SEARCH_DIR("/usr/ia64-linux/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");  
7 -/* Do we need any of these for elf?  
8 - __DYNAMIC = 0; */ 6 +/* __DYNAMIC = 0; */
9 SECTIONS 7 SECTIONS
10 { 8 {
11 /* Read-only sections, merged into text segment: */ 9 /* Read-only sections, merged into text segment: */
@@ -3,9 +3,7 @@ OUTPUT_FORMAT(&quot;elf32-m68k&quot;, &quot;elf32-m68k&quot;, @@ -3,9 +3,7 @@ OUTPUT_FORMAT(&quot;elf32-m68k&quot;, &quot;elf32-m68k&quot;,
3 "elf32-m68k") 3 "elf32-m68k")
4 OUTPUT_ARCH(m68k) 4 OUTPUT_ARCH(m68k)
5 ENTRY(_start) 5 ENTRY(_start)
6 -SEARCH_DIR("/usr/local/m68k-linux/lib");  
7 -/* Do we need any of these for elf?  
8 - __DYNAMIC = 0; */ 6 +/* __DYNAMIC = 0; */
9 SECTIONS 7 SECTIONS
10 { 8 {
11 /* Read-only sections, merged into text segment: */ 9 /* Read-only sections, merged into text segment: */
@@ -3,7 +3,6 @@ OUTPUT_FORMAT(&quot;elf32-tradbigmips&quot;, &quot;elf32-tradbigmips&quot;, @@ -3,7 +3,6 @@ OUTPUT_FORMAT(&quot;elf32-tradbigmips&quot;, &quot;elf32-tradbigmips&quot;,
3 "elf32-tradlittlemips") 3 "elf32-tradlittlemips")
4 OUTPUT_ARCH(mips) 4 OUTPUT_ARCH(mips)
5 ENTRY(__start) 5 ENTRY(__start)
6 -SEARCH_DIR("/usr/mips-linux-gnu/lib");  
7 SECTIONS 6 SECTIONS
8 { 7 {
9 /* Read-only sections, merged into text segment: */ 8 /* Read-only sections, merged into text segment: */
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 */ 3 */
4 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") 4 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
5 OUTPUT_ARCH(powerpc:common) 5 OUTPUT_ARCH(powerpc:common)
6 -SEARCH_DIR(/usr/powerpc-linux-gnu/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib)  
7 ENTRY(_start) 6 ENTRY(_start)
8 SECTIONS 7 SECTIONS
9 { 8 {
ppc64.ld
@@ -3,13 +3,7 @@ OUTPUT_FORMAT(&quot;elf64-powerpc&quot;, &quot;elf64-powerpc&quot;, @@ -3,13 +3,7 @@ OUTPUT_FORMAT(&quot;elf64-powerpc&quot;, &quot;elf64-powerpc&quot;,
3 "elf64-powerpc") 3 "elf64-powerpc")
4 OUTPUT_ARCH(powerpc:common64) 4 OUTPUT_ARCH(powerpc:common64)
5 ENTRY(_start) 5 ENTRY(_start)
6 -SEARCH_DIR("/usr/powerpc64-unknown-linux-gnu/lib64");  
7 -SEARCH_DIR("/usr/lib/binutils/powerpc64-unknown-linux-gnu/2.16.164");  
8 -SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64");  
9 -SEARCH_DIR("/usr/powerpc64-unknown-linux-gnu/lib");  
10 -SEARCH_DIR("/usr/lib/binutils/powerpc64-unknown-linux-gnu/2.16.1");  
11 -SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); /* Do we  
12 -need any of these for elf? + __DYNAMIC = 0; */ 6 +/* __DYNAMIC = 0; */
13 SECTIONS 7 SECTIONS
14 { 8 {
15 /* Read-only sections, merged into text segment: */ 9 /* Read-only sections, merged into text segment: */
@@ -2,9 +2,7 @@ OUTPUT_FORMAT(&quot;elf32-s390&quot;, &quot;elf32-s390&quot;, @@ -2,9 +2,7 @@ OUTPUT_FORMAT(&quot;elf32-s390&quot;, &quot;elf32-s390&quot;,
2 "elf32-s390") 2 "elf32-s390")
3 OUTPUT_ARCH(s390:31-bit) 3 OUTPUT_ARCH(s390:31-bit)
4 ENTRY(_start) 4 ENTRY(_start)
5 -SEARCH_DIR("/usr/s390-redhat-linux/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib");  
6 -/* Do we need any of these for elf?  
7 - __DYNAMIC = 0; */ 5 +/* __DYNAMIC = 0; */
8 SECTIONS 6 SECTIONS
9 { 7 {
10 /* Read-only sections, merged into text segment: */ 8 /* Read-only sections, merged into text segment: */
sparc.ld
1 OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", 1 OUTPUT_FORMAT("elf32-sparc", "elf32-sparc",
2 "elf32-sparc") 2 "elf32-sparc")
3 OUTPUT_ARCH(sparc) 3 OUTPUT_ARCH(sparc)
4 -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);  
5 ENTRY(_start) 4 ENTRY(_start)
6 SECTIONS 5 SECTIONS
7 { 6 {
sparc64.ld
1 OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", 1 OUTPUT_FORMAT("elf64-sparc", "elf64-sparc",
2 "elf64-sparc") 2 "elf64-sparc")
3 OUTPUT_ARCH(sparc:v9) 3 OUTPUT_ARCH(sparc:v9)
4 -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);  
5 ENTRY(_start) 4 ENTRY(_start)
6 SECTIONS 5 SECTIONS
7 { 6 {
x86_64.ld
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") 2 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
3 OUTPUT_ARCH(i386:x86-64) 3 OUTPUT_ARCH(i386:x86-64)
4 ENTRY(_start) 4 ENTRY(_start)
5 -SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");  
6 SECTIONS 5 SECTIONS
7 { 6 {
8 /* Read-only sections, merged into text segment: */ 7 /* Read-only sections, merged into text segment: */