* configure.host: Add x86_64-*-cygwin* as valid host.
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 5 Mar 2013 11:54:29 +0000 (11:54 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 5 Mar 2013 11:54:29 +0000 (11:54 +0000)
* configure.tgt: Add x86_64-*-cygwin* as valid target.
* emultempl/pep.em: Handle different requirements for Cygwin in terms
of start addresses for executables and DLLs, based on memory model in
http://cygwin.com/ml/cygwin-developers/2013-02/msg00027.html

ld/ChangeLog
ld/configure.host
ld/configure.tgt
ld/emultempl/pep.em

index d24b2661ed1ed65115b1cbefd8ffebdf139d3428..ec75b6b001195e6b676bbbd700f49161c1c58495 100644 (file)
@@ -1,3 +1,11 @@
+2013-03-05  Corinna Vinschen  <vinschen@redhat.com>
+
+       * configure.host: Add x86_64-*-cygwin* as valid host.
+       * configure.tgt: Add x86_64-*-cygwin* as valid target.
+       * emultempl/pep.em: Handle different requirements for Cygwin in terms
+       of start addresses for executables and DLLs, based on memory model in
+       http://cygwin.com/ml/cygwin-developers/2013-02/msg00027.html
+
 2013-03-05  Alan Modra  <amodra@gmail.com>
 
        PR ld/15222
index ab7bc7dbe5fdaf2e7023e52b3360856e0c937b7c..c56f67debebab794c8e953c44fd9d4187a1a7da2 100644 (file)
@@ -171,7 +171,7 @@ i[3-7]86-pc-interix*)
   HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
   ;;
 
-i[3-7]86-*-cygwin*)
+i[3-7]86-*-cygwin* | x86_64-*-cygwin*)
   HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -L/usr/lib/w32api -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
   ;;
 
index b015dde1e20f0f52ce7be4ef2ee4848d0c30b3b1..3b06dd39d3b3d59d63f233f4dd68335587277980 100644 (file)
@@ -316,6 +316,10 @@ i[3-7]86-*-mingw32*)       targ_emul=i386pe ;
 x86_64-*-pe | x86_64-*-pep) targ_emul=i386pep ;
                        targ_extra_emuls=i386pe ;
                        targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
+x86_64-*-cygwin)       targ_emul=i386pep ;
+                       targ_extra_emuls=i386pe
+                       targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
+                       test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;;
 x86_64-*-mingw*)       targ_emul=i386pep ;
                        targ_extra_emuls=i386pe
                        targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
@@ -821,7 +825,7 @@ spu-*-elf*)
   NATIVE_LIB_DIRS='/lib'
   ;;
 
-i[03-9x]86-*-cygwin*)
+i[03-9x]86-*-cygwin* | x86_64-*-cygwin*)
   NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api'
   ;;
 
index 12b7598bf5ec8ec79f1277c77a69720c0cce50fa..3e8b65e19a290d15a8a1d6cc26aa219f9222e719 100644 (file)
@@ -5,6 +5,16 @@ if [ -z "$MACHINE" ]; then
 else
   OUTPUT_ARCH=${ARCH}:${MACHINE}
 fi
+
+case ${target} in
+  *-*-cygwin*)
+    move_default_addr_high=1
+    ;;
+  *)
+    move_default_addr_high=0;
+    ;;
+esac
+
 rm -f e${EMULATION_NAME}.c
 (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
 fragment <<EOF
@@ -89,9 +99,39 @@ fragment <<EOF
 
 #if defined(TARGET_IS_i386pep) || ! defined(DLL_SUPPORT)
 #define        PE_DEF_SUBSYSTEM                3
+#undef NT_EXE_IMAGE_BASE
+#define NT_EXE_IMAGE_BASE \
+  ((bfd_vma) (${move_default_addr_high} ? 0x100400000LL \
+                                       : 0x400000LL))
+#undef NT_DLL_IMAGE_BASE
+#define NT_DLL_IMAGE_BASE \
+  ((bfd_vma) (${move_default_addr_high} ? 0x400000000LL \
+                                       : 0x10000000LL))
+#undef NT_DLL_AUTO_IMAGE_BASE
+#define NT_DLL_AUTO_IMAGE_BASE \
+  ((bfd_vma) (${move_default_addr_high} ? 0x400000000LL \
+                                       : 0x61300000LL))
+#undef NT_DLL_AUTO_IMAGE_MASK
+#define NT_DLL_AUTO_IMAGE_MASK \
+  ((bfd_vma) (${move_default_addr_high} ? 0x1ffff0000LL \
+                                       : 0x0ffc0000LL))
 #else
 #undef  NT_EXE_IMAGE_BASE
-#define NT_EXE_IMAGE_BASE              0x00010000
+#define NT_EXE_IMAGE_BASE \
+  ((bfd_vma) (${move_default_addr_high} ? 0x100010000LL \
+                                       : 0x10000LL))
+#undef NT_DLL_IMAGE_BASE
+#define NT_DLL_IMAGE_BASE \
+  ((bfd_vma) (${move_default_addr_high} ? 0x110000000LL \
+                                       : 0x10000000LL))
+#undef NT_DLL_AUTO_IMAGE_BASE
+#define NT_DLL_AUTO_IMAGE_BASE \
+  ((bfd_vma) (${move_default_addr_high} ? 0x120000000LL \
+                                       : 0x61300000LL))
+#undef NT_DLL_AUTO_IMAGE_MASK
+#define NT_DLL_AUTO_IMAGE_MASK \
+  ((bfd_vma) (${move_default_addr_high} ? 0x0ffff0000LL \
+                                       : 0x0ffc0000LL))
 #undef  PE_DEF_SECTION_ALIGNMENT
 #define        PE_DEF_SUBSYSTEM                2
 #undef  PE_DEF_FILE_ALIGNMENT
@@ -808,7 +848,7 @@ static bfd_vma
 compute_dll_image_base (const char *ofile)
 {
   bfd_vma hash = (bfd_vma) strhash (ofile);
-  return 0x61300000 + ((hash << 16) & 0x0FFC0000);
+  return NT_DLL_AUTO_IMAGE_BASE + ((hash << 16) & NT_DLL_AUTO_IMAGE_MASK);
 }
 #endif