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>
This commit is contained in:
		
							parent
							
								
									fa282484b3
								
							
						
					
					
						commit
						4bf6b55b34
					
				
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@ -225,7 +225,7 @@ clean:
 | 
				
			|||||||
        done
 | 
					        done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
distclean: clean
 | 
					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}
 | 
						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 \
 | 
						for d in $(TARGET_DIRS) libhw32 libhw64; do \
 | 
				
			||||||
	rm -rf $$d || exit 1 ; \
 | 
						rm -rf $$d || exit 1 ; \
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								alpha.ld
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								alpha.ld
									
									
									
									
									
								
							@ -2,7 +2,6 @@ OUTPUT_FORMAT("elf64-alpha", "elf64-alpha",
 | 
				
			|||||||
	      "elf64-alpha")
 | 
						      "elf64-alpha")
 | 
				
			||||||
OUTPUT_ARCH(alpha)
 | 
					OUTPUT_ARCH(alpha)
 | 
				
			||||||
ENTRY(__start)
 | 
					ENTRY(__start)
 | 
				
			||||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								arm.ld
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								arm.ld
									
									
									
									
									
								
							@ -2,7 +2,6 @@ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm",
 | 
				
			|||||||
	      "elf32-littlearm")
 | 
						      "elf32-littlearm")
 | 
				
			||||||
OUTPUT_ARCH(arm)
 | 
					OUTPUT_ARCH(arm)
 | 
				
			||||||
ENTRY(_start)
 | 
					ENTRY(_start)
 | 
				
			||||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib);
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										23
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@ -1477,6 +1477,7 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
config_host_mak="config-host.mak"
 | 
					config_host_mak="config-host.mak"
 | 
				
			||||||
config_host_h="config-host.h"
 | 
					config_host_h="config-host.h"
 | 
				
			||||||
 | 
					config_host_ld="config-host.ld"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#echo "Creating $config_host_mak and $config_host_h"
 | 
					#echo "Creating $config_host_mak and $config_host_h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1784,6 +1785,18 @@ if test -f ${config_host_h}~ ; then
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
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
 | 
					for target in $target_list; do
 | 
				
			||||||
target_dir="$target"
 | 
					target_dir="$target"
 | 
				
			||||||
config_mak=$target_dir/config.mak
 | 
					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
 | 
					  case "$ARCH" in
 | 
				
			||||||
  i386)
 | 
					  i386)
 | 
				
			||||||
    if test "$gprof" = "yes" -o "$static" = "yes" ; then
 | 
					    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
 | 
					    else
 | 
				
			||||||
      # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 | 
					      # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 | 
				
			||||||
      # that the kernel ELF loader considers as an executable. I think this
 | 
					      # 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)
 | 
					  sparc)
 | 
				
			||||||
    # -static is used to avoid g1/g3 usage by the dynamic linker
 | 
					    # -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)
 | 
					  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)
 | 
					  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
 | 
					  esac
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if test "$target_softmmu" = "yes" ; then
 | 
					if test "$target_softmmu" = "yes" ; then
 | 
				
			||||||
  case "$ARCH" in
 | 
					  case "$ARCH" in
 | 
				
			||||||
  ia64)
 | 
					  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
 | 
					  esac
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								hppa.ld
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								hppa.ld
									
									
									
									
									
								
							@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-hppa-linux", "elf32-hppa-linux",
 | 
				
			|||||||
	      "elf32-hppa-linux")
 | 
						      "elf32-hppa-linux")
 | 
				
			||||||
OUTPUT_ARCH(hppa:hppa1.1)
 | 
					OUTPUT_ARCH(hppa:hppa1.1)
 | 
				
			||||||
ENTRY(_start)
 | 
					ENTRY(_start)
 | 
				
			||||||
SEARCH_DIR("/usr/hppa-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								i386.ld
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								i386.ld
									
									
									
									
									
								
							@ -3,7 +3,6 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 | 
					OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 | 
				
			||||||
OUTPUT_ARCH(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)
 | 
					ENTRY(_start)
 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								ia64.ld
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								ia64.ld
									
									
									
									
									
								
							@ -3,9 +3,7 @@ OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little",
 | 
				
			|||||||
	      "elf64-ia64-little")
 | 
						      "elf64-ia64-little")
 | 
				
			||||||
OUTPUT_ARCH(ia64)
 | 
					OUTPUT_ARCH(ia64)
 | 
				
			||||||
ENTRY(_start)
 | 
					ENTRY(_start)
 | 
				
			||||||
SEARCH_DIR("/usr/ia64-linux/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
 | 
					/* __DYNAMIC = 0;    */
 | 
				
			||||||
/* Do we need any of these for elf?
 | 
					 | 
				
			||||||
   __DYNAMIC = 0;    */
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								m68k.ld
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								m68k.ld
									
									
									
									
									
								
							@ -3,9 +3,7 @@ OUTPUT_FORMAT("elf32-m68k", "elf32-m68k",
 | 
				
			|||||||
	      "elf32-m68k")
 | 
						      "elf32-m68k")
 | 
				
			||||||
OUTPUT_ARCH(m68k)
 | 
					OUTPUT_ARCH(m68k)
 | 
				
			||||||
ENTRY(_start)
 | 
					ENTRY(_start)
 | 
				
			||||||
SEARCH_DIR("/usr/local/m68k-linux/lib");
 | 
					/* __DYNAMIC = 0;    */
 | 
				
			||||||
/* Do we need any of these for elf?
 | 
					 | 
				
			||||||
   __DYNAMIC = 0;    */
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								mips.ld
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								mips.ld
									
									
									
									
									
								
							@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips",
 | 
				
			|||||||
             "elf32-tradlittlemips")
 | 
					             "elf32-tradlittlemips")
 | 
				
			||||||
OUTPUT_ARCH(mips)
 | 
					OUTPUT_ARCH(mips)
 | 
				
			||||||
ENTRY(__start)
 | 
					ENTRY(__start)
 | 
				
			||||||
SEARCH_DIR("/usr/mips-linux-gnu/lib");
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								ppc.ld
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								ppc.ld
									
									
									
									
									
								
							@ -3,7 +3,6 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
 | 
					OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
 | 
				
			||||||
OUTPUT_ARCH(powerpc:common)
 | 
					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)
 | 
					ENTRY(_start)
 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								ppc64.ld
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								ppc64.ld
									
									
									
									
									
								
							@ -3,13 +3,7 @@ OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc",
 | 
				
			|||||||
	      "elf64-powerpc")
 | 
						      "elf64-powerpc")
 | 
				
			||||||
OUTPUT_ARCH(powerpc:common64)
 | 
					OUTPUT_ARCH(powerpc:common64)
 | 
				
			||||||
ENTRY(_start)
 | 
					ENTRY(_start)
 | 
				
			||||||
SEARCH_DIR("/usr/powerpc64-unknown-linux-gnu/lib64");
 | 
					/* __DYNAMIC = 0;    */
 | 
				
			||||||
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;    */
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								s390.ld
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								s390.ld
									
									
									
									
									
								
							@ -2,9 +2,7 @@ OUTPUT_FORMAT("elf32-s390", "elf32-s390",
 | 
				
			|||||||
	      "elf32-s390")
 | 
						      "elf32-s390")
 | 
				
			||||||
OUTPUT_ARCH(s390:31-bit)
 | 
					OUTPUT_ARCH(s390:31-bit)
 | 
				
			||||||
ENTRY(_start)
 | 
					ENTRY(_start)
 | 
				
			||||||
SEARCH_DIR("/usr/s390-redhat-linux/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib");
 | 
					/* __DYNAMIC = 0;    */
 | 
				
			||||||
/* Do we need any of these for elf?
 | 
					 | 
				
			||||||
   __DYNAMIC = 0;    */
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								sparc.ld
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								sparc.ld
									
									
									
									
									
								
							@ -1,7 +1,6 @@
 | 
				
			|||||||
OUTPUT_FORMAT("elf32-sparc", "elf32-sparc",
 | 
					OUTPUT_FORMAT("elf32-sparc", "elf32-sparc",
 | 
				
			||||||
              "elf32-sparc")
 | 
					              "elf32-sparc")
 | 
				
			||||||
OUTPUT_ARCH(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)
 | 
					ENTRY(_start)
 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,6 @@
 | 
				
			|||||||
OUTPUT_FORMAT("elf64-sparc", "elf64-sparc",
 | 
					OUTPUT_FORMAT("elf64-sparc", "elf64-sparc",
 | 
				
			||||||
              "elf64-sparc")
 | 
					              "elf64-sparc")
 | 
				
			||||||
OUTPUT_ARCH(sparc:v9)
 | 
					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)
 | 
					ENTRY(_start)
 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@
 | 
				
			|||||||
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
 | 
					OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
 | 
				
			||||||
OUTPUT_ARCH(i386:x86-64)
 | 
					OUTPUT_ARCH(i386:x86-64)
 | 
				
			||||||
ENTRY(_start)
 | 
					ENTRY(_start)
 | 
				
			||||||
SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");
 | 
					 | 
				
			||||||
SECTIONS
 | 
					SECTIONS
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  /* Read-only sections, merged into text segment: */
 | 
					  /* Read-only sections, merged into text segment: */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user