Commit 4bf6b55b346d33ff16dd25f75bbea8e21f95dfa6
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>
Showing
15 changed files
with
23 additions
and
31 deletions
Makefile
| ... | ... | @@ -225,7 +225,7 @@ clean: |
| 225 | 225 | done |
| 226 | 226 | |
| 227 | 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 | 229 | rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr} |
| 230 | 230 | for d in $(TARGET_DIRS) libhw32 libhw64; do \ |
| 231 | 231 | rm -rf $$d || exit 1 ; \ | ... | ... |
alpha.ld
| ... | ... | @@ -2,7 +2,6 @@ OUTPUT_FORMAT("elf64-alpha", "elf64-alpha", |
| 2 | 2 | "elf64-alpha") |
| 3 | 3 | OUTPUT_ARCH(alpha) |
| 4 | 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 | 5 | SECTIONS |
| 7 | 6 | { |
| 8 | 7 | /* Read-only sections, merged into text segment: */ | ... | ... |
arm.ld
| ... | ... | @@ -2,7 +2,6 @@ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", |
| 2 | 2 | "elf32-littlearm") |
| 3 | 3 | OUTPUT_ARCH(arm) |
| 4 | 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 | 5 | SECTIONS |
| 7 | 6 | { |
| 8 | 7 | /* Read-only sections, merged into text segment: */ | ... | ... |
configure
| ... | ... | @@ -1477,6 +1477,7 @@ fi |
| 1477 | 1477 | |
| 1478 | 1478 | config_host_mak="config-host.mak" |
| 1479 | 1479 | config_host_h="config-host.h" |
| 1480 | +config_host_ld="config-host.ld" | |
| 1480 | 1481 | |
| 1481 | 1482 | #echo "Creating $config_host_mak and $config_host_h" |
| 1482 | 1483 | |
| ... | ... | @@ -1784,6 +1785,18 @@ if test -f ${config_host_h}~ ; then |
| 1784 | 1785 | fi |
| 1785 | 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 | 1800 | for target in $target_list; do |
| 1788 | 1801 | target_dir="$target" |
| 1789 | 1802 | config_mak=$target_dir/config.mak |
| ... | ... | @@ -2049,7 +2062,7 @@ if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then |
| 2049 | 2062 | case "$ARCH" in |
| 2050 | 2063 | i386) |
| 2051 | 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 | 2066 | else |
| 2054 | 2067 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object |
| 2055 | 2068 | # 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 |
| 2059 | 2072 | ;; |
| 2060 | 2073 | sparc) |
| 2061 | 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 | 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 | 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 | 2083 | esac |
| 2071 | 2084 | fi |
| 2072 | 2085 | if test "$target_softmmu" = "yes" ; then |
| 2073 | 2086 | case "$ARCH" in |
| 2074 | 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 | 2090 | esac |
| 2078 | 2091 | fi | ... | ... |
hppa.ld
| ... | ... | @@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-hppa-linux", "elf32-hppa-linux", |
| 3 | 3 | "elf32-hppa-linux") |
| 4 | 4 | OUTPUT_ARCH(hppa:hppa1.1) |
| 5 | 5 | ENTRY(_start) |
| 6 | -SEARCH_DIR("/usr/hppa-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); | |
| 7 | 6 | SECTIONS |
| 8 | 7 | { |
| 9 | 8 | /* Read-only sections, merged into text segment: */ | ... | ... |
i386.ld
ia64.ld
| ... | ... | @@ -3,9 +3,7 @@ OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little", |
| 3 | 3 | "elf64-ia64-little") |
| 4 | 4 | OUTPUT_ARCH(ia64) |
| 5 | 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 | 7 | SECTIONS |
| 10 | 8 | { |
| 11 | 9 | /* Read-only sections, merged into text segment: */ | ... | ... |
m68k.ld
| ... | ... | @@ -3,9 +3,7 @@ OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", |
| 3 | 3 | "elf32-m68k") |
| 4 | 4 | OUTPUT_ARCH(m68k) |
| 5 | 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 | 7 | SECTIONS |
| 10 | 8 | { |
| 11 | 9 | /* Read-only sections, merged into text segment: */ | ... | ... |
mips.ld
ppc.ld
ppc64.ld
| ... | ... | @@ -3,13 +3,7 @@ OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", |
| 3 | 3 | "elf64-powerpc") |
| 4 | 4 | OUTPUT_ARCH(powerpc:common64) |
| 5 | 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 | 7 | SECTIONS |
| 14 | 8 | { |
| 15 | 9 | /* Read-only sections, merged into text segment: */ | ... | ... |
s390.ld
| ... | ... | @@ -2,9 +2,7 @@ OUTPUT_FORMAT("elf32-s390", "elf32-s390", |
| 2 | 2 | "elf32-s390") |
| 3 | 3 | OUTPUT_ARCH(s390:31-bit) |
| 4 | 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 | 6 | SECTIONS |
| 9 | 7 | { |
| 10 | 8 | /* Read-only sections, merged into text segment: */ | ... | ... |
sparc.ld
sparc64.ld
| 1 | 1 | OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", |
| 2 | 2 | "elf64-sparc") |
| 3 | 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 | 4 | ENTRY(_start) |
| 6 | 5 | SECTIONS |
| 7 | 6 | { | ... | ... |
x86_64.ld
| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") |
| 3 | 3 | OUTPUT_ARCH(i386:x86-64) |
| 4 | 4 | ENTRY(_start) |
| 5 | -SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64"); | |
| 6 | 5 | SECTIONS |
| 7 | 6 | { |
| 8 | 7 | /* Read-only sections, merged into text segment: */ | ... | ... |