This commit was manufactured by cvs2svn to create branch 'binutils-
[external/binutils.git] / gold / testsuite / Makefile.am
index 33ae7c8..72917f9 100644 (file)
@@ -1005,6 +1005,18 @@ flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
 
 endif HAVE_ZLIB
 
+# Test -TText and -Tdata.
+check_PROGRAMS += flagstest_o_ttext_1
+flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
+       $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
+
+# This version won't be runnable, because there is no way to put the
+# PT_PHDR segment at file offset 0.  We just make sure that we can
+# build it without error.
+check_DATA += flagstest_o_ttext_2
+flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
+       $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
+
 # Test symbol versioning.
 check_PROGRAMS += ver_test
 ver_test_SOURCES = ver_test_main.cc
@@ -1163,6 +1175,14 @@ relro_test_pic.o: relro_test.cc
 relro_test.stdout: relro_test.so
        $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
 
+check_PROGRAMS += relro_now_test
+relro_now_test_SOURCES = relro_test_main.cc
+relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
+relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
+relro_now_test_LDADD = relro_now_test.so
+relro_now_test.so: gcctestdir/ld relro_test_pic.o
+       $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
+
 check_PROGRAMS += relro_strip_test
 relro_strip_test_SOURCES = relro_test_main.cc
 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
@@ -1201,6 +1221,16 @@ justsyms_2.o: justsyms_2.cc
 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
        gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
 
+check_PROGRAMS += justsyms_exec
+justsyms_exec_SOURCES = justsyms_exec.c
+justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
+justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
+justsyms_exec_LDADD =
+justsyms_lib.o: justsyms_lib.c
+       $(COMPILE) -c -o $@ $<
+justsyms_lib: justsyms_lib.o gcctestdir/ld
+       gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
+
 check_PROGRAMS += binary_test
 MOSTLYCLEANFILES += binary.txt
 binary_test_SOURCES = binary_test.cc
@@ -1634,6 +1664,7 @@ ifuncmain1pie.o: ifuncmain1.c
        $(COMPILE) -c -fpie -o $@ $<
 
 if HAVE_STATIC
+if IFUNC_STATIC
 check_PROGRAMS += ifuncmain1static
 ifuncmain1static_SOURCES = ifuncmain1.c
 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
@@ -1644,6 +1675,7 @@ check_PROGRAMS += ifuncmain1picstatic
 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
        $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
 endif
+endif
 
 check_PROGRAMS += ifuncmain1
 ifuncmain1_SOURCES = ifuncmain1.c
@@ -1692,6 +1724,7 @@ ifuncdep2pic.o: ifuncdep2.c
        $(COMPILE) -c -fpic -o $@ $<
 
 if HAVE_STATIC
+if IFUNC_STATIC
 check_PROGRAMS += ifuncmain2static
 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
@@ -1702,6 +1735,7 @@ check_PROGRAMS += ifuncmain2picstatic
 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
        $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
 endif
+endif
 
 check_PROGRAMS += ifuncmain2
 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
@@ -1728,6 +1762,7 @@ ifuncmain4pic.o: ifuncmain4.c
        $(COMPILE) -c -fpic -o $@ $<
 
 if HAVE_STATIC
+if IFUNC_STATIC
 check_PROGRAMS += ifuncmain4static
 ifuncmain4static_SOURCES = ifuncmain4.c
 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
@@ -1738,6 +1773,7 @@ check_PROGRAMS += ifuncmain4picstatic
 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
        $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
 endif
+endif
 
 check_PROGRAMS += ifuncmain4
 ifuncmain4_SOURCES = ifuncmain4.c
@@ -1760,6 +1796,7 @@ ifuncdep5.o: ifuncmod5.c
        $(COMPILE) -c -o $@ $<
 
 if HAVE_STATIC
+if IFUNC_STATIC
 check_PROGRAMS += ifuncmain5static
 ifuncmain5static_SOURCES = ifuncmain5.c
 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
@@ -1770,6 +1807,7 @@ check_PROGRAMS += ifuncmain5picstatic
 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
        $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
 endif
+endif
 
 check_PROGRAMS += ifuncmain5
 ifuncmain5_SOURCES = ifuncmain5.c
@@ -1808,6 +1846,7 @@ ifuncmain7pie.o: ifuncmain7.c
        $(COMPILE) -c -fpie -o $@ $<
 
 if HAVE_STATIC
+if IFUNC_STATIC
 check_PROGRAMS += ifuncmain7static
 ifuncmain7static_SOURCES = ifuncmain7.c
 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
@@ -1818,6 +1857,7 @@ check_PROGRAMS += ifuncmain7picstatic
 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
        $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
 endif
+endif
 
 check_PROGRAMS += ifuncmain7
 ifuncmain7_SOURCES = ifuncmain7.c
@@ -1833,6 +1873,18 @@ check_PROGRAMS += ifuncmain7pie
 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
        $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
 
+check_PROGRAMS += ifuncvar
+ifuncvar1_pic.o: ifuncvar1.c
+       $(COMPILE) -c -fpic -o $@ $<
+ifuncvar2_pic.o: ifuncvar2.c   
+       $(COMPILE) -c -fpic -o $@ $<
+ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
+       $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
+ifuncvar_SOURCES = ifuncvar3.c
+ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
+ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
+ifuncvar_LDADD = ifuncvar.so
+
 endif IFUNC
 
 # Test that strong reference to a weak symbol in a DSO remains strong.
@@ -1898,22 +1950,33 @@ memory_test.stdout: memory_test
 
 if DEFAULT_TARGET_X86_64
 
+two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
+       $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
+two_file_test_1_ndebug.o: two_file_test_1.cc
+       $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
+two_file_test_1b_ndebug.o: two_file_test_1b.cc
+       $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
+two_file_test_2_ndebug.o: two_file_test_2.cc
+       $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
+two_file_test_main_ndebug.o: two_file_test_main.cc
+       $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
+
 check_PROGRAMS += incremental_test_2
 MOSTLYCLEANFILES += two_file_test_tmp_2.o
-incremental_test_2: two_file_test_1_v1.o two_file_test_1.o two_file_test_1b.o \
-                   two_file_test_2.o two_file_test_main.o gcctestdir/ld
-       cp -f two_file_test_1_v1.o two_file_test_tmp_2.o
-       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o
+incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
+                   two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
+       cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
        @sleep 1
-       cp -f two_file_test_1.o two_file_test_tmp_2.o
-       $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o
+       cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
+       $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
 
 check_PROGRAMS += incremental_test_3
 MOSTLYCLEANFILES += two_file_test_tmp_3.o
 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
                    two_file_test_2.o two_file_test_main.o gcctestdir/ld
        cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
-       $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
        @sleep 1
        cp -f two_file_test_1b.o two_file_test_tmp_3.o
        $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
@@ -1923,16 +1986,42 @@ MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
                    two_file_test_2.o two_file_test_main.o gcctestdir/ld
        cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
-       $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
        mv -f incremental_test_4 incremental_test_4.base
        @sleep 1
        cp -f two_file_test_2.o two_file_test_tmp_4.o
        $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
 
+check_PROGRAMS += incremental_test_5
+MOSTLYCLEANFILES += two_file_test_5.a
+incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
+                   two_file_test_2.o two_file_test_main.o gcctestdir/ld
+       cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
+       $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
+       @sleep 1
+       cp -f two_file_test_1b.o two_file_test_tmp_5.o
+       $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
+       $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
+
+# Test the --incremental-unchanged flag with an archive library.
+# The second link should not update the library.
+check_PROGRAMS += incremental_test_6
+MOSTLYCLEANFILES += two_file_test_6.a
+incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
+                   two_file_test_2.o two_file_test_main.o gcctestdir/ld
+       cp -f two_file_test_1b.o two_file_test_tmp_6.o
+       $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
+       @sleep 1
+       cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
+       $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
+       $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
+
 check_PROGRAMS += incremental_copy_test
 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
        cp -f copy_test_v1.o copy_test_tmp.o
-       $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
        @sleep 1
        cp -f copy_test.o copy_test_tmp.o
        $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
@@ -1940,11 +2029,22 @@ incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
 check_PROGRAMS += incremental_common_test_1
 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
        cp -f common_test_1_v1.o common_test_1_tmp.o
-       $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ common_test_1_tmp.o
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
        @sleep 1
        cp -f common_test_1_v2.o common_test_1_tmp.o
        $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
 
+check_PROGRAMS += incremental_comdat_test_1
+incremental_comdat_test_1: incr_comdat_test_1.o incr_comdat_test_2_v1.o incr_comdat_test_2_v2.o incr_comdat_test_2_v3.o gcctestdir/ld
+       cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
+       $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
+       @sleep 1
+       cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
+       $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
+       @sleep 1
+       cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
+       $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
+
 endif DEFAULT_TARGET_X86_64
 
 endif GCC