Home | History | Annotate | Download | only in testsuite
      1 # Process this file with automake to generate Makefile.in
      2 
      3 # As far as I can tell automake testing support assumes that the build
      4 # system and the host system are the same.  So these tests will not
      5 # work when building with a cross-compiler.
      6 
      7 # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
      8 AUTOMAKE_OPTIONS = foreign -Wno-portability
      9 
     10 # The two_file_test tests -fmerge-constants, so we simply always turn
     11 # it on.  For compilers that do not support the command-line option,
     12 # we assume they just always emit SHF_MERGE sections unconditionally.
     13 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
     14 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
     15 
     16 AM_CPPFLAGS = \
     17 	-I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
     18 	-I$(srcdir)/../../elfcpp -I.. \
     19 	-DLOCALEDIR="\"$(datadir)/locale\"" \
     20 	@INCINTL@
     21 
     22 # Some versions of GCC now automatically enable linker plugins,
     23 # but we want to run our tests without GCC's plugins.
     24 if HAVE_NO_USE_LINKER_PLUGIN
     25 OPT_NO_PLUGINS = -fno-use-linker-plugin
     26 endif
     27 
     28 # COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
     29 # CXXCOMPILE and CXXLINK generated by automake 1.11.1.  FIXME: they should
     30 # be updated if they are different from automake used by gold.
     31 COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
     32 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
     33 LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
     34 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
     35 CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
     36 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     37 CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
     38 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
     39 
     40 # Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
     41 # testsuite and incompatible with -O0 used in gold tests, from
     42 # COMPILE, LINK, CXXCOMPILE and CXXLINK.
     43 COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
     44 LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
     45 CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
     46 CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
     47 
     48 # Strip out -static-libgcc and -static-libstdc++ options, for tests
     49 # that must have these libraries linked dynamically.  The -shared-libgcc
     50 # option does not work correctly, and there is no -shared-libstdc++ option.
     51 # (See GCC PR 55781 and PR 55782.)
     52 CXXLINK_S = `echo $(CXXLINK1) | sed -e 's/-static-lib\\(gcc\\|stdc++\\)//g'`
     53 
     54 TEST_READELF = $(top_builddir)/../binutils/readelf
     55 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
     56 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
     57 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
     58 TEST_STRIP = $(top_builddir)/../binutils/strip-new
     59 TEST_AR = $(top_builddir)/../binutils/ar
     60 TEST_NM = $(top_builddir)/../binutils/nm-new
     61 TEST_AS = $(top_builddir)/../gas/as-new
     62 
     63 if PLUGINS
     64 LIBDL = -ldl
     65 endif
     66 
     67 if THREADS
     68 THREADSLIB = -lpthread
     69 endif
     70 
     71 if OMP_SUPPORT
     72 TLS_TEST_C_CFLAGS = -fopenmp
     73 endif
     74 
     75 # 'make clean' is good about deleting some intermediate files (such as
     76 # .o's), but not all of them (such as .so's and .err files).  We
     77 # improve on that here.  automake-1.9 info docs say "mostlyclean" is
     78 # the right choice for files 'make' builds that people rebuild.
     79 MOSTLYCLEANFILES = *.so *.syms *.stdout
     80 
     81 # Export make variables to the shell scripts so that they can see
     82 # (for example) DEFAULT_TARGET.
     83 .EXPORT_ALL_VARIABLES:
     84 
     85 # We will add to these later, for each individual test.  Note
     86 # that we add each test under check_SCRIPTS or check_PROGRAMS;
     87 # the TESTS variable is automatically populated from these.
     88 check_SCRIPTS =
     89 check_DATA =
     90 check_PROGRAMS =
     91 BUILT_SOURCES =
     92 
     93 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
     94 
     95 # ---------------------------------------------------------------------
     96 # These tests test the internals of gold (unittests).
     97 
     98 # Infrastucture needed for the unittests
     99 check_LIBRARIES = libgoldtest.a
    100 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
    101 
    102 DEPENDENCIES = \
    103 	libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
    104 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
    105 	$(THREADSLIB) $(LIBDL)
    106 
    107 
    108 # The unittests themselves
    109 if NATIVE_OR_CROSS_LINKER
    110 if GCC
    111 
    112 # Infrastucture needed for the unittests: a directory where the linker
    113 # is named 'ld'.  This is because the -B flag appends 'ld' to its arg.
    114 gcctestdir/ld: ../ld-new
    115 	test -d gcctestdir || mkdir -p gcctestdir
    116 	rm -f gcctestdir/ld
    117 	(cd gcctestdir && $(LN_S) ../../ld-new ld)
    118 
    119 # Some tests require the latest features of an in-tree assembler.
    120 gcctestdir/as: $(TEST_AS)
    121 	test -d gcctestdir || mkdir -p gcctestdir
    122 	rm -f gcctestdir/as
    123 	(cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
    124 
    125 endif GCC
    126 
    127 check_PROGRAMS += object_unittest
    128 object_unittest_SOURCES = object_unittest.cc
    129 
    130 check_PROGRAMS += binary_unittest
    131 binary_unittest_SOURCES = binary_unittest.cc
    132 
    133 check_PROGRAMS += leb128_unittest
    134 leb128_unittest_SOURCES = leb128_unittest.cc
    135 
    136 endif NATIVE_OR_CROSS_LINKER
    137 
    138 # ---------------------------------------------------------------------
    139 # These tests test the output of gold (end-to-end tests).  In
    140 # particular, they make sure that gold can link "difficult" object
    141 # files, and the resulting object files run correctly.  These can only
    142 # run if we've built ld-new for the native architecture (that is,
    143 # we're not cross-compiling it), since we run ld-new as part of these
    144 # tests.  We use the gcc-specific flag '-B' to use our linker instead
    145 # of the default linker, which is why we only run our tests under gcc.
    146 
    147 if TEST_AS_NATIVE_LINKER
    148 if GCC
    149 
    150 # Each of these .o's is a useful, small complete program.  They're
    151 # particularly useful for making sure ld-new's flags do what they're
    152 # supposed to (hence their names), but are used for many tests that
    153 # don't actually involve analyzing input data.
    154 flagstest_debug.o: constructor_test.cc
    155 	$(CXXCOMPILE) -O0 -g -c -o $@ $<
    156 flagstest_ndebug.o: constructor_test.cc
    157 	$(CXXCOMPILE) -O0 -c -o $@ $<
    158 
    159 check_SCRIPTS += incremental_test.sh
    160 check_DATA += incremental_test.stdout
    161 MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
    162 incremental_test_1.o: incremental_test_1.c
    163 	$(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    164 incremental_test_2.o: incremental_test_2.c
    165 	$(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    166 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
    167 	$(LINK) -Bgcctestdir/ -Wl,--incremental-full -Wl,-z,norelro incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
    168 incremental_test.stdout: incremental_test ../incremental-dump
    169 	../incremental-dump incremental_test > $@
    170 
    171 check_SCRIPTS += gc_comdat_test.sh
    172 check_DATA += gc_comdat_test.stdout
    173 MOSTLYCLEANFILES += gc_comdat_test
    174 gc_comdat_test_1.o: gc_comdat_test_1.cc
    175 	$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    176 gc_comdat_test_2.o: gc_comdat_test_2.cc
    177 	$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    178 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
    179 	$(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
    180 gc_comdat_test.stdout: gc_comdat_test
    181 	$(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
    182 
    183 check_SCRIPTS += gc_tls_test.sh
    184 check_DATA += gc_tls_test.stdout
    185 MOSTLYCLEANFILES += gc_tls_test
    186 gc_tls_test.o: gc_tls_test.cc
    187 	$(CXXCOMPILE) -O0 -c -g -o $@ $<
    188 gc_tls_test:gc_tls_test.o gcctestdir/ld
    189 	$(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
    190 gc_tls_test.stdout: gc_tls_test
    191 	$(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
    192 
    193 check_SCRIPTS += gc_orphan_section_test.sh
    194 check_DATA += gc_orphan_section_test.stdout
    195 MOSTLYCLEANFILES += gc_orphan_section_test
    196 gc_orphan_section_test.o: gc_orphan_section_test.cc
    197 	$(CXXCOMPILE) -O0 -c -g -o $@ $<
    198 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
    199 	$(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
    200 gc_orphan_section_test.stdout: gc_orphan_section_test
    201 	$(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
    202 
    203 check_SCRIPTS += pr14265.sh
    204 check_DATA += pr14265.stdout
    205 MOSTLYCLEANFILES += pr14265
    206 pr14265.o: pr14265.c
    207 	$(COMPILE) -O0 -c -o $@ $<
    208 pr14265: pr14265.o
    209 	$(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
    210 pr14265.stdout: pr14265
    211 	$(TEST_NM) --format=bsd --numeric-sort $< > $@
    212 
    213 check_SCRIPTS += gc_dynamic_list_test.sh
    214 check_DATA += gc_dynamic_list_test.stdout
    215 MOSTLYCLEANFILES += gc_dynamic_list_test
    216 gc_dynamic_list_test.o: gc_dynamic_list_test.c
    217 	$(COMPILE) -c -ffunction-sections -o $@ $<
    218 gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
    219 	$(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
    220 gc_dynamic_list_test.stdout: gc_dynamic_list_test
    221 	$(TEST_NM) gc_dynamic_list_test > $@
    222 
    223 check_SCRIPTS += icf_test.sh
    224 check_DATA += icf_test.map
    225 MOSTLYCLEANFILES += icf_test icf_test.map
    226 icf_test.o: icf_test.cc
    227 	$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    228 icf_test: icf_test.o gcctestdir/ld
    229 	$(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
    230 icf_test.map: icf_test
    231 	@touch icf_test.map
    232 
    233 check_SCRIPTS += icf_keep_unique_test.sh
    234 check_DATA += icf_keep_unique_test.stdout
    235 MOSTLYCLEANFILES += icf_keep_unique_test
    236 icf_keep_unique_test.o: icf_keep_unique_test.cc
    237 	$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    238 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
    239 	$(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
    240 icf_keep_unique_test.stdout: icf_keep_unique_test
    241 	$(TEST_NM) -C $< > $@
    242 
    243 check_SCRIPTS += icf_safe_test.sh
    244 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
    245 MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
    246 icf_safe_test.o: icf_safe_test.cc
    247 	$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    248 icf_safe_test: icf_safe_test.o gcctestdir/ld
    249 	$(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
    250 icf_safe_test.map: icf_safe_test
    251 	@touch icf_safe_test.map
    252 icf_safe_test_1.stdout: icf_safe_test
    253 	$(TEST_NM) $< > $@
    254 icf_safe_test_2.stdout: icf_safe_test
    255 	$(TEST_READELF) -h $< > $@
    256 
    257 check_SCRIPTS += icf_safe_so_test.sh
    258 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
    259 MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
    260 icf_safe_so_test.o: icf_safe_so_test.cc
    261 	$(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
    262 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
    263 	$(CXXLINK) -o icf_safe_so_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
    264 icf_safe_so_test.map:
    265 	@touch icf_safe_so_test.map
    266 icf_safe_so_test_1.stdout: icf_safe_so_test
    267 	$(TEST_NM) $< > $@
    268 icf_safe_so_test_2.stdout: icf_safe_so_test
    269 	$(TEST_READELF) -h $< > $@
    270 
    271 check_SCRIPTS += final_layout.sh
    272 check_DATA += final_layout.stdout
    273 MOSTLYCLEANFILES += final_layout final_layout_sequence.txt final_layout_script.lds
    274 final_layout.o: final_layout.cc
    275 	$(CXXCOMPILE) -O0 -c -ffunction-sections  -fdata-sections -g -o $@ $<
    276 final_layout_sequence.txt:
    277 	(echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
    278 final_layout_script.lds:
    279 	(echo "SECTIONS { .text : { *(.text*) } .got : { *(.got .toc) } .sbss : { *(.sbss*) } .bss : { *(.bss*) } }") > final_layout_script.lds
    280 final_layout: final_layout.o final_layout_sequence.txt final_layout_script.lds gcctestdir/ld
    281 	$(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt -Wl,-T,final_layout_script.lds final_layout.o
    282 final_layout.stdout: final_layout
    283 	$(TEST_NM) -n --synthetic final_layout > final_layout.stdout
    284 
    285 check_SCRIPTS += text_section_grouping.sh
    286 check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
    287 MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
    288 text_section_grouping.o: text_section_grouping.cc
    289 	$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    290 text_section_grouping: text_section_grouping.o gcctestdir/ld
    291 	$(CXXLINK)  -Bgcctestdir/ text_section_grouping.o
    292 text_section_no_grouping: text_section_grouping.o gcctestdir/ld
    293 	$(CXXLINK)  -Bgcctestdir/ -Wl,--no-text-reorder text_section_grouping.o
    294 text_section_grouping.stdout: text_section_grouping
    295 	$(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
    296 text_section_no_grouping.stdout: text_section_no_grouping
    297 	$(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
    298 
    299 check_SCRIPTS += section_sorting_name.sh
    300 check_DATA += section_sorting_name.stdout
    301 MOSTLYCLEANFILES += section_sorting_name
    302 section_sorting_name.o: section_sorting_name.cc
    303 	$(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
    304 section_sorting_name: section_sorting_name.o gcctestdir/ld
    305 	$(CXXLINK)  -Bgcctestdir/ -Wl,--sort-section=name section_sorting_name.o
    306 section_sorting_name.stdout: section_sorting_name
    307 	$(TEST_NM) -n --synthetic section_sorting_name > section_sorting_name.stdout
    308 
    309 check_PROGRAMS += icf_virtual_function_folding_test
    310 MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
    311 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
    312 	$(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
    313 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
    314 	$(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
    315 
    316 check_SCRIPTS += icf_preemptible_functions_test.sh
    317 check_DATA += icf_preemptible_functions_test.stdout
    318 MOSTLYCLEANFILES += icf_preemptible_functions_test
    319 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
    320 	$(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
    321 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
    322 	$(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
    323 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
    324 	$(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
    325 
    326 check_SCRIPTS += icf_string_merge_test.sh
    327 check_DATA += icf_string_merge_test.stdout
    328 MOSTLYCLEANFILES += icf_string_merge_test
    329 icf_string_merge_test.o: icf_string_merge_test.cc
    330 	$(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
    331 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
    332 	$(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
    333 icf_string_merge_test.stdout: icf_string_merge_test
    334 	$(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
    335 
    336 check_SCRIPTS += icf_sht_rel_addend_test.sh
    337 check_DATA += icf_sht_rel_addend_test.stdout
    338 MOSTLYCLEANFILES += icf_sht_rel_addend_test
    339 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
    340 	$(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
    341 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
    342 	$(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
    343 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
    344 	$(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
    345 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
    346 	$(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
    347 
    348 check_PROGRAMS += large_symbol_alignment
    349 large_symbol_alignment_SOURCES = large_symbol_alignment.cc
    350 large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
    351 large_symbol_alignment_LDFLAGS = -Bgcctestdir/
    352 large_symbol_alignment_LDADD =
    353 
    354 check_SCRIPTS += merge_string_literals.sh
    355 check_DATA += merge_string_literals.stdout
    356 MOSTLYCLEANFILES += merge_string_literals
    357 merge_string_literals_1.o: merge_string_literals_1.cc
    358 	$(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
    359 merge_string_literals_2.o: merge_string_literals_2.cc
    360 	$(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
    361 merge_string_literals: merge_string_literals_1.o merge_string_literals_2.o gcctestdir/ld
    362 	$(CXXLINK) -Bgcctestdir/ merge_string_literals_1.o merge_string_literals_2.o -O2 -shared -nostdlib
    363 merge_string_literals.stdout: merge_string_literals
    364 	$(TEST_OBJDUMP) -s -j.rodata merge_string_literals > merge_string_literals.stdout
    365 
    366 check_PROGRAMS += basic_test
    367 check_PROGRAMS += basic_pic_test
    368 basic_test.o: basic_test.cc
    369 	$(CXXCOMPILE) -O0 -c -o $@ $<
    370 basic_test: basic_test.o gcctestdir/ld
    371 	$(CXXLINK) -Bgcctestdir/ basic_test.o
    372 
    373 if HAVE_STATIC
    374 check_PROGRAMS += basic_static_test
    375 basic_static_test: basic_test.o gcctestdir/ld
    376 	$(CXXLINK) -Bgcctestdir/ -static basic_test.o
    377 endif
    378 
    379 basic_pic_test.o: basic_test.cc
    380 	$(CXXCOMPILE) -O0 -c -fpic -o $@ $<
    381 basic_pic_test: basic_pic_test.o gcctestdir/ld
    382 	$(CXXLINK) -Bgcctestdir/ basic_pic_test.o
    383 
    384 if HAVE_STATIC
    385 check_PROGRAMS += basic_static_pic_test
    386 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
    387 	$(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
    388 endif
    389 
    390 check_PROGRAMS += basic_pie_test
    391 basic_pie_test.o: basic_test.cc
    392 	$(CXXCOMPILE) -O0 -c -fpie -o $@ $<
    393 basic_pie_test: basic_pie_test.o gcctestdir/ld
    394 	$(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
    395 
    396 check_PROGRAMS += constructor_test
    397 constructor_test_SOURCES = constructor_test.cc
    398 constructor_test_DEPENDENCIES = gcctestdir/ld
    399 constructor_test_LDFLAGS = -Bgcctestdir/
    400 constructor_test_LDADD =
    401 
    402 if HAVE_STATIC
    403 check_PROGRAMS += constructor_static_test
    404 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
    405 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
    406 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
    407 constructor_static_test_LDADD = $(constructor_test_LDADD)
    408 endif
    409 
    410 check_PROGRAMS += two_file_test
    411 check_PROGRAMS += two_file_pic_test
    412 two_file_test_SOURCES = \
    413 	two_file_test_1.cc \
    414 	two_file_test_1b.cc \
    415 	two_file_test_2.cc \
    416 	two_file_test_main.cc \
    417 	two_file_test.h
    418 two_file_test_DEPENDENCIES = gcctestdir/ld
    419 two_file_test_LDFLAGS = -Bgcctestdir/
    420 two_file_test_LDADD =
    421 
    422 if HAVE_STATIC
    423 check_PROGRAMS += two_file_static_test
    424 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
    425 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
    426 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
    427 two_file_static_test_LDADD = $(two_file_test_LDADD)
    428 endif
    429 
    430 two_file_pic_test_SOURCES = two_file_test_main.cc
    431 two_file_pic_test_DEPENDENCIES = \
    432 	gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
    433 two_file_pic_test_LDFLAGS = -Bgcctestdir/
    434 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
    435 
    436 
    437 check_PROGRAMS += two_file_shared_1_test
    438 check_PROGRAMS += two_file_shared_2_test
    439 check_PROGRAMS += two_file_shared_1_pic_2_test
    440 check_PROGRAMS += two_file_shared_2_pic_1_test
    441 check_PROGRAMS += two_file_same_shared_test
    442 check_PROGRAMS += two_file_separate_shared_12_test
    443 check_PROGRAMS += two_file_separate_shared_21_test
    444 two_file_test_1_pic.o: two_file_test_1.cc
    445 	$(CXXCOMPILE) -c -fpic -o $@ $<
    446 two_file_test_1b_pic.o: two_file_test_1b.cc
    447 	$(CXXCOMPILE) -c -fpic -o $@ $<
    448 two_file_test_2_pic.o: two_file_test_2.cc
    449 	$(CXXCOMPILE) -c -fpic -o $@ $<
    450 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
    451 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
    452 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
    453 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
    454 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
    455 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
    456 
    457 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
    458 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
    459 two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    460 two_file_shared_1_test_LDADD = two_file_shared_1.so
    461 
    462 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
    463 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
    464 two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    465 two_file_shared_2_test_LDADD = two_file_shared_2.so
    466 
    467 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
    468 two_file_shared_1_pic_2_test_DEPENDENCIES = \
    469 	gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
    470 two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    471 two_file_shared_1_pic_2_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_shared_2.so
    472 
    473 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
    474 two_file_shared_2_pic_1_test_DEPENDENCIES = \
    475 	gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
    476 two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    477 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
    478 
    479 two_file_same_shared_test_SOURCES = two_file_test_main.cc
    480 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
    481 two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    482 two_file_same_shared_test_LDADD = two_file_shared.so
    483 
    484 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
    485 two_file_separate_shared_12_test_DEPENDENCIES = \
    486 	gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
    487 two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    488 two_file_separate_shared_12_test_LDADD = \
    489 	two_file_shared_1.so two_file_shared_2.so
    490 
    491 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
    492 two_file_separate_shared_21_test_DEPENDENCIES = \
    493 	gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
    494 two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    495 two_file_separate_shared_21_test_LDADD = \
    496 	two_file_shared_2.so two_file_shared_1.so
    497 
    498 check_PROGRAMS += two_file_relocatable_test
    499 two_file_relocatable_test_SOURCES = two_file_test_main.cc
    500 two_file_relocatable_test_DEPENDENCIES = \
    501 	gcctestdir/ld two_file_relocatable.o
    502 two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    503 two_file_relocatable_test_LDADD = two_file_relocatable.o
    504 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
    505 	gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
    506 
    507 check_PROGRAMS += two_file_pie_test
    508 two_file_test_1_pie.o: two_file_test_1.cc
    509 	$(CXXCOMPILE) -c -fpie -o $@ $<
    510 two_file_test_1b_pie.o: two_file_test_1b.cc
    511 	$(CXXCOMPILE) -c -fpie -o $@ $<
    512 two_file_test_2_pie.o: two_file_test_2.cc
    513 	$(CXXCOMPILE) -c -fpie -o $@ $<
    514 two_file_test_main_pie.o: two_file_test_main.cc
    515 	$(CXXCOMPILE) -c -fpie -o $@ $<
    516 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
    517 		two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
    518 	$(CXXLINK) -Bgcctestdir/ -pie two_file_test_1_pie.o two_file_test_1b_pie.o two_file_test_2_pie.o two_file_test_main_pie.o
    519 
    520 check_PROGRAMS += pie_copyrelocs_test
    521 pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
    522 pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
    523 pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
    524 pie_copyrelocs_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -pie
    525 pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
    526 pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
    527 	$(CXXCOMPILE) -O2 -fpic -c -o $@ $<
    528 pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
    529 	$(CXXLINK) -Bgcctestdir/ -shared pie_copyrelocs_shared_test.o
    530 
    531 check_SCRIPTS += disable_pie_unsafe_size_test.sh
    532 check_PROGRAMS += disable_pie_unsafe_size_test
    533 check_DATA += disable_pie_unsafe_size_test_readelf.stdout
    534 MOSTLYCLEANFILES += disable_pie_unsafe_size_test
    535 disable_pie_unsafe_size_test_SOURCES = disable_pie_unsafe_size_test.cc
    536 disable_pie_unsafe_size_test_LDFLAGS = -Bgcctestdir/ -pie
    537 disable_pie_unsafe_size_test_readelf.stdout: disable_pie_unsafe_size_test
    538 	$(TEST_READELF) -l $< >$@ 2>/dev/null
    539 
    540 check_PROGRAMS += weak_unresolved_symbols_test
    541 weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
    542 weak_unresolved_symbols_test_CXXFLAGS = -fPIE
    543 weak_unresolved_symbols_test_LDFLAGS = -Bgcctestdir/ -pie -Wl,--weak-unresolved-symbols
    544 
    545 check_SCRIPTS += two_file_shared.sh
    546 check_DATA += two_file_shared.dbg
    547 MOSTLYCLEANFILES += two_file_shared.dbg
    548 two_file_shared.dbg: two_file_shared.so
    549 	$(TEST_READELF) -w $< >$@ 2>/dev/null
    550 
    551 # The nonpic tests will fail on platforms which can not put non-PIC
    552 # code into shared libraries, so we just don't run them in that case.
    553 if FN_PTRS_IN_SO_WITHOUT_PIC
    554 
    555 check_PROGRAMS += two_file_shared_1_nonpic_test
    556 check_PROGRAMS += two_file_shared_2_nonpic_test
    557 check_PROGRAMS += two_file_same_shared_nonpic_test
    558 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
    559 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
    560 check_PROGRAMS += two_file_mixed_shared_test
    561 check_PROGRAMS += two_file_mixed_2_shared_test
    562 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
    563 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
    564 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
    565 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
    566 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
    567 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
    568 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
    569 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
    570 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
    571 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
    572 
    573 two_file_shared_1_nonpic_test_SOURCES = \
    574 	two_file_test_2.cc two_file_test_main.cc
    575 two_file_shared_1_nonpic_test_DEPENDENCIES = \
    576 	gcctestdir/ld two_file_shared_1_nonpic.so
    577 two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    578 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
    579 
    580 two_file_shared_2_nonpic_test_SOURCES = \
    581 	two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
    582 two_file_shared_2_nonpic_test_DEPENDENCIES = \
    583 	gcctestdir/ld two_file_shared_2_nonpic.so
    584 two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    585 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
    586 
    587 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
    588 two_file_same_shared_nonpic_test_DEPENDENCIES = \
    589 	gcctestdir/ld two_file_shared_nonpic.so
    590 two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    591 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
    592 
    593 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
    594 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
    595 	gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
    596 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    597 two_file_separate_shared_12_nonpic_test_LDADD = \
    598 	two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
    599 
    600 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
    601 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
    602 	gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
    603 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    604 two_file_separate_shared_21_nonpic_test_LDADD = \
    605 	two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
    606 
    607 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
    608 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
    609 two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    610 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
    611 
    612 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
    613 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
    614 two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    615 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
    616 
    617 check_PROGRAMS += two_file_mixed_pie_test
    618 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
    619 		two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
    620 	$(CXXLINK) -Bgcctestdir/ -Wl,-R,. -pie two_file_test_1.o two_file_test_1b_pie.o two_file_test_main_pie.o two_file_shared_2.so
    621 
    622 endif FN_PTRS_IN_SO_WITHOUT_PIC
    623 
    624 check_PROGRAMS += two_file_strip_test
    625 two_file_strip_test: two_file_test
    626 	$(TEST_STRIP) -o two_file_strip_test two_file_test
    627 
    628 check_PROGRAMS += two_file_same_shared_strip_test
    629 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
    630 two_file_same_shared_strip_test_DEPENDENCIES = \
    631 	gcctestdir/ld two_file_shared_strip.so
    632 two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
    633 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
    634 two_file_shared_strip.so: two_file_shared.so
    635 	$(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
    636 
    637 check_PROGRAMS += common_test_1
    638 common_test_1_SOURCES = common_test_1.c
    639 common_test_1_DEPENDENCIES = gcctestdir/ld
    640 common_test_1_LDFLAGS = -Bgcctestdir/
    641 common_test_1_LDADD =
    642 
    643 check_PROGRAMS += common_test_2
    644 common_test_2_SOURCES = common_test_1.c
    645 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
    646 common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    647 common_test_2_LDADD = common_test_2.so common_test_3.so
    648 common_test_2_pic.o: common_test_2.c
    649 	$(COMPILE) -c -fpic -o $@ $<
    650 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
    651 	$(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
    652 common_test_3_pic.o: common_test_3.c
    653 	$(COMPILE) -c -fpic -o $@ $<
    654 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
    655 	$(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
    656 
    657 check_PROGRAMS += exception_test
    658 check_PROGRAMS += exception_shared_1_test
    659 check_PROGRAMS += exception_shared_2_test
    660 check_PROGRAMS += exception_same_shared_test
    661 check_PROGRAMS += exception_separate_shared_12_test
    662 check_PROGRAMS += exception_separate_shared_21_test
    663 exception_test_1_pic.o: exception_test_1.cc
    664 	$(CXXCOMPILE) -c -fpic -o $@ $<
    665 exception_test_2_pic.o: exception_test_2.cc
    666 	$(CXXCOMPILE) -c -fpic -o $@ $<
    667 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
    668 	$(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
    669 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
    670 	$(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
    671 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
    672 	$(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
    673 
    674 exception_test_SOURCES = \
    675 	exception_test_main.cc \
    676 	exception_test_1.cc \
    677 	exception_test_2.cc \
    678 	exception_test.h
    679 exception_test_DEPENDENCIES = gcctestdir/ld
    680 exception_test_LDFLAGS = -Bgcctestdir/
    681 exception_test_LDADD =
    682 
    683 if HAVE_STATIC
    684 check_PROGRAMS += exception_static_test
    685 exception_static_test_SOURCES = $(exception_test_SOURCES)
    686 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
    687 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
    688 exception_static_test_LDADD = $(exception_test_LDADD)
    689 endif
    690 
    691 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
    692 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
    693 exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    694 exception_shared_1_test_LDADD = exception_shared_1.so
    695 
    696 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
    697 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
    698 exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    699 exception_shared_2_test_LDADD = exception_shared_2.so
    700 
    701 exception_same_shared_test_SOURCES = exception_test_main.cc
    702 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
    703 exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    704 exception_same_shared_test_LDADD = exception_shared.so
    705 
    706 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
    707 exception_separate_shared_12_test_DEPENDENCIES = \
    708 	gcctestdir/ld exception_shared_1.so exception_shared_2.so
    709 exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
    710 	-Wl,--no-as-needed
    711 exception_separate_shared_12_test_LDADD = \
    712 	exception_shared_1.so exception_shared_2.so
    713 
    714 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
    715 exception_separate_shared_21_test_DEPENDENCIES = \
    716 	gcctestdir/ld exception_shared_1.so exception_shared_2.so
    717 exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
    718 	-Wl,--no-as-needed
    719 exception_separate_shared_21_test_LDADD = \
    720 	exception_shared_2.so exception_shared_1.so
    721 
    722 
    723 check_PROGRAMS += weak_test
    724 weak_test_SOURCES = weak_test.cc
    725 weak_test_DEPENDENCIES = gcctestdir/ld
    726 weak_test_LDFLAGS = -Bgcctestdir/
    727 weak_test_LDADD =
    728 
    729 check_PROGRAMS += weak_undef_test
    730 MOSTLYCLEANFILES += alt/weak_undef_lib.so
    731 weak_undef_test_SOURCES = weak_undef_test.cc
    732 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
    733 weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
    734 weak_undef_test_LDADD = -L . weak_undef_lib.so
    735 weak_undef_file1.o: weak_undef_file1.cc
    736 	$(CXXCOMPILE) -c -fpic -o $@ $<
    737 weak_undef_file2.o: weak_undef_file2.cc
    738 	$(CXXCOMPILE) -c -fpic -o $@ $<
    739 weak_undef_lib.so: weak_undef_file1.o
    740 	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
    741 alt/weak_undef_lib.so: weak_undef_file2.o
    742 	test -d alt || mkdir -p alt
    743 	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
    744 
    745 check_PROGRAMS += weak_undef_test_2
    746 weak_undef_test_2_SOURCES = weak_undef_test_2.cc
    747 weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
    748 weak_undef_test_2_LDFLAGS = -Bgcctestdir/ -u weak_undef_2
    749 weak_undef_test_2_LDADD = -L . -lweak_undef_2
    750 MOSTLYCLEANFILES += libweak_undef_2.a
    751 libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
    752 	$(TEST_AR) rc $@ $^
    753 weak_undef_file3.o: weak_undef_file3.cc
    754 	$(CXXCOMPILE) -c -o $@ $<
    755 weak_undef_file4.o: weak_undef_file4.cc
    756 	$(CXXCOMPILE) -c -o $@ $<
    757 
    758 if FN_PTRS_IN_SO_WITHOUT_PIC
    759 check_PROGRAMS += weak_undef_nonpic_test
    760 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
    761 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
    762 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
    763 weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
    764 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
    765 weak_undef_file1_nonpic.o: weak_undef_file1.cc
    766 	$(CXXCOMPILE) -c -o $@ $<
    767 weak_undef_file2_nonpic.o: weak_undef_file2.cc
    768 	$(CXXCOMPILE) -c -o $@ $<
    769 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
    770 	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
    771 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
    772 	test -d alt || mkdir -p alt
    773 	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
    774 endif FN_PTRS_IN_SO_WITHOUT_PIC
    775 
    776 
    777 check_PROGRAMS += weak_alias_test
    778 weak_alias_test_SOURCES = weak_alias_test_main.cc
    779 weak_alias_test_DEPENDENCIES = \
    780 	gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
    781 	weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
    782 weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    783 weak_alias_test_LDADD = \
    784 	weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
    785 	weak_alias_test_4.so weak_alias_test_5.so
    786 weak_alias_test_1_pic.o: weak_alias_test_1.cc
    787 	$(CXXCOMPILE) -c -fpic -o $@ $<
    788 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
    789 	$(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
    790 weak_alias_test_2_pic.o: weak_alias_test_2.cc
    791 	$(CXXCOMPILE) -c -fpic -o $@ $<
    792 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
    793 	$(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
    794 weak_alias_test_3.o: weak_alias_test_3.cc
    795 	$(CXXCOMPILE) -c -o $@ $<
    796 weak_alias_test_4_pic.o: weak_alias_test_4.cc
    797 	$(CXXCOMPILE) -c -fpic -o $@ $<
    798 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
    799 	$(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
    800 weak_alias_test_5_pic.o: weak_alias_test_5.cc
    801 	$(CXXCOMPILE) -c -fpic -o $@ $<
    802 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
    803 	$(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
    804 		-Wl,--version-script,$(srcdir)/weak_alias_test.script
    805 
    806 check_SCRIPTS += weak_plt.sh
    807 check_PROGRAMS += weak_plt
    808 check_DATA += weak_plt_shared.so
    809 weak_plt_main_pic.o: weak_plt_main.cc
    810 	$(CXXCOMPILE) -c -fpic -o $@ $<
    811 weak_plt: weak_plt_main_pic.o gcctestdir/ld
    812 	$(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
    813 weak_plt_shared_pic.o: weak_plt_shared.cc
    814 	$(CXXCOMPILE) -c -fpic -o $@ $<
    815 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
    816 	$(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
    817 
    818 check_PROGRAMS += copy_test
    819 copy_test_SOURCES = copy_test.cc
    820 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
    821 copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    822 copy_test_LDADD = copy_test_1.so copy_test_2.so
    823 copy_test_1_pic.o: copy_test_1.cc
    824 	$(CXXCOMPILE) -c -fpic -o $@ $<
    825 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
    826 	$(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
    827 copy_test_2_pic.o: copy_test_2.cc
    828 	$(CXXCOMPILE) -c -fpic -o $@ $<
    829 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
    830 	$(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
    831 
    832 if TLS
    833 
    834 check_PROGRAMS += tls_test
    835 check_PROGRAMS += tls_pic_test
    836 check_PROGRAMS += tls_pie_test
    837 check_PROGRAMS += tls_pie_pic_test
    838 check_PROGRAMS += tls_shared_test
    839 check_PROGRAMS += tls_shared_ie_test
    840 check_PROGRAMS += tls_shared_gd_to_ie_test
    841 tls_test_pic.o: tls_test.cc
    842 	$(CXXCOMPILE) -c -fpic -o $@ $<
    843 tls_test_file2_pic.o: tls_test_file2.cc
    844 	$(CXXCOMPILE) -c -fpic -o $@ $<
    845 tls_test_c_pic.o: tls_test_c.c
    846 	$(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
    847 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
    848 	$(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
    849 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
    850 	$(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
    851 
    852 tls_test_pic_ie.o: tls_test.cc
    853 	$(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
    854 tls_test_file2_pic_ie.o: tls_test_file2.cc
    855 	$(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
    856 tls_test_c_pic_ie.o: tls_test_c.c
    857 	$(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
    858 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
    859 	$(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
    860 
    861 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
    862 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
    863 tls_test_LDFLAGS = -Bgcctestdir/
    864 tls_test_LDADD = tls_test_c.o -lpthread
    865 tls_test_c.o: tls_test_c.c
    866 	$(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
    867 
    868 tls_pic_test_SOURCES = tls_test_main.cc
    869 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
    870 	tls_test_c_pic.o
    871 tls_pic_test_LDFLAGS = -Bgcctestdir/
    872 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
    873 	-lpthread
    874 
    875 tls_test_main_pie.o: tls_test_main.cc tls_test.h
    876 	$(CXXCOMPILE) -c -fpie -o $@ $<
    877 tls_test_pie.o: tls_test.cc tls_test.h
    878 	$(CXXCOMPILE) -c -fpie -o $@ $<
    879 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
    880 	$(CXXCOMPILE) -c -fpie -o $@ $<
    881 tls_test_c_pie.o: tls_test_c.c
    882 	$(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
    883 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
    884 		tls_test_c_pie.o gcctestdir/ld
    885 	$(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
    886 
    887 check_SCRIPTS += tls_pie_test.sh
    888 check_DATA += tls_pie_test.stdout
    889 tls_pie_test.stdout: tls_pie_test
    890 	$(TEST_READELF) -rW $< > $@ 2>/dev/null
    891 
    892 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
    893 		tls_test_c_pic.o gcctestdir/ld
    894 	$(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
    895 
    896 tls_shared_test_SOURCES = tls_test_main.cc
    897 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
    898 tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    899 tls_shared_test_LDADD = tls_test_shared.so -lpthread
    900 
    901 tls_shared_ie_test_SOURCES = tls_test_main.cc
    902 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
    903 tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    904 tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
    905 
    906 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
    907 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
    908 	tls_test_c_pic.o tls_test_shared2.so
    909 tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    910 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
    911 	tls_test_shared2.so -lpthread
    912 
    913 if TLS_GNU2_DIALECT
    914 
    915 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
    916 
    917 tls_test_gnu2.o: tls_test.cc
    918 	$(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
    919 tls_test_file2_gnu2.o: tls_test_file2.cc
    920 	$(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
    921 tls_test_c_gnu2.o: tls_test_c.c
    922 	$(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
    923 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
    924 	$(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
    925 
    926 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
    927 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
    928 	tls_test_c_gnu2.o tls_test_gnu2_shared2.so
    929 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    930 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
    931 	tls_test_gnu2_shared2.so -lpthread
    932 
    933 if TLS_DESCRIPTORS
    934 
    935 check_PROGRAMS += tls_shared_gnu2_test
    936 
    937 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
    938 	$(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
    939 
    940 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
    941 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
    942 tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    943 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
    944 
    945 endif TLS_DESCRIPTORS
    946 
    947 endif TLS_GNU2_DIALECT
    948 
    949 if HAVE_STATIC
    950 if STATIC_TLS
    951 check_PROGRAMS += tls_static_test
    952 check_PROGRAMS += tls_static_pic_test
    953 
    954 tls_static_test_SOURCES = $(tls_test_SOURCES)
    955 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
    956 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
    957 tls_static_test_LDADD = $(tls_test_LDADD)
    958 
    959 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
    960 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
    961 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
    962 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
    963 endif
    964 endif
    965 
    966 if FN_PTRS_IN_SO_WITHOUT_PIC
    967 check_PROGRAMS += tls_shared_nonpic_test
    968 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
    969 	$(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
    970 
    971 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
    972 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
    973 tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
    974 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
    975 endif FN_PTRS_IN_SO_WITHOUT_PIC
    976 
    977 endif TLS
    978 
    979 if DEFAULT_TARGET_I386
    980 
    981 check_SCRIPTS += i386_mov_to_lea.sh
    982 check_DATA += i386_mov_to_lea1.stdout  i386_mov_to_lea2.stdout \
    983 	i386_mov_to_lea3.stdout  i386_mov_to_lea4.stdout \
    984 	i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
    985 	i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
    986 MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
    987 	i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
    988 	i386_mov_to_lea7 i386_mov_to_lea8
    989 
    990 i386_mov_to_lea1.o: i386_mov_to_lea1.s
    991 	$(TEST_AS) --32 -o $@ $<
    992 i386_mov_to_lea2.o: i386_mov_to_lea2.s
    993 	$(TEST_AS) --32 -o $@ $<
    994 i386_mov_to_lea3.o: i386_mov_to_lea3.s
    995 	$(TEST_AS) --32 -o $@ $<
    996 i386_mov_to_lea4.o: i386_mov_to_lea4.s
    997 	$(TEST_AS) --32 -o $@ $<
    998 i386_mov_to_lea5.o: i386_mov_to_lea5.s
    999 	$(TEST_AS) --32 -o $@ $<
   1000 i386_mov_to_lea1: i386_mov_to_lea1.o
   1001 	../ld-new -Bsymbolic -shared -melf_i386  -o $@ $<
   1002 i386_mov_to_lea2: i386_mov_to_lea1.o
   1003 	../ld-new  -pie -melf_i386  -o $@ $<
   1004 i386_mov_to_lea3: i386_mov_to_lea1.o
   1005 	../ld-new -melf_i386  -o $@ $<
   1006 i386_mov_to_lea4: i386_mov_to_lea1.o
   1007 	../ld-new -melf_i386 -shared  -o $@ $<
   1008 i386_mov_to_lea5: i386_mov_to_lea2.o
   1009 	../ld-new -melf_i386 -shared  -o $@ $<
   1010 i386_mov_to_lea6: i386_mov_to_lea3.o
   1011 	../ld-new -melf_i386 -shared  -o $@ $<
   1012 i386_mov_to_lea7: i386_mov_to_lea4.o
   1013 	../ld-new -melf_i386 -shared  -o $@ $<
   1014 i386_mov_to_lea8: i386_mov_to_lea5.o
   1015 	../ld-new -melf_i386 -shared  -o $@ $<
   1016 i386_mov_to_lea1.stdout: i386_mov_to_lea1
   1017 	$(TEST_OBJDUMP) -dw $< > $@
   1018 i386_mov_to_lea2.stdout: i386_mov_to_lea2
   1019 	$(TEST_OBJDUMP) -dw $< > $@
   1020 i386_mov_to_lea3.stdout: i386_mov_to_lea3
   1021 	$(TEST_OBJDUMP) -dw $< > $@
   1022 i386_mov_to_lea4.stdout: i386_mov_to_lea4
   1023 	$(TEST_OBJDUMP) -dw $< > $@
   1024 i386_mov_to_lea5.stdout: i386_mov_to_lea5
   1025 	$(TEST_OBJDUMP) -dw $< > $@
   1026 i386_mov_to_lea6.stdout: i386_mov_to_lea6
   1027 	$(TEST_OBJDUMP) -dw $< > $@
   1028 i386_mov_to_lea7.stdout: i386_mov_to_lea7
   1029 	$(TEST_OBJDUMP) -dw $< > $@
   1030 i386_mov_to_lea8.stdout: i386_mov_to_lea8
   1031 	$(TEST_OBJDUMP) -dw $< > $@
   1032 
   1033 endif DEFAULT_TARGET_I386
   1034 
   1035 check_PROGRAMS += many_sections_test
   1036 many_sections_test_SOURCES = many_sections_test.cc
   1037 many_sections_test_DEPENDENCIES = gcctestdir/ld
   1038 many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
   1039 many_sections_test_LDADD =
   1040 
   1041 BUILT_SOURCES += many_sections_define.h
   1042 MOSTLYCLEANFILES += many_sections_define.h
   1043 many_sections_define.h:
   1044 	(for i in `seq 1 70000`; do \
   1045 	   echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
   1046 	 done) > $@.tmp
   1047 	mv -f $@.tmp $@
   1048 
   1049 BUILT_SOURCES += many_sections_check.h
   1050 MOSTLYCLEANFILES += many_sections_check.h
   1051 many_sections_check.h:
   1052 	(for i in `seq 1 1000 70000`; do \
   1053 	   echo "assert(var_$$i == $$i);"; \
   1054 	 done) > $@.tmp
   1055 	mv -f $@.tmp $@
   1056 
   1057 check_PROGRAMS += many_sections_r_test
   1058 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
   1059 	gcctestdir/ld -r -o $@ many_sections_test.o
   1060 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
   1061 	$(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
   1062 
   1063 check_PROGRAMS += initpri1
   1064 initpri1_SOURCES = initpri1.c
   1065 initpri1_DEPENDENCIES = gcctestdir/ld
   1066 initpri1_LDFLAGS = -Bgcctestdir/
   1067 initpri1_LDADD =
   1068 
   1069 check_PROGRAMS += initpri2
   1070 initpri2_SOURCES = initpri2.c
   1071 initpri2_DEPENDENCIES = gcctestdir/ld
   1072 initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
   1073 initpri2_LDADD =
   1074 
   1075 check_PROGRAMS += initpri3a
   1076 initpri3a_SOURCES = initpri3.c
   1077 initpri3a_DEPENDENCIES = gcctestdir/ld
   1078 initpri3a_LDFLAGS = -Bgcctestdir/
   1079 initpri3a_LDADD =
   1080 
   1081 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
   1082 # EABI). Given that gcc is moving towards using .init_array in all cases,
   1083 # this test is commented out.  A better fix would be checking whether gcc
   1084 # uses .ctors or .init_array sections in configure.
   1085 
   1086 # check_PROGRAMS += initpri3b
   1087 # initpri3b_SOURCES = initpri3.c
   1088 # initpri3b_DEPENDENCIES = gcctestdir/ld
   1089 # initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
   1090 # initpri3b_LDADD =
   1091 
   1092 # Test --detect-odr-violations
   1093 check_SCRIPTS += debug_msg.sh
   1094 
   1095 # Create the data files that debug_msg.sh analyzes.
   1096 check_DATA += debug_msg.err
   1097 MOSTLYCLEANFILES += debug_msg.err
   1098 debug_msg.o: debug_msg.cc
   1099 	$(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
   1100 odr_violation1.o: odr_violation1.cc
   1101 	$(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
   1102 # Compile with different optimization flags to check that rearranged
   1103 # instructions don't cause a false positive.
   1104 odr_violation2.o: odr_violation2.cc
   1105 	$(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
   1106 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
   1107 	@echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
   1108 	@if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
   1109 	then \
   1110 	  echo 1>&2 "Link of debug_msg should have failed"; \
   1111 	  rm -f $@; \
   1112 	  exit 1; \
   1113 	fi
   1114 
   1115 # Test error message when a vtable is undefined.
   1116 check_SCRIPTS += missing_key_func.sh
   1117 check_DATA += missing_key_func.err
   1118 MOSTLYCLEANFILES += missing_key_func.err
   1119 missing_key_func.o: missing_key_func.cc
   1120 	$(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
   1121 missing_key_func.err: missing_key_func.o gcctestdir/ld
   1122 	@echo $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o "2>$@"
   1123 	@if $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o 2>$@; \
   1124 	then \
   1125 	  echo 1>&2 "Link of missing_key_func should have failed"; \
   1126 	  rm -f $@; \
   1127 	  exit 1; \
   1128 	fi
   1129 
   1130 if HAVE_ZLIB
   1131 
   1132 # Check that --detect-odr-violations works with compressed debug sections.
   1133 check_DATA += debug_msg_cdebug.err
   1134 MOSTLYCLEANFILES += debug_msg_cdebug.err
   1135 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
   1136 	$(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
   1137 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
   1138 	$(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
   1139 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
   1140 	$(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
   1141 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
   1142 	@echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
   1143 	@if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
   1144 	then \
   1145 	  echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
   1146 	  rm -f $@; \
   1147 	  exit 1; \
   1148 	fi
   1149 
   1150 endif HAVE_ZLIB
   1151 
   1152 # See if we can also detect problems when we're linking .so's, not .o's.
   1153 check_DATA += debug_msg_so.err
   1154 MOSTLYCLEANFILES += debug_msg_so.err
   1155 debug_msg.so: debug_msg.cc gcctestdir/ld
   1156 	$(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
   1157 odr_violation1.so: odr_violation1.cc gcctestdir/ld
   1158 	$(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
   1159 odr_violation2.so: odr_violation2.cc gcctestdir/ld
   1160 	$(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
   1161 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
   1162 	@echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
   1163 	@if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
   1164 	then \
   1165 	  echo 1>&2 "Link of debug_msg_so should have failed"; \
   1166 	  rm -f $@; \
   1167 	  exit 1; \
   1168 	fi
   1169 
   1170 # We also want to make sure we do something reasonable when there's no
   1171 # debug info available.  For the best test, we use .so's.
   1172 check_DATA += debug_msg_ndebug.err
   1173 MOSTLYCLEANFILES += debug_msg_ndebug.err
   1174 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
   1175 	$(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
   1176 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
   1177 	$(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
   1178 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
   1179 	$(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
   1180 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
   1181 	@echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so -shared-libgcc -Bdynamic -lstdc++ "2>$@"
   1182 	@if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so -shared-libgcc -Bdynamic -lstdc++ 2>$@; \
   1183 	then \
   1184 	  echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
   1185 	  rm -f $@; \
   1186 	  exit 1; \
   1187 	fi
   1188 
   1189 
   1190 # Similar to --detect-odr-violations: check for undefined symbols in .so's
   1191 check_SCRIPTS += undef_symbol.sh
   1192 check_DATA += undef_symbol.err
   1193 MOSTLYCLEANFILES += undef_symbol.err
   1194 undef_symbol.o: undef_symbol.cc
   1195 	$(CXXCOMPILE) -O0 -g -c -fPIC $<
   1196 undef_symbol.so: undef_symbol.o gcctestdir/ld
   1197 	$(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
   1198 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
   1199 	@echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
   1200 	@if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
   1201 	then \
   1202 	  echo 1>&2 "Link of undef_symbol_test should have failed"; \
   1203 	  rm -f $@; \
   1204 	  exit 1; \
   1205 	fi
   1206 
   1207 
   1208 # Test -o when emitting to a special file (such as something in /dev).
   1209 check_PROGRAMS += flagstest_o_specialfile
   1210 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
   1211 	$(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
   1212 	chmod a+x $@
   1213 	test -s $@
   1214 
   1215 if HAVE_ZLIB
   1216 
   1217 # Test --compress-debug-sections.  FIXME: check we actually compress.
   1218 check_PROGRAMS += flagstest_compress_debug_sections
   1219 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
   1220 	$(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
   1221 	test -s $@
   1222 
   1223 
   1224 # The specialfile output has a tricky case when we also compress debug
   1225 # sections, because it requires output-file resizing.
   1226 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
   1227 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
   1228 		gcctestdir/ld
   1229 	$(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
   1230 	chmod a+x $@
   1231 	test -s $@
   1232 
   1233 endif HAVE_ZLIB
   1234 
   1235 # Test -TText and -Tdata.
   1236 check_PROGRAMS += flagstest_o_ttext_1
   1237 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
   1238 	$(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
   1239 
   1240 # This version won't be runnable, because there is no way to put the
   1241 # PT_PHDR segment at file offset 0.  We just make sure that we can
   1242 # build it without error.
   1243 check_DATA += flagstest_o_ttext_2
   1244 MOSTLYCLEANFILES += flagstest_o_ttext_2
   1245 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
   1246 	$(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
   1247 
   1248 # Test symbol versioning.
   1249 check_PROGRAMS += ver_test
   1250 ver_test_SOURCES = ver_test_main.cc
   1251 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
   1252 ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1253 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
   1254 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
   1255 	$(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
   1256 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
   1257 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
   1258 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
   1259 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
   1260 ver_test_1.o: ver_test_1.cc
   1261 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1262 ver_test_2.o: ver_test_2.cc
   1263 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1264 ver_test_3.o: ver_test_3.cc
   1265 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1266 ver_test_4.o: ver_test_4.cc
   1267 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1268 
   1269 check_SCRIPTS += ver_test_1.sh
   1270 check_DATA += ver_test_1.syms
   1271 ver_test_1.syms: ver_test_1.so
   1272 	$(TEST_READELF) -s $< >$@ 2>/dev/null
   1273 
   1274 check_PROGRAMS += ver_test_2
   1275 ver_test_2_SOURCES = ver_test_main_2.cc
   1276 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
   1277 ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1278 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
   1279 
   1280 check_SCRIPTS += ver_test_2.sh
   1281 check_DATA += ver_test_2.syms
   1282 ver_test_2.syms: ver_test_2
   1283 	$(TEST_READELF) -s $< >$@ 2>/dev/null
   1284 
   1285 check_SCRIPTS += ver_test_4.sh
   1286 check_DATA += ver_test_4.syms
   1287 ver_test_4.syms: ver_test_4.so
   1288 	$(TEST_READELF) -s $< >$@ 2>/dev/null
   1289 
   1290 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
   1291 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
   1292 ver_test_5.o: ver_test_5.cc
   1293 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1294 check_SCRIPTS += ver_test_5.sh
   1295 check_DATA += ver_test_5.syms
   1296 ver_test_5.syms: ver_test_5.so
   1297 	$(TEST_READELF) -s $< >$@ 2>/dev/null
   1298 
   1299 check_PROGRAMS += ver_test_6
   1300 ver_test_6_SOURCES = ver_test_6.c
   1301 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
   1302 ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1303 ver_test_6_LDADD = ver_test_2.so
   1304 
   1305 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
   1306 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
   1307 ver_test_7.o: ver_test_7.cc
   1308 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1309 check_SCRIPTS += ver_test_7.sh
   1310 check_DATA += ver_test_7.syms
   1311 ver_test_7.syms: ver_test_7.so
   1312 	$(TEST_READELF) -s $< >$@ 2>/dev/null
   1313 
   1314 check_PROGRAMS += ver_test_8
   1315 ver_test_8_SOURCES = two_file_test_main.cc
   1316 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
   1317 ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1318 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
   1319 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
   1320 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
   1321 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
   1322 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
   1323 
   1324 check_PROGRAMS += ver_test_9
   1325 ver_test_9_SOURCES = ver_test_main.cc
   1326 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
   1327 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1328 ver_test_9_LDADD = ver_test_9.so
   1329 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
   1330 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
   1331 ver_test_9.o: ver_test_9.cc
   1332 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1333 
   1334 check_SCRIPTS += ver_test_10.sh
   1335 check_DATA += ver_test_10.syms
   1336 ver_test_10.syms: ver_test_10.so
   1337 	$(TEST_READELF) -s $< >$@ 2>/dev/null
   1338 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
   1339 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
   1340 
   1341 check_PROGRAMS += ver_test_11
   1342 MOSTLYCLEANFILES += ver_test_11.a
   1343 ver_test_11_SOURCES = ver_test_main_2.cc
   1344 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
   1345 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1346 ver_test_11_LDADD = ver_test_11.a
   1347 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
   1348 	$(TEST_AR) rc $@ $^
   1349 
   1350 check_PROGRAMS += ver_test_12
   1351 ver_test_12_SOURCES = ver_test_main_2.cc
   1352 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
   1353 ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1354 ver_test_12_LDADD = ver_test_12.o
   1355 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
   1356 	gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
   1357 
   1358 check_PROGRAMS += protected_1
   1359 protected_1_SOURCES = \
   1360 	protected_main_1.cc protected_main_2.cc protected_main_3.cc
   1361 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
   1362 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1363 protected_1_LDADD = protected_1.so
   1364 
   1365 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
   1366 	$(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
   1367 protected_1_pic.o: protected_1.cc
   1368 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1369 protected_2_pic.o: protected_2.cc
   1370 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1371 protected_3_pic.o: protected_3.cc
   1372 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1373 
   1374 check_PROGRAMS += protected_2
   1375 protected_2_SOURCES = protected_main_1.cc protected_3.cc
   1376 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
   1377 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1378 protected_2_LDADD = protected_1.so
   1379 
   1380 check_DATA += protected_3.err
   1381 MOSTLYCLEANFILES += protected_3.err
   1382 protected_4_pic.o: protected_4.cc
   1383 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1384 protected_3.err: protected_4_pic.o gcctestdir/ld
   1385 	@echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
   1386 	@if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
   1387 	  echo 1>&2 "Link of protected_4.so should have failed"; \
   1388 	  rm -f $@; \
   1389 	  exit 1; \
   1390 	fi
   1391 
   1392 check_PROGRAMS += relro_test
   1393 check_SCRIPTS += relro_test.sh
   1394 check_DATA += relro_test.stdout
   1395 relro_test_SOURCES = relro_test_main.cc
   1396 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
   1397 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1398 relro_test_LDADD = relro_test.so
   1399 relro_test.so: gcctestdir/ld relro_test_pic.o
   1400 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
   1401 relro_test_pic.o: relro_test.cc
   1402 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1403 relro_test.stdout: relro_test.so
   1404 	$(TEST_READELF) -SlW relro_test.so > relro_test.stdout
   1405 
   1406 check_PROGRAMS += relro_now_test
   1407 relro_now_test_SOURCES = relro_test_main.cc
   1408 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
   1409 relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
   1410 relro_now_test_LDADD = relro_now_test.so
   1411 relro_now_test.so: gcctestdir/ld relro_test_pic.o
   1412 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
   1413 
   1414 check_PROGRAMS += relro_strip_test
   1415 relro_strip_test_SOURCES = relro_test_main.cc
   1416 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
   1417 relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1418 relro_strip_test_LDADD = relro_strip_test.so
   1419 relro_strip_test.so: relro_test.so
   1420 	$(TEST_STRIP) -o $@ $<
   1421 
   1422 check_PROGRAMS += relro_script_test
   1423 relro_script_test_SOURCES = relro_test_main.cc
   1424 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
   1425 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1426 relro_script_test_LDADD = relro_script_test.so
   1427 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
   1428 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
   1429 
   1430 check_PROGRAMS += script_test_1
   1431 script_test_1_SOURCES = script_test_1.cc
   1432 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
   1433 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
   1434 script_test_1_LDADD =
   1435 
   1436 check_PROGRAMS += script_test_2
   1437 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
   1438 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
   1439 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
   1440 script_test_2_LDADD =
   1441 
   1442 check_PROGRAMS += justsyms
   1443 justsyms_SOURCES = justsyms_1.cc
   1444 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
   1445 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
   1446 justsyms_LDADD =
   1447 justsyms_2.o: justsyms_2.cc
   1448 	$(CXXCOMPILE) -c -o $@ $<
   1449 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
   1450 	gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
   1451 
   1452 check_PROGRAMS += justsyms_exec
   1453 justsyms_exec_SOURCES = justsyms_exec.c
   1454 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
   1455 justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
   1456 justsyms_exec_LDADD =
   1457 MOSTLYCLEANFILES += justsyms_lib
   1458 justsyms_lib.o: justsyms_lib.c
   1459 	$(COMPILE) -c -o $@ $<
   1460 justsyms_lib: justsyms_lib.o gcctestdir/ld
   1461 	gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
   1462 
   1463 check_PROGRAMS += binary_test
   1464 MOSTLYCLEANFILES += binary.txt
   1465 binary_test_SOURCES = binary_test.cc
   1466 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
   1467 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
   1468 binary_test_LDADD =
   1469 # Copy the file to the build directory to avoid worrying about the
   1470 # full pathname in the generated symbols.
   1471 binary.txt: $(srcdir)/binary.in
   1472 	rm -f $@
   1473 	$(LN_S) $< $@
   1474 
   1475 check_SCRIPTS += ver_matching_test.sh
   1476 check_DATA += ver_matching_test.stdout
   1477 MOSTLYCLEANFILES += ver_matching_test.stdout
   1478 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
   1479 	$(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
   1480 ver_matching_def_pic.o: ver_matching_def.cc
   1481 	$(CXXCOMPILE) -O0 -c -fpic -o $@ $<
   1482 ver_matching_test.stdout: ver_matching_def.so
   1483 	$(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
   1484 
   1485 check_PROGRAMS += script_test_3
   1486 check_SCRIPTS += script_test_3.sh
   1487 check_DATA += script_test_3.stdout
   1488 MOSTLYCLEANFILES += script_test_3.stdout
   1489 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
   1490 	$(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
   1491 script_test_3.stdout: script_test_3
   1492 	$(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
   1493 
   1494 check_PROGRAMS += tls_phdrs_script_test
   1495 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
   1496 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
   1497 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
   1498 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
   1499 
   1500 check_SCRIPTS += script_test_4.sh
   1501 check_DATA += script_test_4.stdout
   1502 MOSTLYCLEANFILES += script_test_4
   1503 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
   1504 	$(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
   1505 script_test_4.stdout: script_test_4
   1506 	$(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
   1507 
   1508 check_PROGRAMS += tls_script_test
   1509 tls_script_test_SOURCES = $(tls_test_SOURCES)
   1510 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
   1511 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
   1512 tls_script_test_LDADD = $(tls_test_LDADD)
   1513 
   1514 check_SCRIPTS += script_test_5.sh
   1515 check_DATA += script_test_5.stdout
   1516 MOSTLYCLEANFILES += script_test_5
   1517 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
   1518 	$(CXXLINK) -Bgcctestdir/ script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
   1519 script_test_5.stdout: script_test_5
   1520 	$(TEST_READELF) -SW script_test_5 > script_test_5.stdout
   1521 
   1522 check_SCRIPTS += script_test_6.sh
   1523 check_DATA += script_test_6.stdout
   1524 MOSTLYCLEANFILES += script_test_6
   1525 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
   1526 	$(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
   1527 	-Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
   1528 script_test_6.stdout: script_test_6
   1529 	$(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
   1530 
   1531 check_SCRIPTS += script_test_7.sh
   1532 check_DATA += script_test_7.stdout
   1533 MOSTLYCLEANFILES += script_test_7
   1534 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
   1535 	$(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
   1536 script_test_7.stdout: script_test_7
   1537 	$(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
   1538 
   1539 check_SCRIPTS += script_test_8.sh
   1540 check_DATA += script_test_8.stdout
   1541 MOSTLYCLEANFILES += script_test_8
   1542 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
   1543 	$(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
   1544 	-Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
   1545 script_test_8.stdout: script_test_8
   1546 	$(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
   1547 
   1548 check_SCRIPTS += script_test_9.sh
   1549 check_DATA += script_test_9.stdout
   1550 MOSTLYCLEANFILES += script_test_9
   1551 script_test_9.o: script_test_9.cc
   1552 	$(CXXCOMPILE) -O0 -c -o $@ $<
   1553 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
   1554 	$(CXXLINK) -Bgcctestdir/ script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
   1555 script_test_9.stdout: script_test_9
   1556 	$(TEST_READELF) -lW script_test_9 > script_test_9.stdout
   1557 
   1558 # Test scripts with a relocatable link.
   1559 # The -g option is necessary to trigger a bug where a section
   1560 # declared in a script file is assigned a non-zero starting address.
   1561 check_PROGRAMS += script_test_11
   1562 script_test_11: gcctestdir/ld script_test_11_r.o
   1563 	$(LINK) -Bgcctestdir/ script_test_11_r.o
   1564 script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11.o
   1565 	gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11.o
   1566 script_test_11.o: script_test_11.c
   1567 	$(COMPILE) -c -g -o $@ $<
   1568 
   1569 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
   1570 # and --dynamic-list-cpp-typeinfo
   1571 
   1572 check_SCRIPTS += dynamic_list.sh
   1573 check_DATA += dynamic_list.stdout
   1574 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
   1575 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
   1576 	$(CXXLINK) -Bgcctestdir/ basic_test.o \
   1577 	  -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
   1578 	  -Wl,--dynamic-list-data \
   1579 	  -Wl,--dynamic-list-cpp-new \
   1580 	  -Wl,--dynamic-list-cpp-typeinfo
   1581 dynamic_list.stdout: dynamic_list
   1582 	$(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
   1583 
   1584 check_PROGRAMS += dynamic_list_2
   1585 dynamic_list_2_SOURCES = dynamic_list_2.cc
   1586 dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
   1587 dynamic_list_2_LDFLAGS = -Bgcctestdir/ -L. -Wl,-R,. -Wl,--no-as-needed
   1588 dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
   1589 
   1590 dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
   1591 	$(CXXLINK) -Bgcctestdir/ -shared dynamic_list_lib1.o
   1592 dynamic_list_lib1.o: dynamic_list_lib1.cc
   1593 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1594 
   1595 dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
   1596 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
   1597 dynamic_list_lib2.o: dynamic_list_lib2.cc
   1598 	$(CXXCOMPILE) -c -fpic -o $@ $<
   1599 
   1600 check_PROGRAMS += thin_archive_test_1
   1601 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
   1602 	alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
   1603 	alt/libthin2.a alt/libthin4.a
   1604 thin_archive_test_1_SOURCES = thin_archive_main.cc
   1605 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
   1606 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
   1607 thin_archive_test_1_LDADD = libthin1.a -lthin2
   1608 
   1609 check_PROGRAMS += thin_archive_test_2
   1610 thin_archive_test_2_SOURCES = thin_archive_main.cc
   1611 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
   1612 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
   1613 thin_archive_test_2_LDADD = -lthinall
   1614 
   1615 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
   1616 	rm -f $@
   1617 	$(TEST_AR) crT $@ $^
   1618 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
   1619 	rm -f $@
   1620 	$(TEST_AR) crT $@ $^
   1621 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
   1622 	rm -f $@
   1623 	$(TEST_AR) crT $@ $^
   1624 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
   1625 	rm -f $@
   1626 	$(TEST_AR) crT $@ $^
   1627 libthinall.a: libthin3.a alt/libthin4.a
   1628 	rm -f $@
   1629 	$(TEST_AR) crT $@ $^
   1630 alt/thin_archive_test_2.o: thin_archive_test_2.cc
   1631 	test -d alt || mkdir -p alt
   1632 	$(CXXCOMPILE) -c -o $@ $<
   1633 alt/thin_archive_test_4.o: thin_archive_test_4.cc
   1634 	test -d alt || mkdir -p alt
   1635 	$(CXXCOMPILE) -c -o $@ $<
   1636 
   1637 if PLUGINS
   1638 
   1639 check_PROGRAMS += plugin_test_1
   1640 check_SCRIPTS += plugin_test_1.sh
   1641 check_DATA += plugin_test_1.err
   1642 MOSTLYCLEANFILES += plugin_test_1.err
   1643 plugin_test_1: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
   1644 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_1.err
   1645 plugin_test_1.err: plugin_test_1
   1646 	@touch plugin_test_1.err
   1647 
   1648 check_PROGRAMS += plugin_test_2
   1649 check_SCRIPTS += plugin_test_2.sh
   1650 check_DATA += plugin_test_2.err
   1651 MOSTLYCLEANFILES += plugin_test_2.err
   1652 plugin_test_2: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
   1653 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so 2>plugin_test_2.err
   1654 plugin_test_2.err: plugin_test_2
   1655 	@touch plugin_test_2.err
   1656 
   1657 check_PROGRAMS += plugin_test_3
   1658 check_SCRIPTS += plugin_test_3.sh
   1659 check_DATA += plugin_test_3.err
   1660 MOSTLYCLEANFILES += plugin_test_3.err
   1661 plugin_test_3: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
   1662 	$(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_3.err
   1663 plugin_test_3.err: plugin_test_3
   1664 	@touch plugin_test_3.err
   1665 
   1666 check_PROGRAMS += plugin_test_4
   1667 check_SCRIPTS += plugin_test_4.sh
   1668 check_DATA += plugin_test_4.err
   1669 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
   1670 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
   1671 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o -Wl,--whole-archive,plugin_test_4.a,--no-whole-archive 2>plugin_test_4.err
   1672 plugin_test_4.err: plugin_test_4
   1673 	@touch plugin_test_4.err
   1674 
   1675 plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
   1676 	$(TEST_AR) cr $@ $^
   1677 
   1678 check_PROGRAMS += plugin_test_5
   1679 plugin_test_5: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms gcctestdir/ld plugin_test.so
   1680 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms
   1681 
   1682 check_PROGRAMS += plugin_test_6
   1683 check_SCRIPTS += plugin_test_6.sh
   1684 check_DATA += plugin_test_6.err
   1685 MOSTLYCLEANFILES += plugin_test_6.err
   1686 plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
   1687 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o.syms 2>plugin_test_6.err
   1688 plugin_test_6.err: plugin_test_6
   1689 	@touch plugin_test_6.err
   1690 
   1691 check_PROGRAMS += plugin_test_7
   1692 check_SCRIPTS += plugin_test_7.sh
   1693 check_DATA += plugin_test_7.err plugin_test_7.o.syms
   1694 MOSTLYCLEANFILES += plugin_test_7.err
   1695 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
   1696 	$(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.o.syms plugin_test_7_2.o 2>plugin_test_7.err
   1697 plugin_test_7.o.syms: plugin_test_7
   1698 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1699 plugin_test_7_1.o: plugin_test_7_1.c
   1700 	$(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
   1701 plugin_test_7_1_orig.o: plugin_test_7_1.c
   1702 	$(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
   1703 plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
   1704 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1705 plugin_test_7_2.o: plugin_test_7_2.c
   1706 	$(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
   1707 plugin_test_7.err: plugin_test_7
   1708 
   1709 # Test plugins with -r.
   1710 check_PROGRAMS += plugin_test_8
   1711 plugin_test_8.o: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o ../ld-new plugin_test.so
   1712 	../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o
   1713 plugin_test_8: plugin_test_8.o gcctestdir/ld
   1714 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
   1715 
   1716 # Test that symbols known in the IR file but not in the replacement file
   1717 # produce an unresolved symbol error.
   1718 check_DATA += plugin_test_9.err
   1719 MOSTLYCLEANFILES += plugin_test_9.err
   1720 plugin_test_9.err: two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms gcctestdir/ld plugin_test.so
   1721 	@echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms "2>$@"
   1722 	@if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms 2>$@; then \
   1723 	  echo 1>&2 "Link of plugin_test_9 should have failed"; \
   1724 	  rm -f $@; \
   1725 	  exit 1; \
   1726 	fi
   1727 # Make a .syms file that claims to define the symbol _Z4t16av.
   1728 two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
   1729 	cp two_file_test_1.o.syms $@.tmp
   1730 	grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
   1731 	mv -f $@.tmp $@
   1732 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
   1733 MOSTLYCLEANFILES += two_file_test_1c.o
   1734 two_file_test_1c.o: two_file_test_1.o
   1735 	cp two_file_test_1.o $@
   1736 
   1737 check_PROGRAMS += plugin_test_10
   1738 check_SCRIPTS += plugin_test_10.sh
   1739 check_DATA += plugin_test_10.sections
   1740 MOSTLYCLEANFILES += plugin_test_10.sections
   1741 plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o  gcctestdir/ld plugin_test.so
   1742 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
   1743 plugin_test_10.sections: plugin_test_10
   1744 	$(TEST_READELF) -SW $< >$@ 2>/dev/null
   1745 
   1746 check_PROGRAMS += plugin_test_11
   1747 check_SCRIPTS += plugin_test_11.sh
   1748 check_DATA += plugin_test_11.err
   1749 MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
   1750 PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
   1751 plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
   1752 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o plugin_test_thin.a 2>plugin_test_11.err
   1753 plugin_test_11.err: plugin_test_11
   1754 	@touch plugin_test_11.err
   1755 plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
   1756 	rm -f $@
   1757 	$(TEST_AR) crT $@ $^
   1758 
   1759 plugin_test.so: plugin_test.o
   1760 	$(LINK) -Bgcctestdir/ -shared plugin_test.o
   1761 plugin_test.o: plugin_test.c
   1762 	$(COMPILE) -O0 -c -fpic -o $@ $<
   1763 
   1764 two_file_test_main.o.syms: two_file_test_main.o
   1765 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1766 two_file_test_1.o.syms: two_file_test_1.o
   1767 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1768 two_file_test_1b.o.syms: two_file_test_1b.o
   1769 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1770 two_file_test_2.o.syms: two_file_test_2.o
   1771 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1772 plugin_common_test_1.o.syms: plugin_common_test_1.o
   1773 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1774 plugin_common_test_2.o.syms: plugin_common_test_2.o
   1775 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1776 
   1777 empty.o.syms:
   1778 	@echo "" >$@
   1779 	@echo "Symbol table" >>$@
   1780 
   1781 if TLS
   1782 
   1783 check_PROGRAMS += plugin_test_tls
   1784 check_SCRIPTS += plugin_test_tls.sh
   1785 check_DATA += plugin_test_tls.err
   1786 MOSTLYCLEANFILES += plugin_test_tls.err
   1787 plugin_test_tls: two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms gcctestdir/ld plugin_test.so
   1788 	$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms 2>plugin_test_tls.err
   1789 plugin_test_tls.err: plugin_test_tls
   1790 	@touch plugin_test_tls.err
   1791 
   1792 two_file_test_2_tls.o.syms: two_file_test_2_tls.o
   1793 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1794 
   1795 endif TLS
   1796 
   1797 MOSTLYCLEANFILES += unused.c
   1798 unused.o.syms: unused.o
   1799 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1800 	@echo "     1: 00000000     4 FUNC    GLOBAL DEFAULT    1 UNUSED" >>$@
   1801 unused.o: unused.c
   1802 	$(COMPILE) -c -o $@ $<
   1803 unused.c:
   1804 	@cp /dev/null $@
   1805 
   1806 check_SCRIPTS += plugin_final_layout.sh
   1807 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
   1808 MOSTLYCLEANFILES += plugin_final_layout
   1809 plugin_final_layout.o: plugin_final_layout.cc
   1810 	$(CXXCOMPILE) -O0 -c -ffunction-sections  -fdata-sections -g -o $@ $<
   1811 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
   1812 	$(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
   1813 plugin_final_layout.stdout: plugin_final_layout
   1814 	$(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
   1815 plugin_final_layout_readelf.stdout: plugin_final_layout
   1816 	$(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
   1817 
   1818 plugin_section_order.so: plugin_section_order.o
   1819 	$(LINK) -Bgcctestdir/ -shared plugin_section_order.o
   1820 plugin_section_order.o: plugin_section_order.c
   1821 	$(COMPILE) -O0 -c -fpic -o $@ $<
   1822 
   1823 endif PLUGINS
   1824 
   1825 check_PROGRAMS += exclude_libs_test
   1826 check_SCRIPTS += exclude_libs_test.sh
   1827 check_DATA += exclude_libs_test.syms
   1828 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
   1829         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
   1830 exclude_libs_test_SOURCES = exclude_libs_test.c
   1831 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
   1832 	libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
   1833 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
   1834 	-Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
   1835 	-Wl,--exclude-libs,libexclude_libs_test_3
   1836 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
   1837 	alt/libexclude_libs_test_3.a
   1838 exclude_libs_test.syms: exclude_libs_test
   1839 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1840 libexclude_libs_test_1.a: exclude_libs_test_1.o
   1841 	$(TEST_AR) rc $@ $^
   1842 libexclude_libs_test_2.a: exclude_libs_test_2.o
   1843 	$(TEST_AR) rc $@ $^
   1844 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
   1845 	test -d alt || mkdir -p alt
   1846 	$(TEST_AR) rc $@ $^
   1847 
   1848 check_PROGRAMS += local_labels_test
   1849 local_labels_test.o: ver_test_6.c
   1850 	$(COMPILE) -g -c -Wa,-L -o $@ $<
   1851 local_labels_test: local_labels_test.o
   1852 	$(LINK) -Bgcctestdir/ local_labels_test.o
   1853 
   1854 check_PROGRAMS += discard_locals_test
   1855 check_SCRIPTS += discard_locals_test.sh
   1856 check_DATA += discard_locals_test.syms \
   1857 	discard_locals_relocatable_test1.syms \
   1858 	discard_locals_relocatable_test2.syms
   1859 MOSTLYCLEANFILES += discard_locals_test.syms \
   1860 	discard_locals_relocatable_test1.syms \
   1861 	discard_locals_relocatable_test2.syms \
   1862 	discard_locals_relocatable_test1.out \
   1863 	discard_locals_relocatable_test2.out
   1864 discard_locals_test_SOURCES = discard_locals_test.c
   1865 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
   1866 discard_locals_test.syms: discard_locals_test
   1867 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1868 # '-Wa,-L' is required to preserve the local label used for testing.
   1869 discard_locals_test.o: discard_locals_test.c
   1870 	$(COMPILE) -c -Wa,-L -o $@ $<
   1871 
   1872 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
   1873 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1874 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
   1875 	$(COMPILE) -c -Wa,-L -fPIC -o $@ $<
   1876 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
   1877 	../ld-new --discard-locals -relocatable -o $@ $<
   1878 
   1879 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
   1880 	$(TEST_READELF) -sW $< >$@ 2>/dev/null
   1881 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
   1882 	../ld-new --discard-all -relocatable -o $@ $<
   1883 
   1884 if MCMODEL_MEDIUM
   1885 check_PROGRAMS += large
   1886 large_SOURCES = large.c
   1887 large_CFLAGS = -mcmodel=medium
   1888 large_DEPENDENCIES = gcctestdir/ld
   1889 large_LDFLAGS = -Bgcctestdir/
   1890 large_LDADD =
   1891 endif MCMODEL_MEDIUM
   1892 
   1893 # Test that hidden and internal symbols in the main program cannot be
   1894 # referenced by a shared library.
   1895 check_SCRIPTS += hidden_test.sh
   1896 check_DATA += hidden_test.err
   1897 MOSTLYCLEANFILES += hidden_test hidden_test.err
   1898 libhidden.so: hidden_test_1.c gcctestdir/ld
   1899 	$(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
   1900 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
   1901 	$(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
   1902 hidden_test.err: hidden_test
   1903 	@touch hidden_test.err
   1904 
   1905 # Test -retain-symbols-file.
   1906 check_SCRIPTS += retain_symbols_file_test.sh
   1907 check_DATA += retain_symbols_file_test.stdout
   1908 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
   1909                     retain_symbols_file_test.stdout
   1910 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
   1911 	echo 'main' > retain_symbols_file_test.in
   1912 	echo 't1' >> retain_symbols_file_test.in
   1913 	echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
   1914 	echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
   1915 	echo '_Z3t18v' >> retain_symbols_file_test.in
   1916 	echo '__tcf_0' >> retain_symbols_file_test.in
   1917 	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
   1918 retain_symbols_file_test.stdout: retain_symbols_file_test.so
   1919 	$(TEST_NM) -C retain_symbols_file_test.so > $@
   1920 
   1921 
   1922 # Test that if the output file already exists and is empty,
   1923 # it will get execute permission.
   1924 check_PROGRAMS += permission_test
   1925 permission_test: basic_test.o gcctestdir/ld
   1926 	umask 022; \
   1927 	rm -f $@; \
   1928 	touch $@; \
   1929 	chmod 600 $@; \
   1930 	$(CXXLINK) -Bgcctestdir/ basic_test.o
   1931 
   1932 # Check -l:foo.a
   1933 check_PROGRAMS += searched_file_test
   1934 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
   1935                     alt/searched_file_test_lib.a
   1936 searched_file_test_SOURCES = searched_file_test.cc
   1937 searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
   1938 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
   1939 searched_file_test_LDADD = -l:searched_file_test_lib.a
   1940 searched_file_test_lib.o: searched_file_test_lib.cc
   1941 	$(CXXCOMPILE) -c -o $@ $<
   1942 alt/searched_file_test_lib.a: searched_file_test_lib.o
   1943 	test -d alt || mkdir -p alt
   1944 	$(TEST_AR) rc $@ $^
   1945 
   1946 # Test that no .gnu.version sections are created when
   1947 # symbol versioning is not used.
   1948 check_SCRIPTS += no_version_test.sh
   1949 check_DATA += no_version_test.stdout
   1950 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
   1951 # We invoke the linker directly since gcc may include additional objects that
   1952 # uses symbol versioning.
   1953 libno_version_test.so: no_version_test.o gcctestdir/ld
   1954 	gcctestdir/ld -shared -o $@ no_version_test.o
   1955 no_version_test.o: no_version_test.c
   1956 	$(COMPILE) -o $@ -c -fPIC $<
   1957 no_version_test.stdout: libno_version_test.so
   1958 	$(TEST_OBJDUMP) -h $< > $@
   1959 
   1960 # Test STT_GNU_IFUNC symbols.
   1961 if IFUNC
   1962 
   1963 ifuncmod1.o: ifuncmod1.c
   1964 	$(COMPILE) -c -fPIC -o $@ $<
   1965 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
   1966 	$(LINK) -Bgcctestdir/ -shared ifuncmod1.o
   1967 
   1968 ifuncdep1.o: ifuncmod1.c
   1969 	$(COMPILE) -c -o $@ $<
   1970 
   1971 ifuncmain1pic.o: ifuncmain1.c
   1972 	$(COMPILE) -c -fPIC -o $@ $<
   1973 ifuncmain1pie.o: ifuncmain1.c
   1974 	$(COMPILE) -c -fPIE -o $@ $<
   1975 
   1976 if HAVE_STATIC
   1977 if IFUNC_STATIC
   1978 check_PROGRAMS += ifuncmain1static
   1979 ifuncmain1static_SOURCES = ifuncmain1.c
   1980 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
   1981 ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
   1982 ifuncmain1static_LDADD = ifuncdep1.o
   1983 
   1984 check_PROGRAMS += ifuncmain1picstatic
   1985 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
   1986 	$(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
   1987 endif
   1988 endif
   1989 
   1990 check_PROGRAMS += ifuncmain1
   1991 ifuncmain1_SOURCES = ifuncmain1.c
   1992 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
   1993 ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   1994 ifuncmain1_LDADD = ifuncmod1.so
   1995 
   1996 check_PROGRAMS += ifuncmain1pic
   1997 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
   1998 	$(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
   1999 
   2000 check_PROGRAMS += ifuncmain1vis
   2001 ifuncmain1vis_SOURCES = ifuncmain1vis.c
   2002 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
   2003 ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   2004 ifuncmain1vis_LDADD = ifuncmod1.so
   2005 
   2006 check_PROGRAMS += ifuncmain1vispic
   2007 ifuncmain1vispic.o: ifuncmain1vis.c
   2008 	$(COMPILE) -c -fPIC -o $@ $<
   2009 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
   2010 	$(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
   2011 
   2012 check_PROGRAMS += ifuncmain1staticpic
   2013 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
   2014 	$(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
   2015 
   2016 check_PROGRAMS += ifuncmain1pie
   2017 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
   2018 	$(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
   2019 
   2020 check_PROGRAMS += ifuncmain1vispie
   2021 ifuncmain1vispie.o: ifuncmain1vis.c
   2022 	$(COMPILE) -c -fPIE -o $@ $<
   2023 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
   2024 	$(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
   2025 
   2026 check_PROGRAMS += ifuncmain1staticpie
   2027 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
   2028 	$(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
   2029 
   2030 ifuncmain2pic.o: ifuncmain2.c
   2031 	$(COMPILE) -c -fPIC -o $@ $<
   2032 
   2033 ifuncdep2pic.o: ifuncdep2.c
   2034 	$(COMPILE) -c -fPIC -o $@ $<
   2035 
   2036 if HAVE_STATIC
   2037 if IFUNC_STATIC
   2038 check_PROGRAMS += ifuncmain2static
   2039 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
   2040 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
   2041 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
   2042 ifuncmain2static_LDADD =
   2043 
   2044 check_PROGRAMS += ifuncmain2picstatic
   2045 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
   2046 	$(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
   2047 endif
   2048 endif
   2049 
   2050 check_PROGRAMS += ifuncmain2
   2051 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
   2052 ifuncmain2_DEPENDENCIES = gcctestdir/ld
   2053 ifuncmain2_LDFLAGS = -Bgcctestdir/
   2054 ifuncmain2_LDADD =
   2055 
   2056 check_PROGRAMS += ifuncmain2pic
   2057 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
   2058 	$(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
   2059 
   2060 ifuncmod3.o: ifuncmod3.c
   2061 	$(COMPILE) -c -fPIC -o $@ $<
   2062 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
   2063 	$(LINK) -Bgcctestdir/ -shared ifuncmod3.o
   2064 
   2065 check_PROGRAMS += ifuncmain3
   2066 ifuncmain3_SOURCES = ifuncmain3.c
   2067 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
   2068 ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
   2069 ifuncmain3_LDADD = -ldl
   2070 
   2071 ifuncmain4pic.o: ifuncmain4.c
   2072 	$(COMPILE) -c -fPIC -o $@ $<
   2073 
   2074 if HAVE_STATIC
   2075 if IFUNC_STATIC
   2076 check_PROGRAMS += ifuncmain4static
   2077 ifuncmain4static_SOURCES = ifuncmain4.c
   2078 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
   2079 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
   2080 ifuncmain4static_LDADD =
   2081 
   2082 check_PROGRAMS += ifuncmain4picstatic
   2083 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
   2084 	$(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
   2085 endif
   2086 endif
   2087 
   2088 check_PROGRAMS += ifuncmain4
   2089 ifuncmain4_SOURCES = ifuncmain4.c
   2090 ifuncmain4_DEPENDENCIES = gcctestdir/ld
   2091 ifuncmain4_LDFLAGS = -Bgcctestdir/
   2092 ifuncmain4_LDADD =
   2093 
   2094 ifuncmain5pic.o: ifuncmain5.c
   2095 	$(COMPILE) -c -fPIC -o $@ $<
   2096 
   2097 ifuncmain5pie.o: ifuncmain5.c
   2098 	$(COMPILE) -c -fPIE -o $@ $<
   2099 
   2100 ifuncmod5.o: ifuncmod5.c
   2101 	$(COMPILE) -c -fPIC -o $@ $<
   2102 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
   2103 	$(LINK) -Bgcctestdir/ -shared ifuncmod5.o
   2104 
   2105 ifuncdep5.o: ifuncmod5.c
   2106 	$(COMPILE) -c -o $@ $<
   2107 
   2108 if HAVE_STATIC
   2109 if IFUNC_STATIC
   2110 check_PROGRAMS += ifuncmain5static
   2111 ifuncmain5static_SOURCES = ifuncmain5.c
   2112 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
   2113 ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
   2114 ifuncmain5static_LDADD = ifuncdep5.o
   2115 
   2116 check_PROGRAMS += ifuncmain5picstatic
   2117 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
   2118 	$(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
   2119 endif
   2120 endif
   2121 
   2122 check_PROGRAMS += ifuncmain5
   2123 ifuncmain5_SOURCES = ifuncmain5.c
   2124 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
   2125 ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   2126 ifuncmain5_LDADD = ifuncmod5.so
   2127 
   2128 check_PROGRAMS += ifuncmain5pic
   2129 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
   2130 	$(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
   2131 
   2132 check_PROGRAMS += ifuncmain5staticpic
   2133 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
   2134 	$(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
   2135 
   2136 check_PROGRAMS += ifuncmain5pie
   2137 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
   2138 	$(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
   2139 
   2140 ifuncmain6pie.o: ifuncmain6pie.c
   2141 	$(COMPILE) -c -fPIE -o $@ $<
   2142 
   2143 ifuncmod6.o: ifuncmod6.c
   2144 	$(COMPILE) -c -fPIC -o $@ $<
   2145 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
   2146 	$(LINK) -Bgcctestdir/ -shared ifuncmod6.o
   2147 
   2148 check_PROGRAMS += ifuncmain6pie
   2149 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
   2150 	$(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
   2151 
   2152 ifuncmain7pic.o: ifuncmain7.c
   2153 	$(COMPILE) -c -fPIC -o $@ $<
   2154 
   2155 ifuncmain7pie.o: ifuncmain7.c
   2156 	$(COMPILE) -c -fPIE -o $@ $<
   2157 
   2158 if HAVE_STATIC
   2159 if IFUNC_STATIC
   2160 check_PROGRAMS += ifuncmain7static
   2161 ifuncmain7static_SOURCES = ifuncmain7.c
   2162 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
   2163 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
   2164 ifuncmain7static_LDADD =
   2165 
   2166 check_PROGRAMS += ifuncmain7picstatic
   2167 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
   2168 	$(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
   2169 endif
   2170 endif
   2171 
   2172 check_PROGRAMS += ifuncmain7
   2173 ifuncmain7_SOURCES = ifuncmain7.c
   2174 ifuncmain7_DEPENDENCIES = gcctestdir/ld
   2175 ifuncmain7_LDFLAGS = -Bgcctestdir/
   2176 ifuncmain7_LDADD =
   2177 
   2178 check_PROGRAMS += ifuncmain7pic
   2179 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
   2180 	$(LINK) -Bgcctestdir/ ifuncmain7pic.o
   2181 
   2182 check_PROGRAMS += ifuncmain7pie
   2183 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
   2184 	$(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
   2185 
   2186 check_PROGRAMS += ifuncvar
   2187 ifuncvar1_pic.o: ifuncvar1.c
   2188 	$(COMPILE) -c -fPIC -o $@ $<
   2189 ifuncvar2_pic.o: ifuncvar2.c
   2190 	$(COMPILE) -c -fPIC -o $@ $<
   2191 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
   2192 	$(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
   2193 ifuncvar_SOURCES = ifuncvar3.c
   2194 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
   2195 ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
   2196 ifuncvar_LDADD = ifuncvar.so
   2197 
   2198 endif IFUNC
   2199 
   2200 # Test that strong reference to a weak symbol in a DSO remains strong.
   2201 check_SCRIPTS += strong_ref_weak_def.sh
   2202 check_DATA += strong_ref_weak_def.stdout
   2203 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
   2204 	strong_ref_weak_def.stdout
   2205 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
   2206 	$(COMPILE) -o $@ -c -fPIC $<
   2207 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
   2208 	gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
   2209 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
   2210 	$(COMPILE) -o $@ -c -fPIC $<
   2211 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
   2212 	gcctestdir/ld
   2213 	gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
   2214 		strong_ref_weak_def_2.so
   2215 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
   2216 	$(TEST_READELF) -sWD $< > $@
   2217 
   2218 # Test that a strong weak reference remains strong if there is another
   2219 # weak reference in a DSO.
   2220 check_SCRIPTS += dyn_weak_ref.sh
   2221 check_DATA += dyn_weak_ref.stdout
   2222 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
   2223 	dyn_weak_ref.stdout
   2224 dyn_weak_ref_2.o: dyn_weak_ref_2.c
   2225 	$(COMPILE) -o $@ -c -fPIC $<
   2226 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
   2227 	gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
   2228 dyn_weak_ref_1.o: dyn_weak_ref_1.c
   2229 	$(COMPILE) -o $@ -c -fPIC $<
   2230 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
   2231 # so that the weak ref there goes to gold's symbol table first.
   2232 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
   2233 	gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
   2234 dyn_weak_ref.stdout: dyn_weak_ref_1.so
   2235 	$(TEST_READELF) -sWD $< > $@
   2236 
   2237 
   2238 # Test that --start-lib and --end-lib function correctly.
   2239 check_PROGRAMS += start_lib_test
   2240 MOSTLYCLEANFILES += libstart_lib_test.a
   2241 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
   2242 	gcctestdir/ld
   2243 	$(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
   2244 		-Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
   2245 libstart_lib_test.a: start_lib_test_1.o
   2246 	$(TEST_AR) rc $@ $^
   2247 
   2248 # Test that MEMORY region support works.
   2249 check_SCRIPTS += memory_test.sh
   2250 check_DATA += memory_test.stdout
   2251 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
   2252 memory_test.o: memory_test.s
   2253 	$(COMPILE) -o $@ -c $<
   2254 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
   2255 	$(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
   2256 memory_test.stdout: memory_test
   2257 	$(TEST_READELF) -lWS  $< > $@
   2258 
   2259 # Test INCLUDE directives in linker scripts.
   2260 # The binary isn't runnable, so we just check that we can build it without errors.
   2261 check_DATA += memory_test_2
   2262 MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
   2263 memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
   2264 	cp $< $@
   2265 memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
   2266 	cp $< $@
   2267 memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
   2268 	cp $< $@
   2269 memory_test_2: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
   2270 	$(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
   2271 
   2272 if HAVE_PUBNAMES
   2273 
   2274 # Test that --gdb-index functions correctly without gcc-generated pubnames.
   2275 check_SCRIPTS += gdb_index_test_1.sh
   2276 check_DATA += gdb_index_test_1.stdout
   2277 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
   2278 gdb_index_test.o: gdb_index_test.cc
   2279 	$(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
   2280 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
   2281 	$(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
   2282 gdb_index_test_1.stdout: gdb_index_test_1
   2283 	$(TEST_READELF) --debug-dump=gdb_index $< > $@
   2284 
   2285 if HAVE_ZLIB
   2286 
   2287 # Test that --gdb-index functions correctly with compressed debug sections.
   2288 check_SCRIPTS += gdb_index_test_2.sh
   2289 check_DATA += gdb_index_test_2.stdout
   2290 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
   2291 gdb_index_test_cdebug.o: gdb_index_test.cc
   2292 	$(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
   2293 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
   2294 	$(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
   2295 gdb_index_test_2.stdout: gdb_index_test_2
   2296 	$(TEST_READELF) --debug-dump=gdb_index $< > $@
   2297 
   2298 endif HAVE_ZLIB
   2299 
   2300 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
   2301 check_SCRIPTS += gdb_index_test_3.sh
   2302 check_DATA += gdb_index_test_3.stdout
   2303 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
   2304 gdb_index_test_3.o: gdb_index_test_3.c
   2305 	$(COMPILE) -O0 -g -c -o $@ $<
   2306 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
   2307 	$(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
   2308 gdb_index_test_3.stdout: gdb_index_test_3
   2309 	$(TEST_READELF) --debug-dump=gdb_index $< > $@
   2310 
   2311 # Test that --gdb-index functions correctly with gcc-generated pubnames.
   2312 check_SCRIPTS += gdb_index_test_4.sh
   2313 check_DATA += gdb_index_test_4.stdout
   2314 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
   2315 gdb_index_test_pub.o: gdb_index_test.cc
   2316 	$(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
   2317 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
   2318 	$(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
   2319 gdb_index_test_4.stdout: gdb_index_test_4
   2320 	$(TEST_READELF) --debug-dump=gdb_index $< > $@
   2321 
   2322 endif HAVE_PUBNAMES
   2323 
   2324 # Test that __ehdr_start is defined correctly.
   2325 check_PROGRAMS += ehdr_start_test_1
   2326 ehdr_start_test_1_SOURCES = ehdr_start_test.cc
   2327 ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
   2328 ehdr_start_test_1_CXXFLAGS =
   2329 ehdr_start_test_1_LDFLAGS = -Bgcctestdir/
   2330 ehdr_start_test_1_LDADD =
   2331 
   2332 # Test that __ehdr_start is defined correctly with a weak reference.
   2333 check_PROGRAMS += ehdr_start_test_2
   2334 ehdr_start_test_2_SOURCES = ehdr_start_test.cc
   2335 ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
   2336 ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
   2337 ehdr_start_test_2_LDFLAGS = -Bgcctestdir/
   2338 ehdr_start_test_2_LDADD =
   2339 
   2340 # Test that __ehdr_start is defined correctly when used with a linker script.
   2341 check_PROGRAMS += ehdr_start_test_3
   2342 ehdr_start_test_3_SOURCES = ehdr_start_test.cc
   2343 ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
   2344 ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
   2345 ehdr_start_test_3_LDFLAGS = -Bgcctestdir/ -Wl,-T,$(srcdir)/ehdr_start_test.t
   2346 ehdr_start_test_3_LDADD =
   2347 
   2348 # Test that __ehdr_start is left undefined when the text segment is not
   2349 # appropriately aligned.
   2350 check_SCRIPTS += ehdr_start_test_4.sh
   2351 check_DATA += ehdr_start_test_4.syms
   2352 MOSTLYCLEANFILES += ehdr_start_test_4
   2353 ehdr_start_test_4.syms: ehdr_start_test_4
   2354 	$(TEST_NM) ehdr_start_test_4 > $@
   2355 ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
   2356 	$(CXXLINK) -Bgcctestdir/ -Wl,-Ttext=0x100100 $<
   2357 ehdr_start_test_4.o: ehdr_start_test.cc
   2358 	$(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
   2359 
   2360 # Test that __ehdr_start is not overridden when supplied by the user.
   2361 check_PROGRAMS += ehdr_start_test_5
   2362 ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
   2363 ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
   2364 ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
   2365 ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
   2366 ehdr_start_test_5_LDADD =
   2367 
   2368 # Test that the --defsym option copies the symbol type and visibility.
   2369 check_SCRIPTS += defsym_test.sh
   2370 check_DATA += defsym_test.syms
   2371 MOSTLYCLEANFILES += defsym_test defsym_test.syms
   2372 defsym_test.syms: defsym_test
   2373 	$(TEST_READELF) -sW $< > $@
   2374 defsym_test: defsym_test.o gcctestdir/ld
   2375 	$(LINK) -Bgcctestdir/ -Wl,--defsym=bar=foo defsym_test.o
   2376 defsym_test.o: defsym_test.c
   2377 	$(COMPILE) -c -o $@ $<
   2378 
   2379 # End-to-end incremental linking tests.
   2380 # Incremental linking is currently supported only on the x86_64 target.
   2381 
   2382 if DEFAULT_TARGET_X86_64
   2383 
   2384 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
   2385 	$(CXXCOMPILE) -O0 -g0 -c -o $@ $<
   2386 two_file_test_1_ndebug.o: two_file_test_1.cc
   2387 	$(CXXCOMPILE) -O0 -g0 -c -o $@ $<
   2388 two_file_test_1b_ndebug.o: two_file_test_1b.cc
   2389 	$(CXXCOMPILE) -O0 -g0 -c -o $@ $<
   2390 two_file_test_2_ndebug.o: two_file_test_2.cc
   2391 	$(CXXCOMPILE) -O0 -g0 -c -o $@ $<
   2392 two_file_test_main_ndebug.o: two_file_test_main.cc
   2393 	$(CXXCOMPILE) -O0 -g0 -c -o $@ $<
   2394 
   2395 check_PROGRAMS += incremental_test_2
   2396 MOSTLYCLEANFILES += two_file_test_tmp_2.o
   2397 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
   2398 		    two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
   2399 	cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
   2400 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -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
   2401 	@sleep 1
   2402 	cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
   2403 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -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
   2404 
   2405 check_PROGRAMS += incremental_test_3
   2406 MOSTLYCLEANFILES += two_file_test_tmp_3.o
   2407 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
   2408 		    two_file_test_2.o two_file_test_main.o gcctestdir/ld
   2409 	cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
   2410 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
   2411 	@sleep 1
   2412 	cp -f two_file_test_1b.o two_file_test_tmp_3.o
   2413 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
   2414 
   2415 check_PROGRAMS += incremental_test_4
   2416 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
   2417 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
   2418 		    two_file_test_2.o two_file_test_main.o gcctestdir/ld
   2419 	cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
   2420 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
   2421 	mv -f incremental_test_4 incremental_test_4.base
   2422 	@sleep 1
   2423 	cp -f two_file_test_2.o two_file_test_tmp_4.o
   2424 	$(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
   2425 
   2426 check_PROGRAMS += incremental_test_5
   2427 MOSTLYCLEANFILES += two_file_test_5.a
   2428 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
   2429 		    two_file_test_2.o two_file_test_main.o gcctestdir/ld
   2430 	cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
   2431 	$(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
   2432 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
   2433 	@sleep 1
   2434 	cp -f two_file_test_1b.o two_file_test_tmp_5.o
   2435 	$(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
   2436 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
   2437 
   2438 # Test the --incremental-unchanged flag with an archive library.
   2439 # The second link should not update the library.
   2440 check_PROGRAMS += incremental_test_6
   2441 MOSTLYCLEANFILES += two_file_test_6.a
   2442 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
   2443 		    two_file_test_2.o two_file_test_main.o gcctestdir/ld
   2444 	cp -f two_file_test_1b.o two_file_test_tmp_6.o
   2445 	$(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
   2446 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
   2447 	@sleep 1
   2448 	cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
   2449 	$(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
   2450 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
   2451 
   2452 check_PROGRAMS += incremental_copy_test
   2453 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
   2454 	cp -f copy_test_v1.o copy_test_tmp.o
   2455 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
   2456 	@sleep 1
   2457 	cp -f copy_test.o copy_test_tmp.o
   2458 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
   2459 
   2460 check_PROGRAMS += incremental_common_test_1
   2461 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
   2462 	cp -f common_test_1_v1.o common_test_1_tmp.o
   2463 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
   2464 	@sleep 1
   2465 	cp -f common_test_1_v2.o common_test_1_tmp.o
   2466 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
   2467 
   2468 check_PROGRAMS += incremental_comdat_test_1
   2469 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
   2470 	cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
   2471 	$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
   2472 	@sleep 1
   2473 	cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
   2474 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
   2475 	@sleep 1
   2476 	cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
   2477 	$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
   2478 
   2479 endif DEFAULT_TARGET_X86_64
   2480 
   2481 if DEFAULT_TARGET_X86_64
   2482 check_PROGRAMS += exception_x86_64_bnd_test
   2483 exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
   2484 exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
   2485 exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
   2486 exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
   2487 exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
   2488 	$(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
   2489 exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
   2490 	$(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
   2491 endif DEFAULT_TARGET_X86_64
   2492 
   2493 endif GCC
   2494 endif TEST_AS_NATIVE_LINKER
   2495 
   2496 # These tests work with native and cross linkers.
   2497 
   2498 if NATIVE_OR_CROSS_LINKER
   2499 
   2500 # Test script section order.
   2501 check_SCRIPTS += script_test_10.sh
   2502 check_DATA += script_test_10.stdout
   2503 MOSTLYCLEANFILES += script_test_10
   2504 script_test_10.o: script_test_10.s
   2505 	$(TEST_AS) -o $@ $<
   2506 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
   2507 	gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
   2508 script_test_10.stdout: script_test_10
   2509 	$(TEST_READELF) -SW script_test_10 > $@
   2510 
   2511 # These tests work with cross linkers only.
   2512 
   2513 if DEFAULT_TARGET_I386
   2514 
   2515 check_SCRIPTS += split_i386.sh
   2516 check_DATA += split_i386_1.stdout split_i386_2.stdout \
   2517 	split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
   2518 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
   2519 split_i386_1.o: split_i386_1.s
   2520 	$(TEST_AS) -o $@ $<
   2521 split_i386_2.o: split_i386_2.s
   2522 	$(TEST_AS) -o $@ $<
   2523 split_i386_3.o: split_i386_3.s
   2524 	$(TEST_AS) -o $@ $<
   2525 split_i386_4.o: split_i386_4.s
   2526 	$(TEST_AS) -o $@ $<
   2527 split_i386_n.o: split_i386_n.s
   2528 	$(TEST_AS) -o $@ $<
   2529 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
   2530 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
   2531 split_i386_1.stdout: split_i386_1
   2532 	$(TEST_OBJDUMP) -d $< > $@
   2533 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
   2534 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
   2535 split_i386_2.stdout: split_i386_2
   2536 	$(TEST_OBJDUMP) -d $< > $@
   2537 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
   2538 	../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
   2539 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
   2540 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
   2541 split_i386_4.stdout: split_i386_4
   2542 	$(TEST_OBJDUMP) -d $< > $@
   2543 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
   2544 	../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
   2545 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
   2546 	split_i386_4 split_i386_r
   2547 
   2548 endif DEFAULT_TARGET_I386
   2549 
   2550 if DEFAULT_TARGET_X86_64
   2551 
   2552 check_SCRIPTS += split_x86_64.sh
   2553 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
   2554 	split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
   2555 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
   2556 split_x86_64_1.o: split_x86_64_1.s
   2557 	$(TEST_AS) -o $@ $<
   2558 split_x86_64_2.o: split_x86_64_2.s
   2559 	$(TEST_AS) -o $@ $<
   2560 split_x86_64_3.o: split_x86_64_3.s
   2561 	$(TEST_AS) -o $@ $<
   2562 split_x86_64_4.o: split_x86_64_4.s
   2563 	$(TEST_AS) -o $@ $<
   2564 split_x86_64_n.o: split_x86_64_n.s
   2565 	$(TEST_AS) -o $@ $<
   2566 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
   2567 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
   2568 split_x86_64_1.stdout: split_x86_64_1
   2569 	$(TEST_OBJDUMP) -d $< > $@
   2570 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
   2571 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
   2572 split_x86_64_2.stdout: split_x86_64_2
   2573 	$(TEST_OBJDUMP) -d $< > $@
   2574 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
   2575 	../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
   2576 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
   2577 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
   2578 split_x86_64_4.stdout: split_x86_64_4
   2579 	$(TEST_OBJDUMP) -d $< > $@
   2580 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
   2581 	../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
   2582 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
   2583 	split_x86_64_4 split_x86_64_r
   2584 
   2585 endif DEFAULT_TARGET_X86_64
   2586 
   2587 if DEFAULT_TARGET_X32
   2588 
   2589 check_SCRIPTS += split_x32.sh
   2590 check_DATA += split_x32_1.stdout split_x32_2.stdout \
   2591 	split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
   2592 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
   2593 split_x32_1.o: split_x32_1.s
   2594 	$(TEST_AS) -o $@ $<
   2595 split_x32_2.o: split_x32_2.s
   2596 	$(TEST_AS) -o $@ $<
   2597 split_x32_3.o: split_x32_3.s
   2598 	$(TEST_AS) -o $@ $<
   2599 split_x32_4.o: split_x32_4.s
   2600 	$(TEST_AS) -o $@ $<
   2601 split_x32_n.o: split_x32_n.s
   2602 	$(TEST_AS) -o $@ $<
   2603 split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
   2604 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
   2605 split_x32_1.stdout: split_x32_1
   2606 	$(TEST_OBJDUMP) -d $< > $@
   2607 split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
   2608 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
   2609 split_x32_2.stdout: split_x32_2
   2610 	$(TEST_OBJDUMP) -d $< > $@
   2611 split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
   2612 	../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
   2613 split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
   2614 	../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
   2615 split_x32_4.stdout: split_x32_4
   2616 	$(TEST_OBJDUMP) -d $< > $@
   2617 split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
   2618 	../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
   2619 MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
   2620 	split_x32_4 split_x32_r
   2621 
   2622 endif DEFAULT_TARGET_X32
   2623 
   2624 if DEFAULT_TARGET_ARM
   2625 
   2626 check_SCRIPTS += arm_abs_global.sh
   2627 check_DATA += arm_abs_global.stdout
   2628 arm_abs_lib.o: arm_abs_lib.s
   2629 	$(TEST_AS) -march=armv7-a -o $@ $<
   2630 libarm_abs.so: arm_abs_lib.o ../ld-new
   2631 	../ld-new -shared -o $@ arm_abs_lib.o
   2632 arm_abs_global.o: arm_abs_global.s
   2633 	$(TEST_AS) -march=armv7-a -o $@ $<
   2634 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
   2635 	../ld-new -o $@ arm_abs_global.o -L. -larm_abs
   2636 arm_abs_global.stdout: arm_abs_global
   2637 	$(TEST_READELF) -r $< > $@
   2638 
   2639 MOSTLYCLEANFILES += arm_abs_global
   2640 
   2641 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
   2642 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
   2643 	thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
   2644 	thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
   2645 	thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
   2646 	thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
   2647 	thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
   2648 	arm_thm_jump8.stdout
   2649 
   2650 arm_bl_in_range.stdout: arm_bl_in_range
   2651 	$(TEST_OBJDUMP) -D $< > $@
   2652 
   2653 arm_bl_in_range: arm_bl_in_range.o ../ld-new
   2654 	../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
   2655 
   2656 arm_bl_in_range.o: arm_bl_in_range.s
   2657 	$(TEST_AS) -o $@ $<
   2658 
   2659 arm_bl_out_of_range.stdout: arm_bl_out_of_range
   2660 	$(TEST_OBJDUMP) -S $< > $@
   2661 
   2662 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
   2663 	../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
   2664 
   2665 arm_bl_out_of_range.o: arm_bl_out_of_range.s
   2666 	$(TEST_AS) -o $@ $<
   2667 
   2668 thumb_bl_in_range.stdout: thumb_bl_in_range
   2669 	$(TEST_OBJDUMP) -D $< > $@
   2670 
   2671 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
   2672 	../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
   2673 
   2674 thumb_bl_in_range.o: thumb_bl_in_range.s
   2675 	$(TEST_AS) -o $@ -march=armv5te $<
   2676 
   2677 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
   2678 	$(TEST_OBJDUMP) -D $< > $@
   2679 
   2680 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
   2681 	../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
   2682 
   2683 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
   2684 	$(TEST_AS) -o $@ -march=armv5te $<
   2685 
   2686 thumb2_bl_in_range.stdout: thumb2_bl_in_range
   2687 	$(TEST_OBJDUMP) -D $< > $@
   2688 
   2689 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
   2690 	../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
   2691 
   2692 thumb2_bl_in_range.o: thumb_bl_in_range.s
   2693 	$(TEST_AS) -o $@ -march=armv7-a $<
   2694 
   2695 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
   2696 	$(TEST_OBJDUMP) -D $< > $@
   2697 
   2698 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
   2699 	../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
   2700 
   2701 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
   2702 	$(TEST_AS) -o $@ -march=armv7-a $<
   2703 
   2704 thumb_blx_in_range.stdout: thumb_blx_in_range
   2705 	$(TEST_OBJDUMP) -D $< > $@
   2706 
   2707 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
   2708 	../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
   2709 
   2710 thumb_blx_in_range.o: thumb_blx_in_range.s
   2711 	$(TEST_AS) -o $@ -march=armv5te $<
   2712 
   2713 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
   2714 	$(TEST_OBJDUMP) -D $< > $@
   2715 
   2716 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
   2717 	../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
   2718 
   2719 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
   2720 	$(TEST_AS) -o $@ -march=armv5te $<
   2721 
   2722 thumb2_blx_in_range.stdout: thumb2_blx_in_range
   2723 	$(TEST_OBJDUMP) -D $< > $@
   2724 
   2725 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
   2726 	../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
   2727 
   2728 thumb2_blx_in_range.o: thumb_blx_in_range.s
   2729 	$(TEST_AS) -o $@ -march=armv7-a $<
   2730 
   2731 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
   2732 	$(TEST_OBJDUMP) -D $< > $@
   2733 
   2734 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
   2735 	../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
   2736 
   2737 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
   2738 	$(TEST_AS) -o $@ -march=armv7-a $<
   2739 
   2740 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
   2741 	$(TEST_OBJDUMP) -D $< > $@
   2742 
   2743 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
   2744 	../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
   2745 
   2746 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
   2747 	$(TEST_AS) -o $@ -march=armv5te $<
   2748 
   2749 arm_thm_jump11.stdout: arm_thm_jump11
   2750 	$(TEST_OBJDUMP) -D $< > $@
   2751 
   2752 arm_thm_jump11: arm_thm_jump11.o ../ld-new
   2753 	../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
   2754 
   2755 arm_thm_jump11.o: arm_thm_jump11.s
   2756 	$(TEST_AS) -o $@ $<
   2757 
   2758 arm_thm_jump8.stdout: arm_thm_jump8
   2759 	$(TEST_OBJDUMP) -D $< > $@
   2760 
   2761 arm_thm_jump8: arm_thm_jump8.o ../ld-new
   2762 	../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
   2763 
   2764 arm_thm_jump8.o: arm_thm_jump8.s
   2765 	$(TEST_AS) -o $@ $<
   2766 
   2767 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
   2768 	thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
   2769 	thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
   2770 	thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
   2771 	arm_thm_jump8
   2772 
   2773 check_SCRIPTS += arm_fix_v4bx.sh
   2774 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
   2775 	arm_no_fix_v4bx.stdout
   2776 
   2777 arm_fix_v4bx.stdout: arm_fix_v4bx
   2778 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2779 
   2780 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
   2781 	../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
   2782 
   2783 arm_fix_v4bx.o: arm_fix_v4bx.s
   2784 	$(TEST_AS) -o $@ $<
   2785 
   2786 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
   2787 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2788 
   2789 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
   2790 	../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
   2791 
   2792 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
   2793 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2794 
   2795 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
   2796 	../ld-new --no-fix-arm1176 -o $@ $<
   2797 
   2798 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
   2799 
   2800 check_SCRIPTS += arm_attr_merge.sh
   2801 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
   2802 	arm_attr_merge_7.stdout
   2803 
   2804 arm_attr_merge_6.stdout: arm_attr_merge_6
   2805 	$(TEST_READELF) -A $< > $@
   2806 
   2807 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
   2808 	../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
   2809 
   2810 arm_attr_merge_6a.o: arm_attr_merge_6a.s
   2811 	$(TEST_AS) -o $@ $<
   2812 
   2813 arm_attr_merge_6b.o: arm_attr_merge_6b.s
   2814 	$(TEST_AS) -o $@ $<
   2815 
   2816 arm_attr_merge_6r.stdout: arm_attr_merge_6r
   2817 	$(TEST_READELF) -A $< > $@
   2818 
   2819 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
   2820 	../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
   2821 
   2822 arm_attr_merge_7.stdout: arm_attr_merge_7
   2823 	$(TEST_READELF) -A $< > $@
   2824 
   2825 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
   2826 	../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
   2827 
   2828 arm_attr_merge_7a.o: arm_attr_merge_7a.s
   2829 	$(TEST_AS) -o $@ $<
   2830 
   2831 arm_attr_merge_7b.o: arm_attr_merge_7b.s
   2832 	$(TEST_AS) -o $@ $<
   2833 
   2834 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
   2835 
   2836 # ARM1176 workaround test.
   2837 check_SCRIPTS += arm_fix_1176.sh
   2838 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
   2839 	arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
   2840 	arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
   2841 
   2842 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
   2843 	$(TEST_OBJDUMP) -D -j.foo $< > $@
   2844 
   2845 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
   2846 	../ld-new --section-start=.foo=0x2001014 -o $@ $<
   2847 
   2848 arm_fix_1176_default_v6z.o: arm_fix_1176.s
   2849 	$(TEST_AS) -march=armv6z -o $@ $<
   2850 
   2851 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
   2852 	$(TEST_OBJDUMP) -D -j.foo $< > $@
   2853 
   2854 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
   2855 	../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
   2856 
   2857 arm_fix_1176_on_v6z.o: arm_fix_1176.s
   2858 	$(TEST_AS) -march=armv6z -o $@ $<
   2859 
   2860 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
   2861 	$(TEST_OBJDUMP) -D -j.foo $< > $@
   2862 
   2863 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
   2864 	../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
   2865 
   2866 arm_fix_1176_off_v6z.o: arm_fix_1176.s
   2867 	$(TEST_AS) -march=armv6z -o $@ $<
   2868 
   2869 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
   2870 	$(TEST_OBJDUMP) -D -j.foo $< > $@
   2871 
   2872 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
   2873 	../ld-new --section-start=.foo=0x2001014 -o $@ $<
   2874 
   2875 arm_fix_1176_default_v5te.o: arm_fix_1176.s
   2876 	$(TEST_AS) -march=armv5te -o $@ $<
   2877 
   2878 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
   2879 	$(TEST_OBJDUMP) -D -j.foo $< > $@
   2880 
   2881 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
   2882 	../ld-new --section-start=.foo=0x2001014 -o $@ $<
   2883 
   2884 arm_fix_1176_default_v7a.o: arm_fix_1176.s
   2885 	$(TEST_AS) -march=armv7-a -o $@ $<
   2886 
   2887 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
   2888 	$(TEST_OBJDUMP) -D -j.foo $< > $@
   2889 
   2890 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
   2891 	../ld-new --section-start=.foo=0x2001014 -o $@ $<
   2892 
   2893 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
   2894 	$(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
   2895 
   2896 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
   2897 	arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
   2898 
   2899 # Cortex-A8 workaround test.
   2900 
   2901 check_SCRIPTS += arm_cortex_a8.sh
   2902 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
   2903 	arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
   2904 	arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
   2905 
   2906 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
   2907 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2908 
   2909 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
   2910 	../ld-new -o $@ $<
   2911 
   2912 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
   2913 	$(TEST_AS) -o $@ $<
   2914 
   2915 arm_cortex_a8_b.stdout: arm_cortex_a8_b
   2916 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2917 
   2918 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
   2919 	../ld-new --fix-cortex-a8 -o $@ $<
   2920 
   2921 arm_cortex_a8_b.o: arm_cortex_a8_b.s
   2922 	$(TEST_AS) -o $@ $<
   2923 
   2924 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
   2925 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2926 
   2927 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
   2928 	../ld-new -o $@ $<
   2929 
   2930 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
   2931 	$(TEST_AS) -o $@ $<
   2932 
   2933 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
   2934 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2935 
   2936 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
   2937 	../ld-new -o $@ $<
   2938 
   2939 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
   2940 	$(TEST_AS) -o $@ $<
   2941 
   2942 arm_cortex_a8_local.stdout: arm_cortex_a8_local
   2943 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2944 
   2945 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
   2946 	../ld-new -o $@ $<
   2947 
   2948 arm_cortex_a8_local.o: arm_cortex_a8_local.s
   2949 	$(TEST_AS) -o $@ $<
   2950 
   2951 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
   2952 	$(TEST_OBJDUMP) -D -j.text $< > $@
   2953 
   2954 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
   2955 	../ld-new -o $@ $<
   2956 
   2957 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
   2958 	$(TEST_AS) -o $@ $<
   2959 
   2960 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
   2961 	arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
   2962 
   2963 check_SCRIPTS += arm_exidx_test.sh
   2964 check_DATA += arm_exidx_test.stdout
   2965 
   2966 arm_exidx_test.stdout: arm_exidx_test.so
   2967 	$(TEST_READELF) -Sr $< > $@
   2968 
   2969 arm_exidx_test.so: arm_exidx_test.o ../ld-new
   2970 	../ld-new -shared -o $@ $<
   2971 
   2972 arm_exidx_test.o: arm_exidx_test.s
   2973 	$(TEST_AS) -o $@ $<
   2974 
   2975 check_SCRIPTS += pr12826.sh
   2976 check_DATA += pr12826.stdout
   2977 
   2978 pr12826.stdout: pr12826.so
   2979 	$(TEST_READELF) -A $< > $@
   2980 
   2981 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
   2982 	../ld-new -shared -o $@ $<
   2983 
   2984 pr12826_1.o: pr12826_1.s
   2985 	$(TEST_AS) -o $@ $<
   2986 
   2987 pr12826_2.o: pr12826_2.s
   2988 	$(TEST_AS) -o $@ $<
   2989 
   2990 check_SCRIPTS += arm_unaligned_reloc.sh
   2991 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
   2992 
   2993 arm_unaligned_reloc.stdout: arm_unaligned_reloc
   2994 	$(TEST_OBJDUMP) -D $< > $@
   2995 
   2996 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
   2997 	$(TEST_OBJDUMP) -Dr $< > $@
   2998 
   2999 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
   3000 	../ld-new -o $@ $<
   3001 
   3002 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
   3003 	../ld-new -r -o $@ $<
   3004 
   3005 arm_unaligned_reloc.o: arm_unaligned_reloc.s
   3006 	$(TEST_AS) -o $@ $<
   3007 
   3008 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
   3009 
   3010 # Check ARM to ARM farcall veneers
   3011 
   3012 check_SCRIPTS += arm_farcall_arm_arm.sh
   3013 check_DATA += arm_farcall_arm_arm.stdout
   3014 
   3015 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
   3016 	$(TEST_OBJDUMP) -d $< > $@
   3017 
   3018 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
   3019 	../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
   3020 
   3021 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
   3022 	$(TEST_AS) -o $@ $<
   3023 
   3024 MOSTLYCLEANFILES += arm_farcall_arm_arm
   3025 
   3026 # Check ARM to Thumb farcall veneers
   3027 
   3028 check_SCRIPTS += arm_farcall_arm_thumb.sh
   3029 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
   3030 
   3031 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
   3032 	$(TEST_OBJDUMP) -D $< > $@
   3033 
   3034 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
   3035 	../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
   3036 
   3037 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
   3038 	$(TEST_AS) -o $@ $<
   3039 
   3040 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
   3041 	$(TEST_OBJDUMP) -D $< > $@
   3042 
   3043 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
   3044 	../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
   3045 
   3046 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
   3047 	$(TEST_AS) -march=armv5t -o $@ $<
   3048 
   3049 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
   3050 
   3051 # Check Thumb to Thumb farcall veneers
   3052 
   3053 check_SCRIPTS += arm_farcall_thumb_thumb.sh
   3054 check_DATA += arm_farcall_thumb_thumb.stdout \
   3055 	      arm_farcall_thumb_thumb_5t.stdout \
   3056 	      arm_farcall_thumb_thumb_7m.stdout \
   3057 	      arm_farcall_thumb_thumb_6m.stdout
   3058 
   3059 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
   3060 	$(TEST_OBJDUMP) -D $< > $@
   3061 
   3062 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
   3063 	../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
   3064 
   3065 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
   3066 	$(TEST_AS) -march=armv4t -o $@ $<
   3067 
   3068 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
   3069 	$(TEST_OBJDUMP) -D $< > $@
   3070 
   3071 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
   3072 	../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
   3073 
   3074 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
   3075 	$(TEST_AS) -march=armv5t -o $@ $<
   3076 
   3077 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
   3078 	$(TEST_OBJDUMP) -D $< > $@
   3079 
   3080 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
   3081 	../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
   3082 
   3083 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
   3084 	$(TEST_AS) -march=armv7-m -o $@ $<
   3085 
   3086 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
   3087 	$(TEST_OBJDUMP) -D $< > $@
   3088 
   3089 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
   3090 	../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
   3091 
   3092 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
   3093 	$(TEST_AS) -march=armv6-m -o $@ $<
   3094 
   3095 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
   3096 		    arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
   3097 
   3098 # Check Thumb to ARM farcall veneers
   3099 
   3100 check_SCRIPTS += arm_farcall_thumb_arm.sh
   3101 check_DATA += arm_farcall_thumb_arm.stdout \
   3102 	      arm_farcall_thumb_arm_5t.stdout
   3103 
   3104 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
   3105 	$(TEST_OBJDUMP) -D $< > $@
   3106 
   3107 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
   3108 	../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
   3109 
   3110 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
   3111 	$(TEST_AS) -o $@ $<
   3112 
   3113 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
   3114 	$(TEST_OBJDUMP) -D $< > $@
   3115 
   3116 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
   3117 	../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
   3118 
   3119 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
   3120 	$(TEST_AS) -march=armv5t -o $@ $<
   3121 
   3122 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
   3123 
   3124 endif DEFAULT_TARGET_ARM
   3125 
   3126 endif NATIVE_OR_CROSS_LINKER
   3127 
   3128 # Tests for the dwp tool.
   3129 # We don't want to rely yet on GCC support for -gsplit-dwarf,
   3130 # so we use (for now) test cases in x86 assembly language,
   3131 # compiled from the dwp_test_*.cc sources.
   3132 
   3133 if DEFAULT_TARGET_X86_64
   3134 
   3135 dwp_test_main.o: dwp_test_main.s
   3136 	$(TEST_AS) -o $@ $<
   3137 dwp_test_1.o: dwp_test_1.s
   3138 	$(TEST_AS) -o $@ $<
   3139 dwp_test_1b.o: dwp_test_1b.s
   3140 	$(TEST_AS) -o $@ $<
   3141 dwp_test_2.o: dwp_test_2.s
   3142 	$(TEST_AS) -o $@ $<
   3143 
   3144 dwp_test_main.dwo: dwp_test_main.o
   3145 	$(TEST_OBJCOPY) --extract-dwo $< $@
   3146 dwp_test_1.dwo: dwp_test_1.o
   3147 	$(TEST_OBJCOPY) --extract-dwo $< $@
   3148 dwp_test_1b.dwo: dwp_test_1b.o
   3149 	$(TEST_OBJCOPY) --extract-dwo $< $@
   3150 dwp_test_2.dwo: dwp_test_2.o
   3151 	$(TEST_OBJCOPY) --extract-dwo $< $@
   3152 
   3153 MOSTLYCLEANFILES += *.dwo *.dwp
   3154 check_SCRIPTS += dwp_test_1.sh
   3155 check_DATA += dwp_test_1.stdout
   3156 dwp_test_1.stdout: dwp_test_1.dwp
   3157 	$(TEST_READELF) -wi $< > $@
   3158 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
   3159 	../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
   3160 
   3161 check_SCRIPTS += dwp_test_2.sh
   3162 check_DATA += dwp_test_2.stdout
   3163 dwp_test_2.stdout: dwp_test_2.dwp
   3164 	$(TEST_READELF) -wi $< > $@
   3165 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
   3166 	../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
   3167 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
   3168 	../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
   3169 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
   3170 	../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
   3171 
   3172 endif DEFAULT_TARGET_X86_64
   3173