aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-elf/elf.exp16
-rw-r--r--ld/testsuite/ld-elf/empty-implib.out2
-rw-r--r--ld/testsuite/ld-elf/implib.rd11
-rw-r--r--ld/testsuite/ld-elf/implib.s22
4 files changed, 51 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index 2dfd0e8..832f313 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -136,6 +136,22 @@ foreach t $test_list {
run_dump_test [file rootname $t]
}
+# Check that the --out-implib option work correctly.
+run_ld_link_tests {
+ {"Generate empty import library"
+ "--out-implib=tmpdir/implib.lib" ""
+ "--defsym NO_GLOBAL=1"
+ {implib.s}
+ {{ld empty-implib.out}}
+ "implib"}
+ {"Generate import library"
+ "-Tdata=0x1000 --out-implib=tmpdir/implib.lib" ""
+ ""
+ {implib.s}
+ {{readelf {-s tmpdir/implib.lib} implib.rd}}
+ "implib"}
+}
+
if { [istarget *-*-linux*]
|| [istarget *-*-nacl*]
|| [istarget *-*-gnu*] } {
diff --git a/ld/testsuite/ld-elf/empty-implib.out b/ld/testsuite/ld-elf/empty-implib.out
new file mode 100644
index 0000000..b123064
--- /dev/null
+++ b/ld/testsuite/ld-elf/empty-implib.out
@@ -0,0 +1,2 @@
+.*: .*: no symbol found for import library
+.*: .*: failed to generate import library
diff --git a/ld/testsuite/ld-elf/implib.rd b/ld/testsuite/ld-elf/implib.rd
new file mode 100644
index 0000000..9f854a5
--- /dev/null
+++ b/ld/testsuite/ld-elf/implib.rd
@@ -0,0 +1,11 @@
+File: tmpdir/implib.lib
+
+Symbol table '.symtab' contains 3 entries:
+ Num: Value +Size Type Bind Vis Ndx Name
+ 0: [0-9a-f]+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+100[0-3] 1 OBJECT GLOBAL DEFAULT ABS exported1
+ 2: 0+100[0-3] 1 OBJECT GLOBAL DEFAULT ABS exported2
+
+File: tmpdir/implib
+
+#...
diff --git a/ld/testsuite/ld-elf/implib.s b/ld/testsuite/ld-elf/implib.s
new file mode 100644
index 0000000..a86a940
--- /dev/null
+++ b/ld/testsuite/ld-elf/implib.s
@@ -0,0 +1,22 @@
+.ifndef NO_GLOBAL
+ .bss
+ .comm exported1,1
+
+ .data
+ .global exported2
+ .type exported2, %object
+ .size exported2, 1
+exported2:
+ .byte 21
+.endif
+
+ .bss
+not_exported1:
+ .space 1
+ .size not_exported1, 1
+
+ .data
+ .type not_exported2, %object
+ .size not_exported2, 1
+not_exported2:
+ .byte 42