* [Qemu-devel] [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script
@ 2009-07-22 20:37 Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 1/3] our build system don't support mips little endian linux-user or bsd-user Juan Quintela
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Juan Quintela @ 2009-07-22 20:37 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Hi
As requested for Anthony, we use as search path the output of:
ld --verbose -v | grep SEARCH_PATH
Anthony suggestion was to use a INCLUDE in the linker script, but it got
complicated because we have a relative path, and we want to get it working
with VPATH ....
Then I decided to use a second linker script for the search path instead of
one INCLUDE.
Once playing with linker scripts, just:
a- remove mips little endian linker scripts. Rest of the build system don't
support them at all (and they are the same than for big endian)
b- once here, instead of repeating the LDFLAGS line for each architecture,
just generate it in a single place in configure
c- now that there are few places, add the new linker script.
Comments?
Later, Juan.
Changes from v1/v2:
- complete different approach
Juan Quintela (3):
our build system don't support mips little endian linux-user or
bsd-user
generate LDFLAGS for *-linux-user and *-bsd-user in a single place in
configure
set SEARCH_PATH for the linker script from output of ld --verbose -v
Makefile | 2 +-
Makefile.target | 148 ------------------------------------
alpha.ld | 1 -
arm.ld | 1 -
configure | 52 +++++++++++++
hppa.ld | 1 -
i386.ld | 1 -
ia64.ld | 4 +-
m68k.ld | 4 +-
mips.ld | 1 -
mipsel.ld | 225 -------------------------------------------------------
ppc.ld | 1 -
ppc64.ld | 8 +--
s390.ld | 4 +-
sparc.ld | 1 -
sparc64.ld | 1 -
x86_64.ld | 1 -
17 files changed, 57 insertions(+), 399 deletions(-)
delete mode 100644 mipsel.ld
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 1/3] our build system don't support mips little endian linux-user or bsd-user
2009-07-22 20:37 [Qemu-devel] [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Juan Quintela
@ 2009-07-22 20:37 ` Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 2/3] generate LDFLAGS for *-linux-user and *-bsd-user in a single place in configure Juan Quintela
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Juan Quintela @ 2009-07-22 20:37 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
Makefile.target | 16 ----
mipsel.ld | 225 -------------------------------------------------------
2 files changed, 0 insertions(+), 241 deletions(-)
delete mode 100644 mipsel.ld
diff --git a/Makefile.target b/Makefile.target
index f9cd42a..f47d534 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -238,19 +238,11 @@ LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
ifeq ($(ARCH),mips)
-ifeq ($(WORDS_BIGENDIAN),yes)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-else
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
-endif
endif
ifeq ($(ARCH),mips64)
-ifeq ($(WORDS_BIGENDIAN),yes)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-else
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
-endif
endif
# profiling code
@@ -385,19 +377,11 @@ LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
ifeq ($(ARCH),mips)
-ifeq ($(WORDS_BIGENDIAN),yes)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-else
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
-endif
endif
ifeq ($(ARCH),mips64)
-ifeq ($(WORDS_BIGENDIAN),yes)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-else
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
-endif
endif
obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
diff --git a/mipsel.ld b/mipsel.ld
deleted file mode 100644
index e37938c..0000000
--- a/mipsel.ld
+++ /dev/null
@@ -1,225 +0,0 @@
-/* Default linker script, for normal executables */
-OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips",
- "elf32-tradlittlemips")
-OUTPUT_ARCH(mips)
-ENTRY(__start)
-SEARCH_DIR("/usr/mips-linux-gnu/lib");
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS;
- .interp : { *(.interp) }
- .reginfo : { *(.reginfo) }
- .dynamic : { *(.dynamic) }
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .gnu.version : { *(.gnu.version) }
- .gnu.version_d : { *(.gnu.version_d) }
- .gnu.version_r : { *(.gnu.version_r) }
- .rel.init : { *(.rel.init) }
- .rela.init : { *(.rela.init) }
- .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
- .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
- .rel.fini : { *(.rel.fini) }
- .rela.fini : { *(.rela.fini) }
- .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
- .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
- .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
- .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
- .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
- .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
- .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
- .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
- .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
- .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
- .rel.ctors : { *(.rel.ctors) }
- .rela.ctors : { *(.rela.ctors) }
- .rel.dtors : { *(.rel.dtors) }
- .rela.dtors : { *(.rela.dtors) }
- .rel.got : { *(.rel.got) }
- .rela.got : { *(.rela.got) }
- .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
- .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
- .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
- .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
- .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
- .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
- .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
- .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
- .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
- .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
- .rel.plt : { *(.rel.plt) }
- .rela.plt : { *(.rela.plt) }
- .init :
- {
- KEEP (*(.init))
- } =0x47ff041f
- .plt : { *(.plt) }
- .text :
- {
- _ftext = . ;
- *(.text .stub .text.* .gnu.linkonce.t.*)
- KEEP (*(.text.*personality*))
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.mips16.fn.*) *(.mips16.call.*)
- } =0x47ff041f
- .fini :
- {
- KEEP (*(.fini))
- } =0x47ff041f
- PROVIDE (__etext = .);
- PROVIDE (_etext = .);
- PROVIDE (etext = .);
- .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
- .rodata1 : { *(.rodata1) }
- .sdata2 :
- {
- *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
- }
- .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
- .eh_frame_hdr : { *(.eh_frame_hdr) }
- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
- /* Adjust the address for the data segment. We want to adjust up to
- the same address within the page on the next page up. */
- . = ALIGN (0x40000) - ((0x40000 - .) & (0x40000 - 1)); . = DATA_SEGMENT_ALIGN (0x40000, 0x1000);
- /* Exception handling */
- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
- /* Thread Local Storage sections */
- .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
- .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
- .preinit_array :
- {
- PROVIDE_HIDDEN (__preinit_array_start = .);
- KEEP (*(.preinit_array))
- PROVIDE_HIDDEN (__preinit_array_end = .);
- }
- .init_array :
- {
- PROVIDE_HIDDEN (__init_array_start = .);
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- PROVIDE_HIDDEN (__init_array_end = .);
- }
- .fini_array :
- {
- PROVIDE_HIDDEN (__fini_array_start = .);
- KEEP (*(.fini_array))
- KEEP (*(SORT(.fini_array.*)))
- PROVIDE_HIDDEN (__fini_array_end = .);
- }
- .ctors :
- {
- /* gcc uses crtbegin.o to find the start of
- the constructors, so we make sure it is
- first. Because this is a wildcard, it
- doesn't matter if the user does not
- actually link against crtbegin.o; the
- linker won't look for a file to match a
- wildcard. The wildcard also means that it
- doesn't matter which directory crtbegin.o
- is in. */
- KEEP (*crtbegin*.o(.ctors))
- /* We don't want to include the .ctor section from
- the crtend.o file until after the sorted ctors.
- The .ctor section from the crtend file contains the
- end of ctors marker and it must be last */
- KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
- KEEP (*(SORT(.ctors.*)))
- KEEP (*(.ctors))
- }
- .dtors :
- {
- KEEP (*crtbegin*.o(.dtors))
- KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
- KEEP (*(SORT(.dtors.*)))
- KEEP (*(.dtors))
- }
- .jcr : { KEEP (*(.jcr)) }
- .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
- . = DATA_SEGMENT_RELRO_END (0, .);
- .data :
- {
- _fdata = . ;
- *(.data .data.* .gnu.linkonce.d.*)
- KEEP (*(.gnu.linkonce.d.*personality*))
- SORT(CONSTRUCTORS)
- }
- .data1 : { *(.data1) }
- . = .;
- _gp = ALIGN(16) + 0x7ff0;
- .got : { *(.got.plt) *(.got) }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata :
- {
- *(.sdata .sdata.* .gnu.linkonce.s.*)
- }
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
- _edata = .; PROVIDE (edata = .);
- __bss_start = .;
- _fbss = .;
- .sbss :
- {
- *(.dynsbss)
- *(.sbss .sbss.* .gnu.linkonce.sb.*)
- *(.scommon)
- }
- .bss :
- {
- *(.dynbss)
- *(.bss .bss.* .gnu.linkonce.b.*)
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections.
- FIXME: Why do we need it? When there is no .bss section, we don't
- pad the .data section. */
- . = ALIGN(. != 0 ? 32 / 8 : 1);
- }
- . = ALIGN(32 / 8);
- . = ALIGN(32 / 8);
- _end = .; PROVIDE (end = .);
- . = DATA_SEGMENT_END (.);
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
- /* DWARF debug sections.
- Symbols in the DWARF debugging sections are relative to the beginning
- of the section so we begin them at 0. */
- /* DWARF 1 */
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
- .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
- /DISCARD/ : { *(.note.GNU-stack) }
-}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/3] generate LDFLAGS for *-linux-user and *-bsd-user in a single place in configure
2009-07-22 20:37 [Qemu-devel] [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 1/3] our build system don't support mips little endian linux-user or bsd-user Juan Quintela
@ 2009-07-22 20:37 ` Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 3/3] set SEARCH_PATH for the linker script from output of ld --verbose -v Juan Quintela
2009-07-23 7:54 ` [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Paolo Bonzini
3 siblings, 0 replies; 8+ messages in thread
From: Juan Quintela @ 2009-07-22 20:37 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Remove lots of duplicate code in the process
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
Makefile.target | 132 -------------------------------------------------------
configure | 39 ++++++++++++++++
2 files changed, 39 insertions(+), 132 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index f47d534..912ac62 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -179,72 +179,6 @@ ifdef CONFIG_STATIC
LDFLAGS+=-static
endif
-ifeq ($(ARCH),i386)
-ifdef TARGET_GPROF
-USE_I386_LD=y
-endif
-ifdef CONFIG_STATIC
-USE_I386_LD=y
-endif
-ifdef USE_I386_LD
-LDFLAGS+=-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
-# is the simplest way to make it self virtualizable!
-LDFLAGS+=-Wl,-shared
-endif
-endif
-
-ifeq ($(ARCH),x86_64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),s390)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),sparc)
-# -static is used to avoid g1/g3 usage by the dynamic linker
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
-endif
-
-ifeq ($(ARCH),sparc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),alpha)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ia64)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),arm)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),m68k)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
# profiling code
ifdef TARGET_GPROF
LDFLAGS+=-p
@@ -318,72 +252,6 @@ ifdef CONFIG_STATIC
LDFLAGS+=-static
endif
-ifeq ($(ARCH),i386)
-ifdef TARGET_GPROF
-USE_I386_LD=y
-endif
-ifdef CONFIG_STATIC
-USE_I386_LD=y
-endif
-ifdef USE_I386_LD
-LDFLAGS+=-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
-# is the simplest way to make it self virtualizable!
-LDFLAGS+=-Wl,-shared
-endif
-endif
-
-ifeq ($(ARCH),x86_64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),s390)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),sparc)
-# -static is used to avoid g1/g3 usage by the dynamic linker
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
-endif
-
-ifeq ($(ARCH),sparc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),alpha)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ia64)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),arm)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),m68k)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
gdbstub.o gdbstub-xml.o ioport-user.o
obj-y += uaccess.o
diff --git a/configure b/configure
index e9ed09d..81c855d 100755
--- a/configure
+++ b/configure
@@ -2098,6 +2098,45 @@ if test "$target_bsd_user" = "yes" ; then
echo "CONFIG_BSD_USER=y" >> $config_mak
fi
+# generate LDFLAGS for targets
+
+ldflags=""
+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'
+ 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
+ # is the simplest way to make it self virtualizable!
+ ldflags='-Wl,-shared'
+ fi
+ ;;
+ sparc)
+ # -static is used to avoid g1/g3 usage by the dynamic linker
+ ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+ ;;
+ ia64)
+ ldflags='-Wl,-G0 -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'
+ ;;
+ esac
+fi
+if test "$target_softmmu" = "yes" ; then
+ case "$ARCH" in
+ ia64)
+ ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+ ;;
+ esac
+fi
+
+if test "$ldflags" != "" ; then
+ echo "LDFLAGS+=$ldflags" >> $config_mak
+fi
+
$source_path/create_config < $config_mak > $config_h
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
--
1.6.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 3/3] set SEARCH_PATH for the linker script from output of ld --verbose -v
2009-07-22 20:37 [Qemu-devel] [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 1/3] our build system don't support mips little endian linux-user or bsd-user Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 2/3] generate LDFLAGS for *-linux-user and *-bsd-user in a single place in configure Juan Quintela
@ 2009-07-22 20:37 ` Juan Quintela
2009-07-23 7:54 ` [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Paolo Bonzini
3 siblings, 0 replies; 8+ messages in thread
From: Juan Quintela @ 2009-07-22 20:37 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
Makefile | 2 +-
alpha.ld | 1 -
arm.ld | 1 -
configure | 23 ++++++++++++++++++-----
hppa.ld | 1 -
i386.ld | 1 -
ia64.ld | 4 +---
m68k.ld | 4 +---
mips.ld | 1 -
ppc.ld | 1 -
ppc64.ld | 8 +-------
s390.ld | 4 +---
sparc.ld | 1 -
sparc64.ld | 1 -
x86_64.ld | 1 -
15 files changed, 23 insertions(+), 31 deletions(-)
diff --git a/Makefile b/Makefile
index dc95869..8bd705e 100644
--- a/Makefile
+++ b/Makefile
@@ -240,7 +240,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 ; \
diff --git a/alpha.ld b/alpha.ld
index 0975443..906d76b 100644
--- 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 93285d6..12b3edb 100644
--- 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: */
diff --git a/configure b/configure
index 81c855d..9db7f28 100755
--- a/configure
+++ b/configure
@@ -1483,6 +1483,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"
@@ -1840,6 +1841,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
@@ -2105,7 +2118,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$(SRC_PATH)/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
@@ -2115,20 +2128,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$(SRC_PATH)/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$(SRC_PATH)/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$(SRC_PATH)/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$(SRC_PATH)/config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
;;
esac
fi
diff --git a/hppa.ld b/hppa.ld
index 8ef7fa5..9a4b22c 100644
--- 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 9f4cb5b..f2dafec 100644
--- 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 8d2ede2..0c37796 100644
--- 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 28da902..0e3d9de 100644
--- 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 94fa63b..4294761 100644
--- 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 1e6bbe9..5248ef1 100644
--- 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
{
diff --git a/ppc64.ld b/ppc64.ld
index 1ba8883..dea0dbd 100644
--- 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 ccae2e7..a9c5370 100644
--- 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: */
diff --git a/sparc.ld b/sparc.ld
index 26ab415..5aed1c2 100644
--- 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
{
diff --git a/sparc64.ld b/sparc64.ld
index f728634..9ea4143 100644
--- a/sparc64.ld
+++ b/sparc64.ld
@@ -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
{
diff --git a/x86_64.ld b/x86_64.ld
index 878dafb..24ea77d 100644
--- 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: */
--
1.6.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script
2009-07-22 20:37 [Qemu-devel] [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Juan Quintela
` (2 preceding siblings ...)
2009-07-22 20:37 ` [Qemu-devel] [PATCH 3/3] set SEARCH_PATH for the linker script from output of ld --verbose -v Juan Quintela
@ 2009-07-23 7:54 ` Paolo Bonzini
2009-07-23 8:44 ` Juan Quintela
3 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2009-07-23 7:54 UTC (permalink / raw)
To: Juan Quintela; +Cc: aliguori, qemu-devel
> As requested for Anthony, we use as search path the output of:
>
> ld --verbose -v | grep SEARCH_PATH
>
> Anthony suggestion was to use a INCLUDE in the linker script, but it got
> complicated because we have a relative path, and we want to get it working
> with VPATH ....
>
> Then I decided to use a second linker script for the search path instead of
> one INCLUDE.
I don't understand one thing. Is this patch now using the linker script
for all architectures? If so, it should be enough to call it
LDFLAGS_USER and add LDFLAGS+=$(USER_LDFLAGS) where the configuration of
linker scripts used to be done in the Makefile--or not?
BTW, maybe now the -Wl,-shared trick for self-virtualization can be
replaced with -fpie (position independent executable)?
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script
2009-07-23 7:54 ` [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Paolo Bonzini
@ 2009-07-23 8:44 ` Juan Quintela
2009-07-23 9:06 ` Paolo Bonzini
0 siblings, 1 reply; 8+ messages in thread
From: Juan Quintela @ 2009-07-23 8:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: aliguori, qemu-devel
Paolo Bonzini <pbonzini@redhat.com> wrote:
>> As requested for Anthony, we use as search path the output of:
>>
>> ld --verbose -v | grep SEARCH_PATH
>>
>> Anthony suggestion was to use a INCLUDE in the linker script, but it got
>> complicated because we have a relative path, and we want to get it working
>> with VPATH ....
>>
>> Then I decided to use a second linker script for the search path instead of
>> one INCLUDE.
>
> I don't understand one thing. Is this patch now using the linker
> script for all architectures? If so, it should be enough to call it
> LDFLAGS_USER and add LDFLAGS+=$(USER_LDFLAGS) where the configuration
> of linker scripts used to be done in the Makefile--or not?
It is using the linker scripts for everything that was using it before,
not a single more, neither a single less.
Just a bit of DRY, putting the commond code in a single place.
> BTW, maybe now the -Wl,-shared trick for self-virtualization can be
> replaced with -fpie (position independent executable)?
That is far away of my knowledge. That is clearly not my call.
Later, Juan.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script
2009-07-23 8:44 ` Juan Quintela
@ 2009-07-23 9:06 ` Paolo Bonzini
2009-07-23 9:11 ` Juan Quintela
0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2009-07-23 9:06 UTC (permalink / raw)
To: Juan Quintela; +Cc: aliguori, qemu-devel
On 07/23/2009 10:44 AM, Juan Quintela wrote:
> It is using the linker scripts for everything that was using it before,
> not a single more, neither a single less.
>
> Just a bit of DRY, putting the commond code in a single place.
Good, then it should be ok with respect to Paul Brook's remark.
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script
2009-07-23 9:06 ` Paolo Bonzini
@ 2009-07-23 9:11 ` Juan Quintela
0 siblings, 0 replies; 8+ messages in thread
From: Juan Quintela @ 2009-07-23 9:11 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: aliguori, qemu-devel
Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 07/23/2009 10:44 AM, Juan Quintela wrote:
>> It is using the linker scripts for everything that was using it before,
>> not a single more, neither a single less.
>>
>> Just a bit of DRY, putting the commond code in a single place.
>
> Good, then it should be ok with respect to Paul Brook's remark.
That is my understanding. With respect t oPaul Brook remark, I don't
understand:
- how darwin-user don't use linker scripts
- why ia64 target softmmu uses it
But I guess that they are not fully functional yet can be a good
explanation.
Later, Juan.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-07-23 9:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 20:37 [Qemu-devel] [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 1/3] our build system don't support mips little endian linux-user or bsd-user Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 2/3] generate LDFLAGS for *-linux-user and *-bsd-user in a single place in configure Juan Quintela
2009-07-22 20:37 ` [Qemu-devel] [PATCH 3/3] set SEARCH_PATH for the linker script from output of ld --verbose -v Juan Quintela
2009-07-23 7:54 ` [Qemu-devel] Re: [PATCH 0/3 v3] Change search path for libraries for x86_64 linker script Paolo Bonzini
2009-07-23 8:44 ` Juan Quintela
2009-07-23 9:06 ` Paolo Bonzini
2009-07-23 9:11 ` Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).