]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-pe/pe-compile.exp
Update copyright years
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-pe / pe-compile.exp
old mode 100755 (executable)
new mode 100644 (file)
index b9bc4af..ccc8516
@@ -1,7 +1,6 @@
 # Expect script for complex PE tests that require a C compiler
 # in addition to the just-built binutils.
-#   Copyright 2009
-#   Free Software Foundation, Inc.
+#   Copyright (C) 2009-2014 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -34,6 +33,47 @@ if { [which $CC] == 0 } {
     return
 }
 
+proc build_basefile1_o {} {
+    global CC
+    global CFLAGS
+    global srcdir
+    global subdir
+
+    # Compile the object file.
+    if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/basefile1.s tmpdir/basefile1.o] {
+       fail "compiling basefile1 object"
+    }
+}
+
+proc run_basefile_test { testname } {
+    global LD
+    global DLLTOOL
+    global srcdir
+    global subdir
+    global verbose
+
+    if ![ld_simple_link "$LD -e start \
+           --base-file=tmpdir/$testname.base \
+           --export-all-symbols" tmpdir/$testname.dll \
+           "tmpdir/basefile1.o"] {
+       fail "linking DLL"
+       return
+    }
+
+    if { $verbose > 2 } then { verbose "output is [file_contents tmpdir/$testname.base]" 3 }
+
+    catch "exec wc -c tmpdir/$testname.base" err
+
+    if ![string match "0 tmpdir/$testname.base" [string trim $err]] then {
+      send_log "$err\n"
+      if { $verbose == 2 } then { verbose "$err" 2 }
+      fail $testname
+      return
+    }
+
+    pass "$testname"
+}
+
 proc build_vers_script_dll_o {} {
     global CC
     global CFLAGS
@@ -77,14 +117,25 @@ run_ver_script_test "vers-script-2"
 run_ver_script_test "vers-script-3"
 run_ver_script_test "vers-script-4"
 
+if {[istarget i*86-*-cygwin*]
+    || [istarget i*86-*-pe]
+    || [istarget i*86-*-mingw*]
+    || [istarget x86_64-*-mingw*] } {
+
+   build_basefile1_o
+   run_basefile_test "basefile-secrel"
+ } else {
+    untested "PE basefile test"
+ }
+
 set align_tests {
-  {"aligned common 1" "" "" {aligncomm-1.c}
+  {"aligned common 1" "" "" "" {aligncomm-1.c}
    {{nm -C aligncomm.d}} "aligncomm-1.x"}
-  {"aligned common 2" "" "" {aligncomm-2.c}
+  {"aligned common 2" "" "" "" {aligncomm-2.c}
    {{nm -C aligncomm.d}} "aligncomm-2.x"}
-  {"aligned common 3" "" "" {aligncomm-3.c}
+  {"aligned common 3" "" "" "" {aligncomm-3.c}
    {{nm -C aligncomm.d}} "aligncomm-3.x"}
-  {"aligned common 4" "" "" {aligncomm-4.c}
+  {"aligned common 4" "" "" "" {aligncomm-4.c}
    {{nm -C aligncomm.d}} "aligncomm-4.x"}
 }