diff options
-rw-r--r-- | gold/ChangeLog | 9 | ||||
-rw-r--r-- | gold/testsuite/Makefile.am | 35 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 124 | ||||
-rw-r--r-- | gold/testsuite/two_file_test_1_v1.cc | 243 | ||||
-rw-r--r-- | gold/testsuite/two_file_test_1b_v1.cc | 46 | ||||
-rw-r--r-- | gold/testsuite/two_file_test_2_v1.cc | 150 |
6 files changed, 588 insertions, 19 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 67e7e9ae56..bce6bc8504 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,14 @@ 2011-05-24 Cary Coutant <ccoutant@google.com> + * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3, + incremental_test_4. + * testsuite/Makefile.in: Regenerate. + * testsuite/two_file_test_1_v1.cc: New test source file. + * testsuite/two_file_test_1b_v1.cc: New test source file. + * testsuite/two_file_test_2_v1.cc: New test source file. + +2011-05-24 Cary Coutant <ccoutant@google.com> + * dynobj.h (Dynobj::do_dynobj): New function. * incremental-dump.cc (dump_incremental_inputs): Print as_needed flag and soname for shared objects. diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index f2af4924c7..9eab85e820 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -1815,6 +1815,41 @@ memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t memory_test.stdout: memory_test $(TEST_READELF) -lWS $< > $@ +# End-to-end incremental linking tests. +# Incremental linking is currently supported only on the x86_64 target. + +if DEFAULT_TARGET_X86_64 + +check_PROGRAMS += incremental_test_2 +MOSTLYCLEANFILES += two_file_test_tmp.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.o + $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_tmp.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o + @sleep 1 + cp -f two_file_test_1.o two_file_test_tmp.o + $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_tmp.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o + +check_PROGRAMS += incremental_test_3 +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.o + $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_tmp.o two_file_test_2.o two_file_test_main.o + @sleep 1 + cp -f two_file_test_1b.o two_file_test_tmp.o + $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_tmp.o two_file_test_2.o two_file_test_main.o + +check_PROGRAMS += incremental_test_4 +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.o + $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp.o two_file_test_main.o + @sleep 1 + cp -f two_file_test_2.o two_file_test_tmp.o + $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp.o two_file_test_main.o + +endif DEFAULT_TARGET_X86_64 + endif GCC endif NATIVE_LINKER diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index f00534e212..2276095508 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -47,7 +47,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ $(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15) \ $(am__EXEEXT_16) $(am__EXEEXT_17) $(am__EXEEXT_18) \ $(am__EXEEXT_19) $(am__EXEEXT_20) $(am__EXEEXT_21) \ - $(am__EXEEXT_22) + $(am__EXEEXT_22) $(am__EXEEXT_23) @NATIVE_OR_CROSS_LINKER_TRUE@am__append_1 = object_unittest \ @NATIVE_OR_CROSS_LINKER_TRUE@ binary_unittest @@ -431,37 +431,44 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ # Test that --start-lib and --end-lib function correctly. @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_34 = start_lib_test +# End-to-end incremental linking tests. +# Incremental linking is currently supported only on the x86_64 target. +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_35 = incremental_test_2 \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3 \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4 +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_36 = two_file_test_tmp.o + # These tests work with native and cross linkers. # Test script section order. -@NATIVE_OR_CROSS_LINKER_TRUE@am__append_35 = script_test_10.sh -@NATIVE_OR_CROSS_LINKER_TRUE@am__append_36 = script_test_10.stdout +@NATIVE_OR_CROSS_LINKER_TRUE@am__append_37 = script_test_10.sh +@NATIVE_OR_CROSS_LINKER_TRUE@am__append_38 = script_test_10.stdout # These tests work with cross linkers only. -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_37 = split_i386.sh -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_38 = split_i386_1.stdout split_i386_2.stdout \ +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_39 = split_i386.sh +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_40 = split_i386_1.stdout split_i386_2.stdout \ @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_39 = split_i386_1 split_i386_2 split_i386_3 \ +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_41 = split_i386_1 split_i386_2 split_i386_3 \ @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_4 split_i386_r -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_40 = split_x86_64.sh -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_41 = split_x86_64_1.stdout split_x86_64_2.stdout \ +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_42 = split_x86_64.sh +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_43 = split_x86_64_1.stdout split_x86_64_2.stdout \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_42 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \ +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_44 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4 split_x86_64_r # Cortex-A8 workaround test. -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_43 = arm_abs_global.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_45 = arm_abs_global.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_in_range.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_out_of_range.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_v4bx.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_exidx_test.sh -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_44 = arm_abs_global.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_46 = arm_abs_global.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range.stdout \ @@ -486,7 +493,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local_reloc.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_exidx_test.stdout -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_45 = arm_abs_global \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_47 = arm_abs_global \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range \ @@ -670,6 +677,9 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ ifuncmain7pic$(EXEEXT) \ @GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ ifuncmain7pie$(EXEEXT) @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_22 = start_lib_test$(EXEEXT) +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_23 = incremental_test_2$(EXEEXT) \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3$(EXEEXT) \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4$(EXEEXT) basic_pic_test_SOURCES = basic_pic_test.c basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT) basic_pic_test_LDADD = $(LDADD) @@ -994,6 +1004,24 @@ ifuncmain7pie_DEPENDENCIES = libgoldtest.a ../libgold.a \ ifuncmain7static_OBJECTS = $(am_ifuncmain7static_OBJECTS) ifuncmain7static_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(ifuncmain7static_LDFLAGS) $(LDFLAGS) -o $@ +incremental_test_2_SOURCES = incremental_test_2.c +incremental_test_2_OBJECTS = incremental_test_2.$(OBJEXT) +incremental_test_2_LDADD = $(LDADD) +incremental_test_2_DEPENDENCIES = libgoldtest.a ../libgold.a \ + ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +incremental_test_3_SOURCES = incremental_test_3.c +incremental_test_3_OBJECTS = incremental_test_3.$(OBJEXT) +incremental_test_3_LDADD = $(LDADD) +incremental_test_3_DEPENDENCIES = libgoldtest.a ../libgold.a \ + ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +incremental_test_4_SOURCES = incremental_test_4.c +incremental_test_4_OBJECTS = incremental_test_4.$(OBJEXT) +incremental_test_4_LDADD = $(LDADD) +incremental_test_4_DEPENDENCIES = libgoldtest.a ../libgold.a \ + ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @CONSTRUCTOR_PRIORITY_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am_initpri1_OBJECTS = initpri1.$(OBJEXT) initpri1_OBJECTS = $(am_initpri1_OBJECTS) initpri1_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(initpri1_LDFLAGS) \ @@ -1472,7 +1500,8 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \ $(ifuncmain5static_SOURCES) ifuncmain5staticpic.c \ ifuncmain6pie.c $(ifuncmain7_SOURCES) ifuncmain7pic.c \ ifuncmain7picstatic.c ifuncmain7pie.c \ - $(ifuncmain7static_SOURCES) $(initpri1_SOURCES) \ + $(ifuncmain7static_SOURCES) incremental_test_2.c \ + incremental_test_3.c incremental_test_4.c $(initpri1_SOURCES) \ $(justsyms_SOURCES) $(large_SOURCES) local_labels_test.c \ many_sections_r_test.c $(many_sections_test_SOURCES) \ $(object_unittest_SOURCES) permission_test.c plugin_test_1.c \ @@ -1753,18 +1782,18 @@ TEST_AS = $(top_builddir)/../gas/as-new # the right choice for files 'make' builds that people rebuild. MOSTLYCLEANFILES = *.so *.syms *.stdout $(am__append_4) \ $(am__append_9) $(am__append_18) $(am__append_26) \ - $(am__append_30) $(am__append_39) $(am__append_42) \ - $(am__append_45) + $(am__append_30) $(am__append_36) $(am__append_41) \ + $(am__append_44) $(am__append_47) # We will add to these later, for each individual test. Note # that we add each test under check_SCRIPTS or check_PROGRAMS; # the TESTS variable is automatically populated from these. check_SCRIPTS = $(am__append_2) $(am__append_24) $(am__append_28) \ - $(am__append_35) $(am__append_37) $(am__append_40) \ - $(am__append_43) + $(am__append_37) $(am__append_39) $(am__append_42) \ + $(am__append_45) check_DATA = $(am__append_3) $(am__append_25) $(am__append_29) \ - $(am__append_36) $(am__append_38) $(am__append_41) \ - $(am__append_44) + $(am__append_38) $(am__append_40) $(am__append_43) \ + $(am__append_46) BUILT_SOURCES = $(am__append_17) TESTS = $(check_SCRIPTS) $(check_PROGRAMS) @@ -2544,6 +2573,33 @@ ifuncmain7$(EXEEXT): $(ifuncmain7_OBJECTS) $(ifuncmain7_DEPENDENCIES) ifuncmain7static$(EXEEXT): $(ifuncmain7static_OBJECTS) $(ifuncmain7static_DEPENDENCIES) @rm -f ifuncmain7static$(EXEEXT) $(ifuncmain7static_LINK) $(ifuncmain7static_OBJECTS) $(ifuncmain7static_LDADD) $(LIBS) +@DEFAULT_TARGET_X86_64_FALSE@incremental_test_2$(EXEEXT): $(incremental_test_2_OBJECTS) $(incremental_test_2_DEPENDENCIES) +@DEFAULT_TARGET_X86_64_FALSE@ @rm -f incremental_test_2$(EXEEXT) +@DEFAULT_TARGET_X86_64_FALSE@ $(LINK) $(incremental_test_2_OBJECTS) $(incremental_test_2_LDADD) $(LIBS) +@GCC_FALSE@incremental_test_2$(EXEEXT): $(incremental_test_2_OBJECTS) $(incremental_test_2_DEPENDENCIES) +@GCC_FALSE@ @rm -f incremental_test_2$(EXEEXT) +@GCC_FALSE@ $(LINK) $(incremental_test_2_OBJECTS) $(incremental_test_2_LDADD) $(LIBS) +@NATIVE_LINKER_FALSE@incremental_test_2$(EXEEXT): $(incremental_test_2_OBJECTS) $(incremental_test_2_DEPENDENCIES) +@NATIVE_LINKER_FALSE@ @rm -f incremental_test_2$(EXEEXT) +@NATIVE_LINKER_FALSE@ $(LINK) $(incremental_test_2_OBJECTS) $(incremental_test_2_LDADD) $(LIBS) +@DEFAULT_TARGET_X86_64_FALSE@incremental_test_3$(EXEEXT): $(incremental_test_3_OBJECTS) $(incremental_test_3_DEPENDENCIES) +@DEFAULT_TARGET_X86_64_FALSE@ @rm -f incremental_test_3$(EXEEXT) +@DEFAULT_TARGET_X86_64_FALSE@ $(LINK) $(incremental_test_3_OBJECTS) $(incremental_test_3_LDADD) $(LIBS) +@GCC_FALSE@incremental_test_3$(EXEEXT): $(incremental_test_3_OBJECTS) $(incremental_test_3_DEPENDENCIES) +@GCC_FALSE@ @rm -f incremental_test_3$(EXEEXT) +@GCC_FALSE@ $(LINK) $(incremental_test_3_OBJECTS) $(incremental_test_3_LDADD) $(LIBS) +@NATIVE_LINKER_FALSE@incremental_test_3$(EXEEXT): $(incremental_test_3_OBJECTS) $(incremental_test_3_DEPENDENCIES) +@NATIVE_LINKER_FALSE@ @rm -f incremental_test_3$(EXEEXT) +@NATIVE_LINKER_FALSE@ $(LINK) $(incremental_test_3_OBJECTS) $(incremental_test_3_LDADD) $(LIBS) +@DEFAULT_TARGET_X86_64_FALSE@incremental_test_4$(EXEEXT): $(incremental_test_4_OBJECTS) $(incremental_test_4_DEPENDENCIES) +@DEFAULT_TARGET_X86_64_FALSE@ @rm -f incremental_test_4$(EXEEXT) +@DEFAULT_TARGET_X86_64_FALSE@ $(LINK) $(incremental_test_4_OBJECTS) $(incremental_test_4_LDADD) $(LIBS) +@GCC_FALSE@incremental_test_4$(EXEEXT): $(incremental_test_4_OBJECTS) $(incremental_test_4_DEPENDENCIES) +@GCC_FALSE@ @rm -f incremental_test_4$(EXEEXT) +@GCC_FALSE@ $(LINK) $(incremental_test_4_OBJECTS) $(incremental_test_4_LDADD) $(LIBS) +@NATIVE_LINKER_FALSE@incremental_test_4$(EXEEXT): $(incremental_test_4_OBJECTS) $(incremental_test_4_DEPENDENCIES) +@NATIVE_LINKER_FALSE@ @rm -f incremental_test_4$(EXEEXT) +@NATIVE_LINKER_FALSE@ $(LINK) $(incremental_test_4_OBJECTS) $(incremental_test_4_LDADD) $(LIBS) initpri1$(EXEEXT): $(initpri1_OBJECTS) $(initpri1_DEPENDENCIES) @rm -f initpri1$(EXEEXT) $(initpri1_LINK) $(initpri1_OBJECTS) $(initpri1_LDADD) $(LIBS) @@ -2911,6 +2967,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifuncmain7pic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifuncmain7picstatic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifuncmain7pie.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_test_2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_test_3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/incremental_test_4.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initpri1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/justsyms_1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/large-large.Po@am__quote@ @@ -3581,6 +3640,12 @@ ifuncmain7pie.log: ifuncmain7pie$(EXEEXT) @p='ifuncmain7pie$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) start_lib_test.log: start_lib_test$(EXEEXT) @p='start_lib_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +incremental_test_2.log: incremental_test_2$(EXEEXT) + @p='incremental_test_2$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +incremental_test_3.log: incremental_test_3$(EXEEXT) + @p='incremental_test_3$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +incremental_test_4.log: incremental_test_4$(EXEEXT) + @p='incremental_test_4$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) .test.log: @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @@ -4522,6 +4587,27 @@ uninstall-am: @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -T $(srcdir)/memory_test.t -o $@ memory_test.o @GCC_TRUE@@NATIVE_LINKER_TRUE@memory_test.stdout: memory_test @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -lWS $< > $@ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@incremental_test_2: two_file_test_1_v1.o two_file_test_1.o two_file_test_1b.o \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.o two_file_test_main.o gcctestdir/ld +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f two_file_test_1_v1.o two_file_test_tmp.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_tmp.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1 +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f two_file_test_1.o two_file_test_tmp.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_tmp.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.o two_file_test_main.o gcctestdir/ld +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f two_file_test_1b_v1.o two_file_test_tmp.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_tmp.o two_file_test_2.o two_file_test_main.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1 +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f two_file_test_1b.o two_file_test_tmp.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_tmp.o two_file_test_2.o two_file_test_main.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_2.o two_file_test_main.o gcctestdir/ld +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f two_file_test_2_v1.o two_file_test_tmp.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp.o two_file_test_main.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1 +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f two_file_test_2.o two_file_test_tmp.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp.o two_file_test_main.o @NATIVE_OR_CROSS_LINKER_TRUE@script_test_10.o: script_test_10.s @NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< @NATIVE_OR_CROSS_LINKER_TRUE@script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld diff --git a/gold/testsuite/two_file_test_1_v1.cc b/gold/testsuite/two_file_test_1_v1.cc new file mode 100644 index 0000000000..6a43d9ba82 --- /dev/null +++ b/gold/testsuite/two_file_test_1_v1.cc @@ -0,0 +1,243 @@ +// two_file_test_1_v1.cc -- a two file test case for gold, file 1 of 2 + +// Copyright 2006, 2007, 2008, 2011 Free Software Foundation, Inc. +// Written by Ian Lance Taylor <iant@google.com>. + +// This file is part of gold. + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +// MA 02110-1301, USA. + +// This is an alternate version of the source file two_file_test_1.cc, +// used to test incremental linking. We build a binary first using this +// source file, then do an incremental link with the primary version of +// the file. + +// This tests references between files. This is file 1, and +// two_file_test_2.cc is file 2. We test in several different ways: + +// Files 1 and 2 linked together in executable. +// File 1 in executable, file 2 in shared library. +// File 1 in shared library, file 2 in executable. +// Files 1 and 2 linked together in shared library. +// Files 1 and 2 in different shared libraries. + +// We test the following cases. + +// 1 Code in file 1 calls code in file 2. +// 2 Code in file 1 refers to global data in file 2. +// 3 Code in file 1 referes to common symbol in file 2. +// 4 Code in file 1 refers to offset within global data in file 2. +// 5 Code in file 1 refers to offset within common symbol in file 2. +// 6 Data in file 1 refers to global data in file 2. +// 7 Data in file 1 refers to common symbol in file 2. +// 8 Data in file 1 refers to offset within global data in file 2. +// 9 Data in file 1 refers to offset within common symbol in file 2. +// 10 Data in file 1 refers to function in file 2. +// 11 Pass function pointer from file 1 to file 2. +// 12 Compare address of function for equality in both files. +// 13 Compare address of inline function for equality in both files. +// 14 Compare string constants in file 1 and file 2. +// 15 Compare wide string constants in file 1 and file 2. +// 16 Call a function directly after its address has been taken. +// 17 File 1 checks array of string constants defined in file 2. +// 18 File 1 checks string constants referenced in code in file 2. + +#include "two_file_test.h" + +// 1 Code in file 1 calls code in file 2. + +bool +t1() +{ + return t1_2() == 0; +} + +// 2 Code in file 1 refers to global data in file 2. + +bool +t2() +{ + return v2 == 0; +} + +// 3 Code in file 1 referes to common symbol in file 2. + +bool +t3() +{ + return v3 == 0; +} + +// 4 Code in file 1 refers to offset within global data in file 2. + +bool +t4() +{ + return v4[5] == ','; +} + +// 5 Code in file 1 refers to offset within common symbol in file 2. + +bool +t5() +{ + return v5[7] == 'w'; +} + +// 6 Data in file 1 refers to global data in file 2. + +int* p6 = &v2; + +bool +t6() +{ + return *p6 == 456; +} + +// 7 Data in file 1 refers to common symbol in file 2. + +int* p7 = &v3; + +bool +t7() +{ + return *p7 == 789; +} + +// 8 Data in file 1 refers to offset within global data in file 2. + +char* p8 = &v4[6]; + +bool +t8() +{ + return *p8 == ' '; +} + +// 9 Data in file 1 refers to offset within common symbol in file 2. + +char* p9 = &v5[8]; + +bool +t9() +{ + return *p9 == 'o'; +} + +// 10 Data in file 1 refers to function in file 2. + +int (*pfn)() = &f10; + +bool +t10() +{ + return (*pfn)() == 135; +} + +// 11 Pass function pointer from file 1 to file 2. + +int +f11a() +{ + return 246; +} + +bool +t11() +{ + return f11b(&f11a) == 246; +} + +// 12 Compare address of function for equality in both files. + +bool +t12() +{ + return &t12 == f12(); +} + +// 13 Compare address of inline function for equality in both files. + +bool +t13() +{ + return &f13i == f13(); +} + +// 14 Compare string constants in file 1 and file 2. + +bool +t14() +{ + const char* s1 = TEST_STRING_CONSTANT; + const char* s2 = f14(); + while (*s1 != '\0') + if (*s1++ != *s2++) + return false; + return *s2 == '\0'; +} + +// 15 Compare wide string constants in file 1 and file 2. + +bool +t15() +{ + const wchar_t* s1 = TEST_WIDE_STRING_CONSTANT; + const wchar_t* s2 = f15(); + while (*s1 != '\0') + if (*s1++ != *s2++) + return false; + return *s2 == '\0'; +} + +// 16 Call a function directly after its address has been taken. + +bool +t16() +{ + return f10() == 135; +} + +// 17 File 1 checks array of string constants defined in file 2. + +bool +t17() +{ + char c = 'a'; + for (int i = 0; i < T17_COUNT; ++i) + { + if (t17data[i][0] != c || t17data[i][1] != '\0') + return false; + ++c; + } + return true; +} + +// 18 File 1 checks string constants referenced in code in file 2. + +bool +t18() +{ + char c = 'a'; + for (int i = 0; i < T17_COUNT; ++i) + { + const char* s = f18(i); + if (s[0] != c || s[1] != '\0') + return false; + ++c; + } + return true; +} diff --git a/gold/testsuite/two_file_test_1b_v1.cc b/gold/testsuite/two_file_test_1b_v1.cc new file mode 100644 index 0000000000..0adaf8450f --- /dev/null +++ b/gold/testsuite/two_file_test_1b_v1.cc @@ -0,0 +1,46 @@ +// two_file_test_1b_v1.cc -- supplementary file for a three-file test case +// for gold. + +// Copyright 2008, 2011 Free Software Foundation, Inc. +// Written by Cary Coutant <ccoutant@google.com>. + +// This file is part of gold. + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +// MA 02110-1301, USA. + +// This is an alternate version of the source file two_file_test_1b.cc, +// used to test incremental linking. We build a binary first using this +// source file, then do an incremental link with the primary version of +// the file. + +// This file is used as part of a mixed PIC/non-PIC test. +// Files 1 and 1b are linked together in a shared library. +// File 1 is compiled non-PIC, and file 1a is compiled PIC. +// File 2 is compiled PIC and linked in a second shared library. +// This tests that a non-PIC call does not accidentally get +// bound to a PIC PLT entry. + +// We test the following cases. + +#include "two_file_test.h" + +// 16 Call a function directly after its address has been taken. + +bool +t16a() +{ + return f10() == 125; +} diff --git a/gold/testsuite/two_file_test_2_v1.cc b/gold/testsuite/two_file_test_2_v1.cc new file mode 100644 index 0000000000..b97a677db5 --- /dev/null +++ b/gold/testsuite/two_file_test_2_v1.cc @@ -0,0 +1,150 @@ +// two_file_test_2_v1.cc -- a two file test case for gold, file 2 of 2 + +// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Written by Ian Lance Taylor <iant@google.com>. + +// This file is part of gold. + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +// MA 02110-1301, USA. + +// This is an alternate version of the source file two_file_test_2.cc, +// used to test incremental linking. We build a binary first using this +// source file, then do an incremental link with the primary version of +// the file. + +// This tests references between files. This is file 2, and +// two_file_test_1.cc is file 1. See file 1 for details. + +#include "two_file_test.h" + +// 1 Code in file 1 calls code in file 2. + +int +t1_2() +{ + return 0; +} + +bool +t1a() +{ + return t1_2() == 0; +} + +// 2 Code in file 1 refers to global data in file 2. + +int v2 = 0; + +// 3 Code in file 1 referes to common symbol in file 2. This is +// initialized at runtime to 789. + +int v3; + +// 4 Code in file 1 refers to offset within global data in file 2. + +char v4[] = "World, hello"; + +// 5 Code in file 1 refers to offset within common symbol in file 2. +// This is initialized at runtime to a copy of v4. + +char v5[13]; + +// 6 Data in file 1 refers to global data in file 2. This reuses v2. + +// 7 Data in file 1 refers to common symbol in file 2. This reuses v3. + +// 8 Data in file 1 refers to offset within global data in file 2. +// This reuses v4. + +// 9 Data in file 1 refers to offset within common symbol in file 2. +// This reuses v5. + +// 10 Data in file 1 refers to function in file 2. + +int +f10() +{ + return 0; +} + +// 11 Pass function pointer from file 1 to file 2. + +int +f11b(int (*pfn)()) +{ + return (*pfn)(); +} + +// 12 Compare address of function for equality in both files. + +bool +(*f12())() +{ + return &t12; +} + +// 13 Compare address of inline function for equality in both files. + +void +(*f13())() +{ + return &f13i; +} + +// 14 Compare string constants in file 1 and file 2. + +const char* +f14() +{ + return TEST_STRING_CONSTANT; +} + +// 15 Compare wide string constants in file 1 and file 2. + +const wchar_t* +f15() +{ + return TEST_WIDE_STRING_CONSTANT; +} + +// 17 File 1 checks array of string constants defined in file 2. + +const char* t17data[T17_COUNT] = +{ + "0", "1", "2", "3", "4" +}; + +// 18 File 1 checks string constants referenced directly in file 2. + +const char* +f18(int i) +{ + switch (i) + { + case 0: + return "0"; + case 1: + return "1"; + case 2: + return "2"; + case 3: + return "3"; + case 4: + return "4"; + default: + return 0; + } +} |