# Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
AUTOMAKE_OPTIONS = foreign -Wno-portability
+# This is where we get zlib from. zlib is in ../../zlib unless we were
+# configured with --with-system-zlib, in which case ../../zlib either
+# doesn't exist or not configured.
+ZLIB = -L../../zlib -lz
+
# The two_file_test tests -fmerge-constants, so we simply always turn
# it on. For compilers that do not support the command-line option,
# we assume they just always emit SHF_MERGE sections unconditionally.
DEPENDENCIES = \
libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
- $(THREADSLIB) $(LIBDL)
+ $(THREADSLIB) $(LIBDL) $(ZLIB)
# The unittests themselves
incremental_test_2.o: incremental_test_2.c
$(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
- $(LINK) -Bgcctestdir/ -Wl,--incremental-full incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
+ $(LINK) -Bgcctestdir/ -Wl,--incremental-full -Wl,-z,norelro incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
incremental_test.stdout: incremental_test ../incremental-dump
../incremental-dump incremental_test > $@
basic_test: basic_test.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ basic_test.o
+check_PROGRAMS += eh_test
+eh_test_a.o: eh_test_a.cc
+ $(CXXCOMPILE) -O0 -c -o $@ $<
+eh_test_b.o: eh_test_b.cc
+ $(CXXCOMPILE) -O0 -c -o $@ $<
+eh_test: eh_test_a.o eh_test_b.o gcctestdir/ld
+ $(CXXLINK_S) -Bgcctestdir/ eh_test_a.o eh_test_b.o
+
if HAVE_STATIC
check_PROGRAMS += basic_static_test
basic_static_test: basic_test.o gcctestdir/ld
two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
two_file_shared_2_pic_1_test_DEPENDENCIES = \
- gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
+ gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
check_PROGRAMS += pie_copyrelocs_test
pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
+pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
pie_copyrelocs_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -pie
pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -shared pie_copyrelocs_shared_test.o
+check_PROGRAMS += weak_unresolved_symbols_test
+weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
+weak_unresolved_symbols_test_CXXFLAGS = -fPIE
+weak_unresolved_symbols_test_LDFLAGS = -Bgcctestdir/ -pie -Wl,--weak-unresolved-symbols
+
check_SCRIPTS += two_file_shared.sh
check_DATA += two_file_shared.dbg
MOSTLYCLEANFILES += two_file_shared.dbg
weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
weak_undef_test_2_LDFLAGS = -Bgcctestdir/ -u weak_undef_2
weak_undef_test_2_LDADD = -L . -lweak_undef_2
+MOSTLYCLEANFILES += libweak_undef_2.a
libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
$(TEST_AR) rc $@ $^
weak_undef_file3.o: weak_undef_file3.cc
tls_test_c_pie.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
+check_SCRIPTS += tls_pie_test.sh
+check_DATA += tls_pie_test.stdout
+tls_pie_test.stdout: tls_pie_test
+ $(TEST_READELF) -rW $< > $@ 2>/dev/null
+
tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
tls_test_c_pic.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
endif TLS
+if DEFAULT_TARGET_X86_64
+
+check_SCRIPTS += x86_64_mov_to_lea.sh
+check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
+ x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
+ x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
+ x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
+ x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
+ x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
+ x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
+MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
+ x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
+ x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
+ x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
+ x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
+
+x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
+ $(TEST_AS) --64 -o $@ $<
+x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
+ $(TEST_AS) --x32 -o $@ $<
+x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
+ $(TEST_AS) --x32 -o $@ $<
+x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
+ $(TEST_AS) --64 -o $@ $<
+x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
+ $(TEST_AS) --x32 -o $@ $<
+x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
+ $(TEST_AS) --64 -o $@ $<
+x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
+ $(TEST_AS) --x32 -o $@ $<
+x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
+ $(TEST_AS) --64 -o $@ $<
+x86_64_mov_to_lea1: x86_64_mov_to_lea1.o
+ ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
+x86_64_mov_to_lea2: x86_64_mov_to_lea1.o
+ ../ld-new -pie -melf_x86_64 -o $@ $<
+x86_64_mov_to_lea3: x86_64_mov_to_lea1.o
+ ../ld-new -melf_x86_64 -o $@ $<
+x86_64_mov_to_lea4: x86_64_mov_to_lea2.o
+ ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
+x86_64_mov_to_lea5: x86_64_mov_to_lea2.o
+ ../ld-new -pie -melf32_x86_64 -o $@ $<
+x86_64_mov_to_lea6: x86_64_mov_to_lea2.o
+ ../ld-new -melf32_x86_64 -o $@ $<
+x86_64_mov_to_lea7: x86_64_mov_to_lea3.o
+ ../ld-new -melf32_x86_64 -pie -o $@ $<
+x86_64_mov_to_lea8: x86_64_mov_to_lea4.o
+ ../ld-new -melf_x86_64 -pie -o $@ $<
+x86_64_mov_to_lea9: x86_64_mov_to_lea5.o
+ ../ld-new -melf32_x86_64 -o $@ $<
+x86_64_mov_to_lea10: x86_64_mov_to_lea6.o
+ ../ld-new -melf_x86_64 -o $@ $<
+x86_64_mov_to_lea11: x86_64_mov_to_lea1.o
+ ../ld-new -melf32_x86_64 -shared -o $@ $<
+x86_64_mov_to_lea12: x86_64_mov_to_lea2.o
+ ../ld-new -melf_x86_64 -shared -o $@ $<
+x86_64_mov_to_lea13: x86_64_mov_to_lea7.o
+ ../ld-new -melf32_x86_64 -shared -o $@ $<
+x86_64_mov_to_lea14: x86_64_mov_to_lea8.o
+ ../ld-new -melf_x86_64 -shared -o $@ $<
+x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
+ $(TEST_OBJDUMP) -dw $< > $@
+x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
+ $(TEST_OBJDUMP) -dw $< > $@
+
+endif DEFAULT_TARGET_X86_64
+
+if DEFAULT_TARGET_I386
+
+check_SCRIPTS += i386_mov_to_lea.sh
+check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
+ i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
+ i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
+ i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
+MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
+ i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
+ i386_mov_to_lea7 i386_mov_to_lea8
+
+i386_mov_to_lea1.o: i386_mov_to_lea1.s
+ $(TEST_AS) --32 -o $@ $<
+i386_mov_to_lea2.o: i386_mov_to_lea2.s
+ $(TEST_AS) --32 -o $@ $<
+i386_mov_to_lea3.o: i386_mov_to_lea3.s
+ $(TEST_AS) --32 -o $@ $<
+i386_mov_to_lea4.o: i386_mov_to_lea4.s
+ $(TEST_AS) --32 -o $@ $<
+i386_mov_to_lea5.o: i386_mov_to_lea5.s
+ $(TEST_AS) --32 -o $@ $<
+i386_mov_to_lea1: i386_mov_to_lea1.o
+ ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
+i386_mov_to_lea2: i386_mov_to_lea1.o
+ ../ld-new -pie -melf_i386 -o $@ $<
+i386_mov_to_lea3: i386_mov_to_lea1.o
+ ../ld-new -melf_i386 -o $@ $<
+i386_mov_to_lea4: i386_mov_to_lea1.o
+ ../ld-new -melf_i386 -shared -o $@ $<
+i386_mov_to_lea5: i386_mov_to_lea2.o
+ ../ld-new -melf_i386 -shared -o $@ $<
+i386_mov_to_lea6: i386_mov_to_lea3.o
+ ../ld-new -melf_i386 -shared -o $@ $<
+i386_mov_to_lea7: i386_mov_to_lea4.o
+ ../ld-new -melf_i386 -shared -o $@ $<
+i386_mov_to_lea8: i386_mov_to_lea5.o
+ ../ld-new -melf_i386 -shared -o $@ $<
+i386_mov_to_lea1.stdout: i386_mov_to_lea1
+ $(TEST_OBJDUMP) -dw $< > $@
+i386_mov_to_lea2.stdout: i386_mov_to_lea2
+ $(TEST_OBJDUMP) -dw $< > $@
+i386_mov_to_lea3.stdout: i386_mov_to_lea3
+ $(TEST_OBJDUMP) -dw $< > $@
+i386_mov_to_lea4.stdout: i386_mov_to_lea4
+ $(TEST_OBJDUMP) -dw $< > $@
+i386_mov_to_lea5.stdout: i386_mov_to_lea5
+ $(TEST_OBJDUMP) -dw $< > $@
+i386_mov_to_lea6.stdout: i386_mov_to_lea6
+ $(TEST_OBJDUMP) -dw $< > $@
+i386_mov_to_lea7.stdout: i386_mov_to_lea7
+ $(TEST_OBJDUMP) -dw $< > $@
+i386_mov_to_lea8.stdout: i386_mov_to_lea8
+ $(TEST_OBJDUMP) -dw $< > $@
+
+endif DEFAULT_TARGET_I386
+
check_PROGRAMS += many_sections_test
many_sections_test_SOURCES = many_sections_test.cc
many_sections_test_DEPENDENCIES = gcctestdir/ld
exit 1; \
fi
-if HAVE_ZLIB
-
# Check that --detect-odr-violations works with compressed debug sections.
check_DATA += debug_msg_cdebug.err
MOSTLYCLEANFILES += debug_msg_cdebug.err
rm -f $@; \
exit 1; \
fi
-
-endif HAVE_ZLIB
+check_DATA += debug_msg_cdebug_gabi.err
+MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
+debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
+ $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
+odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
+ $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
+odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
+ $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
+debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
+ @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@"
+ @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug_gabi debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o 2>$@; \
+ then \
+ echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
+ rm -f $@; \
+ exit 1; \
+ fi
# See if we can also detect problems when we're linking .so's, not .o's.
check_DATA += debug_msg_so.err
chmod a+x $@
test -s $@
-if HAVE_ZLIB
+# Test --compress-debug-sections.
+check_PROGRAMS += flagstest_compress_debug_sections_none
+check_DATA += flagstest_compress_debug_sections_none.stdout
+flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=none
+ test -s $@
+
+# Dump DWARF debug sections.
+flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
-# Test --compress-debug-sections. FIXME: check we actually compress.
check_PROGRAMS += flagstest_compress_debug_sections
+check_DATA += flagstest_compress_debug_sections.stdout \
+ flagstest_compress_debug_sections.cmp \
+ flagstest_compress_debug_sections.check
flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
test -s $@
+# Test --compress-debug-sections with --build-id=tree.
+check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
+flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib \
+ -Wl,--build-id=tree \
+ -Wl,--build-id-chunk-size-for-treehash=4096 \
+ -Wl,--build-id-min-file-size-for-treehash=0
+ test -s $@
+
+# Dump compressed DWARF debug sections.
+flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
+
+# Check there are compressed DWARF .debug_* sections.
+flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
+
+# Compare DWARF debug info.
+flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
+ flagstest_compress_debug_sections_none.stdout
+ cmp flagstest_compress_debug_sections.stdout \
+
+check_PROGRAMS += flagstest_compress_debug_sections_gnu
+check_DATA += flagstest_compress_debug_sections_gnu.stdout \
+ flagstest_compress_debug_sections_gnu.cmp \
+ flagstest_compress_debug_sections_gnu.check
+flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
+ test -s $@
+
+# Dump compressed DWARF debug sections.
+flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
+
+# Check there are compressed DWARF .zdebug_* sections.
+flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
+
+# Compare DWARF debug info.
+flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
+ flagstest_compress_debug_sections_none.stdout
+ cmp flagstest_compress_debug_sections_gnu.stdout \
+
+check_PROGRAMS += flagstest_compress_debug_sections_gabi
+check_DATA += flagstest_compress_debug_sections_gabi.stdout \
+ flagstest_compress_debug_sections_gabi.cmp \
+ flagstest_compress_debug_sections_gabi.check
+flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
+ test -s $@
+
+# Dump compressed DWARF debug sections.
+flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
+
+# Check there are compressed DWARF .debug_* sections.
+flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
+
+# Compare DWARF debug info.
+flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
+ flagstest_compress_debug_sections_none.stdout
+ cmp flagstest_compress_debug_sections_gabi.stdout \
# The specialfile output has a tricky case when we also compress debug
# sections, because it requires output-file resizing.
chmod a+x $@
test -s $@
-endif HAVE_ZLIB
-
# Test -TText and -Tdata.
check_PROGRAMS += flagstest_o_ttext_1
flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
script_test_11.o: script_test_11.c
$(COMPILE) -c -g -o $@ $<
+# Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
+check_PROGRAMS += script_test_12
+script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
+ $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
+
+check_PROGRAMS += script_test_12i
+script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
+ $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
+script_test_12a.o: script_test_12a.c
+ $(COMPILE) -O0 -c -o $@ $<
+script_test_12b.o: script_test_12b.c
+ $(COMPILE) -O0 -c -o $@ $<
+
# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
# and --dynamic-list-cpp-typeinfo
$(CXXCOMPILE) -c -fpic -o $@ $<
dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
- $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
+ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
dynamic_list_lib2.o: dynamic_list_lib2.cc
$(CXXCOMPILE) -c -fpic -o $@ $<
check_SCRIPTS += plugin_test_1.sh
check_DATA += plugin_test_1.err
MOSTLYCLEANFILES += plugin_test_1.err
-plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
- $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_1.err
+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
+ $(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
plugin_test_1.err: plugin_test_1
@touch plugin_test_1.err
check_SCRIPTS += plugin_test_2.sh
check_DATA += plugin_test_2.err
MOSTLYCLEANFILES += plugin_test_2.err
-plugin_test_2: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
- $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so 2>plugin_test_2.err
+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
+ $(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
plugin_test_2.err: plugin_test_2
@touch plugin_test_2.err
check_SCRIPTS += plugin_test_3.sh
check_DATA += plugin_test_3.err
MOSTLYCLEANFILES += plugin_test_3.err
-plugin_test_3: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
- $(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_3.err
+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
+ $(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
plugin_test_3.err: plugin_test_3
@touch plugin_test_3.err
plugin_test_4.err: plugin_test_4
@touch plugin_test_4.err
-plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
+plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
$(TEST_AR) cr $@ $^
check_PROGRAMS += plugin_test_5
-plugin_test_5: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms gcctestdir/ld plugin_test.so
- $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms
+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
+ $(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
check_PROGRAMS += plugin_test_6
check_SCRIPTS += plugin_test_6.sh
check_DATA += plugin_test_6.err
MOSTLYCLEANFILES += plugin_test_6.err
-plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
- $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
+plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
+ $(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
plugin_test_6.err: plugin_test_6
@touch plugin_test_6.err
check_PROGRAMS += plugin_test_7
check_SCRIPTS += plugin_test_7.sh
-check_DATA += plugin_test_7.err plugin_test_7.syms
+check_DATA += plugin_test_7.err plugin_test_7.o.syms
MOSTLYCLEANFILES += plugin_test_7.err
-plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
- $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.syms plugin_test_7_2.o 2>plugin_test_7.err
-plugin_test_7.syms: plugin_test_7
+plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
+ $(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
+plugin_test_7.o.syms: plugin_test_7
$(TEST_READELF) -sW $< >$@ 2>/dev/null
plugin_test_7_1.o: plugin_test_7_1.c
$(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
plugin_test_7_1_orig.o: plugin_test_7_1.c
$(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
-plugin_test_7_1.syms: plugin_test_7_1_orig.o
+plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
plugin_test_7_2.o: plugin_test_7_2.c
$(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
# Test plugins with -r.
check_PROGRAMS += plugin_test_8
-plugin_test_8.o: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o ../ld-new plugin_test.so
- ../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o
+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
+ ../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
plugin_test_8: plugin_test_8.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
# produce an unresolved symbol error.
check_DATA += plugin_test_9.err
MOSTLYCLEANFILES += plugin_test_9.err
-plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
- @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms "2>$@"
- @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms 2>$@; then \
+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
+ @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>$@"
+ @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 \
echo 1>&2 "Link of plugin_test_9 should have failed"; \
rm -f $@; \
exit 1; \
fi
# Make a .syms file that claims to define the symbol _Z4t16av.
-two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
+two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
# Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
MOSTLYCLEANFILES += two_file_test_1c.o
two_file_test_1c.o: two_file_test_1.o
cp two_file_test_1.o $@
+check_PROGRAMS += plugin_test_10
+check_SCRIPTS += plugin_test_10.sh
+check_DATA += plugin_test_10.sections
+MOSTLYCLEANFILES += plugin_test_10.sections
+plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
+ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
+plugin_test_10.sections: plugin_test_10
+ $(TEST_READELF) -SW $< >$@ 2>/dev/null
+
+check_PROGRAMS += plugin_test_11
+check_SCRIPTS += plugin_test_11.sh
+check_DATA += plugin_test_11.err
+MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
+PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
+plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
+ $(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
+plugin_test_11.err: plugin_test_11
+ @touch plugin_test_11.err
+plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
+ rm -f $@
+ $(TEST_AR) crT $@ $^
+
plugin_test.so: plugin_test.o
$(LINK) -Bgcctestdir/ -shared plugin_test.o
plugin_test.o: plugin_test.c
$(COMPILE) -O0 -c -fpic -o $@ $<
-two_file_test_main.syms: two_file_test_main.o
+two_file_test_main.o.syms: two_file_test_main.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
-two_file_test_1.syms: two_file_test_1.o
+two_file_test_1.o.syms: two_file_test_1.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
-two_file_test_1b.syms: two_file_test_1b.o
+two_file_test_1b.o.syms: two_file_test_1b.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
-two_file_test_2.syms: two_file_test_2.o
+two_file_test_2.o.syms: two_file_test_2.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
-plugin_common_test_1.syms: plugin_common_test_1.o
+plugin_common_test_1.o.syms: plugin_common_test_1.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
-plugin_common_test_2.syms: plugin_common_test_2.o
+plugin_common_test_2.o.syms: plugin_common_test_2.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
-empty.syms:
+empty.o.syms:
@echo "" >$@
@echo "Symbol table" >>$@
check_SCRIPTS += plugin_test_tls.sh
check_DATA += plugin_test_tls.err
MOSTLYCLEANFILES += plugin_test_tls.err
-plugin_test_tls: two_file_test_tls.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2_tls.syms gcctestdir/ld plugin_test.so
- $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_tls.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2_tls.syms 2>plugin_test_tls.err
+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
+ $(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
plugin_test_tls.err: plugin_test_tls
@touch plugin_test_tls.err
-two_file_test_2_tls.syms: two_file_test_2_tls.o
+two_file_test_2_tls.o.syms: two_file_test_2_tls.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
endif TLS
MOSTLYCLEANFILES += unused.c
-unused.syms: unused.o
+unused.o.syms: unused.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
@echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
unused.o: unused.c
# referenced by a shared library.
check_SCRIPTS += hidden_test.sh
check_DATA += hidden_test.err
-MOSTLYCLEANFILES += hidden_test hidden_test.err
+MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
libhidden.so: hidden_test_1.c gcctestdir/ld
$(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
$(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
+hidden_test.syms: hidden_test
+ $(TEST_NM) -D hidden_test > $@
hidden_test.err: hidden_test
@touch hidden_test.err
memory_test.stdout: memory_test
$(TEST_READELF) -lWS $< > $@
+# Test INCLUDE directives in linker scripts.
+# The binary isn't runnable, so we just check that we can build it without errors.
+check_DATA += memory_test_2
+MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
+memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
+ cp $< $@
+memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
+ cp $< $@
+memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
+ cp $< $@
+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
+ $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
+
if HAVE_PUBNAMES
# Test that --gdb-index functions correctly without gcc-generated pubnames.
gdb_index_test_1.stdout: gdb_index_test_1
$(TEST_READELF) --debug-dump=gdb_index $< > $@
-if HAVE_ZLIB
-
# Test that --gdb-index functions correctly with compressed debug sections.
check_SCRIPTS += gdb_index_test_2.sh
check_DATA += gdb_index_test_2.stdout
$(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
gdb_index_test_2.stdout: gdb_index_test_2
$(TEST_READELF) --debug-dump=gdb_index $< > $@
-
-endif HAVE_ZLIB
+check_SCRIPTS += gdb_index_test_2_gabi.sh
+check_DATA += gdb_index_test_2_gabi.stdout
+MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
+gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
+ $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
+gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
+gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
+ $(TEST_READELF) --debug-dump=gdb_index $< > $@
# Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
check_SCRIPTS += gdb_index_test_3.sh
ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
ehdr_start_test_5_LDADD =
+# Test that the --defsym option copies the symbol type and visibility.
+check_SCRIPTS += defsym_test.sh
+check_DATA += defsym_test.syms
+MOSTLYCLEANFILES += defsym_test defsym_test.syms
+defsym_test.syms: defsym_test
+ $(TEST_READELF) -sW $< > $@
+defsym_test: defsym_test.o gcctestdir/ld
+ $(LINK) -Bgcctestdir/ -Wl,--defsym=bar=foo defsym_test.o
+defsym_test.o: defsym_test.c
+ $(COMPILE) -c -o $@ $<
+
# End-to-end incremental linking tests.
# Incremental linking is currently supported only on the x86_64 target.
incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
+ $(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
@sleep 1
cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
+ $(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
check_PROGRAMS += incremental_test_3
MOSTLYCLEANFILES += two_file_test_tmp_3.o
incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
two_file_test_2.o two_file_test_main.o gcctestdir/ld
cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
+ $(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
@sleep 1
cp -f two_file_test_1b.o two_file_test_tmp_3.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
+ $(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
check_PROGRAMS += incremental_test_4
MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
two_file_test_2.o two_file_test_main.o gcctestdir/ld
cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
+ $(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
mv -f incremental_test_4 incremental_test_4.base
@sleep 1
cp -f two_file_test_2.o two_file_test_tmp_4.o
- $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
+ $(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
check_PROGRAMS += incremental_test_5
MOSTLYCLEANFILES += two_file_test_5.a
two_file_test_2.o two_file_test_main.o gcctestdir/ld
cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
$(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
+ $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
@sleep 1
cp -f two_file_test_1b.o two_file_test_tmp_5.o
$(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
+ $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
# Test the --incremental-unchanged flag with an archive library.
# The second link should not update the library.
two_file_test_2.o two_file_test_main.o gcctestdir/ld
cp -f two_file_test_1b.o two_file_test_tmp_6.o
$(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
+ $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
@sleep 1
cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
$(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
+ $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
check_PROGRAMS += incremental_copy_test
incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
cp -f copy_test_v1.o copy_test_tmp.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
+ $(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
@sleep 1
cp -f copy_test.o copy_test_tmp.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
+ $(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
check_PROGRAMS += incremental_common_test_1
incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
cp -f common_test_1_v1.o common_test_1_tmp.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
+ $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
@sleep 1
cp -f common_test_1_v2.o common_test_1_tmp.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
+ $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
check_PROGRAMS += incremental_comdat_test_1
incremental_comdat_test_1: incr_comdat_test_1.o incr_comdat_test_2_v1.o incr_comdat_test_2_v2.o incr_comdat_test_2_v3.o gcctestdir/ld
cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
- $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
+ $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
@sleep 1
cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
+ $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
@sleep 1
cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
- $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
+ $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
endif DEFAULT_TARGET_X86_64
if DEFAULT_TARGET_X86_64
check_PROGRAMS += exception_x86_64_bnd_test
exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
-exception_x86_64_bnd_test_DEPENDENCIES = exception_x86_64_bnd_1.o \
- exception_x86_64_bnd_2.o
+exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
-exception_x86_64_bnd_test_LDADD = $(exception_x86_64_bnd_test_DEPENDENCIES)
+exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
$(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
endif DEFAULT_TARGET_X86_64
+if DEFAULT_TARGET_X32
+
+check_SCRIPTS += split_x32.sh
+check_DATA += split_x32_1.stdout split_x32_2.stdout \
+ split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
+SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
+split_x32_1.o: split_x32_1.s
+ $(TEST_AS) -o $@ $<
+split_x32_2.o: split_x32_2.s
+ $(TEST_AS) -o $@ $<
+split_x32_3.o: split_x32_3.s
+ $(TEST_AS) -o $@ $<
+split_x32_4.o: split_x32_4.s
+ $(TEST_AS) -o $@ $<
+split_x32_n.o: split_x32_n.s
+ $(TEST_AS) -o $@ $<
+split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
+ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
+split_x32_1.stdout: split_x32_1
+ $(TEST_OBJDUMP) -d $< > $@
+split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
+ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
+split_x32_2.stdout: split_x32_2
+ $(TEST_OBJDUMP) -d $< > $@
+split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
+ ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
+split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
+ ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
+split_x32_4.stdout: split_x32_4
+ $(TEST_OBJDUMP) -d $< > $@
+split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
+ ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
+MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
+ split_x32_4 split_x32_r
+
+endif DEFAULT_TARGET_X32
+
if DEFAULT_TARGET_ARM
check_SCRIPTS += arm_abs_global.sh