2010-05-25 Kai Tietz <kai.tietz@onevision.com>
authorKai Tietz <kai.tietz@onevision.com>
Tue, 25 May 2010 10:00:25 +0000 (10:00 +0000)
committerKai Tietz <kai.tietz@onevision.com>
Tue, 25 May 2010 10:00:25 +0000 (10:00 +0000)
        * emultempl/pe.em (default_merge_rdata): New shell variable.
        (MERGE_RDATA_V2): New macro.
        (gld_${EMULATION_NAME}_get_script): Adjust rule for auto-import
        selected script.

ld/ChangeLog
ld/emultempl/pe.em

index 5c1f94b7525fc490434dbbb15b215e7bcceec6ae..e5afd7539cda9d740b64828d7421c550207132ac 100644 (file)
@@ -1,3 +1,10 @@
+2010-05-25  Kai Tietz  <kai.tietz@onevision.com>
+
+       * emultempl/pe.em (default_merge_rdata): New shell variable.
+       (MERGE_RDATA_V2): New macro.
+       (gld_${EMULATION_NAME}_get_script): Adjust rule for auto-import
+       selected script.
+
 2010-05-15  Kai Tietz  <kai.tietz@onevision.com>
 
        * emultempl/pe.em (is_underscoring): New helper function.
index ca82fa8221c34b2ece6afdde7d50d4fe10c47b9a..3185336c18bbd22a51ac066017d0590759906945 100644 (file)
@@ -172,9 +172,15 @@ EOF
 case ${target} in
   *-*-cygwin*)
     default_auto_import=1
+    default_merge_rdata=1
+    ;;
+  *-w64-mingw*)
+    default_auto_import=1
+    default_merge_rdata=0
     ;;
   *)
     default_auto_import=-1
+    default_merge_rdata=1
     ;;
 esac
 
@@ -185,6 +191,10 @@ fragment <<EOF
 #endif
 }
 \f
+/* Indicates if RDATA shall be merged into DATA when pseudo-relocation
+   version 2 is used and auto-import is enabled.  */
+#define MERGE_RDATA_V2 ${default_merge_rdata}
+
 /* PE format extra command line options.  */
 
 /* Used for setting flags in the PE header.  */
@@ -2159,7 +2169,7 @@ sed $sc ldscripts/${EMULATION_NAME}.xbn                   >> e${EMULATION_NAME}.c
 echo '  ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xn                 >> e${EMULATION_NAME}.c
 if test -n "$GENERATE_AUTO_IMPORT_SCRIPT" ; then
-echo '  ; else if (link_info.pei386_auto_import == 1) return'  >> e${EMULATION_NAME}.c
+echo '  ; else if (link_info.pei386_auto_import == 1 && (MERGE_RDATA_V2 || link_info.pei386_runtime_pseudo_reloc != 2)) return'        >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xa                 >> e${EMULATION_NAME}.c
 fi
 echo '  ; else return'                                 >> e${EMULATION_NAME}.c