diff options
author | Cary Coutant <ccoutant@gmail.com> | 2018-06-22 09:27:39 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2018-06-22 09:52:00 -0700 |
commit | 6c04fd9b2fb4396c0189cb414ce598161ac8673e (patch) | |
tree | 8b3630b03edb8d663a592b472cae1292aad05e7c /gold/testsuite | |
parent | 8e7767e3f782c46451a548d708f5582669d7a6d7 (diff) | |
download | binutils-6c04fd9b2fb4396c0189cb414ce598161ac8673e.zip binutils-6c04fd9b2fb4396c0189cb414ce598161ac8673e.tar.gz binutils-6c04fd9b2fb4396c0189cb414ce598161ac8673e.tar.bz2 |
Add support for .note.gnu.property sections.
elfcpp/
PR gold/22914
* elfcpp.h (NT_GNU_PROPERTY_TYPE_0): New note type.
(GNU_PROPERTY_*): New Gnu property types.
* x86_64.h (GNU_PROPERTY_X86_FEATURE_1_IBT)
(GNU_PROPERTY_X86_FEATURE_1_SHSTK): New x86 feature bits.
gold/
PR gold/22914
* layout.cc (Layout::Layout): Initialize gnu_properties_.
(read_sized_value, write_sized_value): New functions.
(Layout::layout_gnu_property): New method.
(Layout::create_notes): Call create_gnu_properties_note.
(Layout::create_gnu_properties_note): New method.
* layout.h (Layout::layout_gnu_property): New method.
(Layout::create_gnu_properties_note): New method.
(Layout::Gnu_property, Layout::Gnu_properties): New types.
(Layout::gnu_properties_): New data member.
* object.cc (Sized_relobj_file::layout_gnu_property_section): New
method.
(Sized_relobj_file::do_layout): Handle .note.gnu.property sections.
* object.h (Sized_relobj_file::layout_gnu_property_section): New
method.
* target.h (Target::merge_gnu_property): New method.
(Target::do_merge_gnu_property): New virtual method.
* x86_64.cc (Target_x86_64::do_merge_gnu_property): New method.
* testsuite/Makefile.am (gnu_property_test): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/gnu_property_a.S: New source file.
* testsuite/gnu_property_b.S: New source file.
* testsuite/gnu_property_c.S: New source file.
* testsuite/gnu_property_main.c: New source file.
* testsuite/gnu_property_test.sh: New test script.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 17 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 93 | ||||
-rw-r--r-- | gold/testsuite/gnu_property_a.S | 41 | ||||
-rw-r--r-- | gold/testsuite/gnu_property_b.S | 38 | ||||
-rw-r--r-- | gold/testsuite/gnu_property_c.S | 44 | ||||
-rw-r--r-- | gold/testsuite/gnu_property_main.c | 5 | ||||
-rwxr-xr-x | gold/testsuite/gnu_property_test.sh | 64 |
7 files changed, 266 insertions, 36 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index ab3b258..f439011 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -3255,6 +3255,23 @@ exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $< endif DEFAULT_TARGET_X86_64 +if DEFAULT_TARGET_X86_64 +check_SCRIPTS += gnu_property_test.sh +check_DATA += gnu_property_test.stdout +gnu_property_test.stdout: gnu_property_test + $(TEST_READELF) -n $< >$@ +gnu_property_test: gcctestdir/ld gnu_property_main.o gnu_property_a.o gnu_property_b.o gnu_property_c.o + $(LINK) -Bgcctestdir/ -o $@ gnu_property_main.o gnu_property_a.o gnu_property_b.o gnu_property_c.o +gnu_property_main.o: gnu_property_main.c + $(COMPILE) -c -o $@ $< +gnu_property_a.o: gnu_property_a.S + $(COMPILE) -c -o $@ $< +gnu_property_b.o: gnu_property_b.S + $(COMPILE) -c -o $@ $< +gnu_property_c.o: gnu_property_c.S + $(COMPILE) -c -o $@ $< +endif DEFAULT_TARGET_X86_64 + check_PROGRAMS += pr22266 pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld $(LINK) -Bgcctestdir/ pr22266_main.o pr22266_ar.o diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 14e4ce5..ee44c95 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -891,28 +891,30 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_tmp_4.o \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_5.a \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_6.a -@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_84 = pr22266 +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_84 = gnu_property_test.sh +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_85 = gnu_property_test.stdout +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_86 = pr22266 # These tests work with native and cross linkers. # Test script section order. -@NATIVE_OR_CROSS_LINKER_TRUE@am__append_85 = script_test_10.sh -@NATIVE_OR_CROSS_LINKER_TRUE@am__append_86 = script_test_10.stdout -@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = script_test_10 +@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = script_test_10.sh +@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = script_test_10.stdout +@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = script_test_10 # These tests work with cross linkers only. -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = split_i386.sh -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = split_i386_1.stdout split_i386_2.stdout \ +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_i386.sh +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_i386_1.stdout split_i386_2.stdout \ @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_i386_1 split_i386_2 split_i386_3 \ +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_i386_1 split_i386_2 split_i386_3 \ @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_4 split_i386_r -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_x86_64.sh \ +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_x86_64.sh \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_plt_1.sh \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_1.sh \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_2.sh -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_x86_64_1.stdout \ +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x86_64_1.stdout \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_2.stdout \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_3.stdout \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4.stdout \ @@ -920,14 +922,14 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_plt_1.stdout \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_1.stdout \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_2.stdout -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \ +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4 split_x86_64_r -@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x32.sh -@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x32_1.stdout split_x32_2.stdout \ +@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = split_x32.sh +@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = split_x32_1.stdout split_x32_2.stdout \ @DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout -@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = split_x32_1 split_x32_2 split_x32_3 \ +@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = split_x32_1 split_x32_2 split_x32_3 \ @DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_4 split_x32_r @@ -948,7 +950,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ # Check Thumb to ARM farcall veneers # Check handling of --target1-abs, --target1-rel and --target2 options -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = arm_abs_global.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = arm_abs_global.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_in_range.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_out_of_range.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_v4bx.sh \ @@ -971,7 +973,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.sh # The test demonstrates why the constructor of a target object should not access options. -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = arm_abs_global.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = arm_abs_global.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range.stdout \ @@ -1024,7 +1026,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target_lazy_init -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = arm_abs_global \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = arm_abs_global \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range \ @@ -1075,20 +1077,20 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target_lazy_init -@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = aarch64_reloc_none.sh \ +@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = aarch64_reloc_none.sh \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs.sh \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430.sh \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc.sh -@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = aarch64_reloc_none.stdout \ +@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = aarch64_reloc_none.stdout \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs.stdout \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430.stdout \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc.stdout -@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = aarch64_reloc_none \ +@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = aarch64_reloc_none \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430 \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc -@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = split_s390.sh -@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \ +@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_105 = split_s390.sh +@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_106 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \ @@ -1100,7 +1102,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_n2_ns.stdout split_s390x_r.stdout -@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_105 = split_s390_z1 split_s390_z2 split_s390_z3 \ +@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_107 = split_s390_z1 split_s390_z2 split_s390_z3 \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \ @@ -1109,10 +1111,10 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \ @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r -@DEFAULT_TARGET_X86_64_TRUE@am__append_106 = *.dwo *.dwp -@DEFAULT_TARGET_X86_64_TRUE@am__append_107 = dwp_test_1.sh \ +@DEFAULT_TARGET_X86_64_TRUE@am__append_108 = *.dwo *.dwp +@DEFAULT_TARGET_X86_64_TRUE@am__append_109 = dwp_test_1.sh \ @DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.sh -@DEFAULT_TARGET_X86_64_TRUE@am__append_108 = dwp_test_1.stdout \ +@DEFAULT_TARGET_X86_64_TRUE@am__append_110 = dwp_test_1.stdout \ @DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.stdout subdir = testsuite ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -2809,9 +2811,9 @@ MOSTLYCLEANFILES = *.so *.syms *.stdout *.stderr $(am__append_4) \ $(am__append_34) $(am__append_37) $(am__append_41) \ $(am__append_47) $(am__append_51) $(am__append_52) \ $(am__append_58) $(am__append_78) $(am__append_81) \ - $(am__append_83) $(am__append_87) $(am__append_90) \ - $(am__append_93) $(am__append_96) $(am__append_99) \ - $(am__append_102) $(am__append_105) $(am__append_106) + $(am__append_83) $(am__append_89) $(am__append_92) \ + $(am__append_95) $(am__append_98) $(am__append_101) \ + $(am__append_104) $(am__append_107) $(am__append_108) # We will add to these later, for each individual test. Note # that we add each test under check_SCRIPTS or check_PROGRAMS; @@ -2820,18 +2822,18 @@ check_SCRIPTS = $(am__append_2) $(am__append_19) $(am__append_23) \ $(am__append_29) $(am__append_35) $(am__append_42) \ $(am__append_45) $(am__append_49) $(am__append_53) \ $(am__append_56) $(am__append_62) $(am__append_73) \ - $(am__append_76) $(am__append_79) $(am__append_85) \ - $(am__append_88) $(am__append_91) $(am__append_94) \ - $(am__append_97) $(am__append_100) $(am__append_103) \ - $(am__append_107) + $(am__append_76) $(am__append_79) $(am__append_84) \ + $(am__append_87) $(am__append_90) $(am__append_93) \ + $(am__append_96) $(am__append_99) $(am__append_102) \ + $(am__append_105) $(am__append_109) check_DATA = $(am__append_3) $(am__append_20) $(am__append_24) \ $(am__append_30) $(am__append_36) $(am__append_43) \ $(am__append_46) $(am__append_50) $(am__append_54) \ $(am__append_57) $(am__append_63) $(am__append_74) \ - $(am__append_77) $(am__append_80) $(am__append_86) \ - $(am__append_89) $(am__append_92) $(am__append_95) \ - $(am__append_98) $(am__append_101) $(am__append_104) \ - $(am__append_108) + $(am__append_77) $(am__append_80) $(am__append_85) \ + $(am__append_88) $(am__append_91) $(am__append_94) \ + $(am__append_97) $(am__append_100) $(am__append_103) \ + $(am__append_106) $(am__append_110) BUILT_SOURCES = $(am__append_40) TESTS = $(check_SCRIPTS) $(check_PROGRAMS) @@ -6148,6 +6150,13 @@ defsym_test.sh.log: defsym_test.sh --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +gnu_property_test.sh.log: gnu_property_test.sh + @p='gnu_property_test.sh'; \ + b='gnu_property_test.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) script_test_10.sh.log: script_test_10.sh @p='script_test_10.sh'; \ b='script_test_10.sh'; \ @@ -9454,6 +9463,18 @@ uninstall-am: @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $< @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_test.stdout: gnu_property_test +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -n $< >$@ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_test: gcctestdir/ld gnu_property_main.o gnu_property_a.o gnu_property_b.o gnu_property_c.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -o $@ gnu_property_main.o gnu_property_a.o gnu_property_b.o gnu_property_c.o +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_main.o: gnu_property_main.c +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_a.o: gnu_property_a.S +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_b.o: gnu_property_b.S +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -o $@ $< +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_c.o: gnu_property_c.S +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -o $@ $< @GCC_TRUE@@NATIVE_LINKER_TRUE@pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ pr22266_main.o pr22266_ar.o @GCC_TRUE@@NATIVE_LINKER_TRUE@pr22266_ar.o: pr22266_a.o gcctestdir/ld diff --git a/gold/testsuite/gnu_property_a.S b/gold/testsuite/gnu_property_a.S new file mode 100644 index 0000000..2fa073d --- /dev/null +++ b/gold/testsuite/gnu_property_a.S @@ -0,0 +1,41 @@ +#define NT_GNU_PROPERTY_TYPE_0 5 + +#define GNU_PROPERTY_STACK_SIZE 1 +#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 +#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001 +#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 + +#if __SIZEOF_PTRDIFF_T__ == 8 +# define ALIGN 3 +#elif __SIZEOF_PTRDIFF_T__ == 4 +# define ALIGN 2 +#endif + + .section ".note.gnu.property", "a" + .p2align ALIGN + + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align ALIGN +2: .long GNU_PROPERTY_STACK_SIZE /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .dc.a 0x800 /* Stack size. */ +4: + .p2align ALIGN + .long GNU_PROPERTY_X86_ISA_1_USED + .long 4 + .byte 0x01,0x10,0x00,0x00 + .p2align ALIGN + .long GNU_PROPERTY_X86_ISA_1_NEEDED + .long 4 + .byte 0x01,0x10,0x00,0x00 + .p2align ALIGN + .long GNU_PROPERTY_X86_FEATURE_1_AND + .long 4 + .byte 0x01,0x00,0x00,0x00 + .p2align ALIGN +5: diff --git a/gold/testsuite/gnu_property_b.S b/gold/testsuite/gnu_property_b.S new file mode 100644 index 0000000..0c0c038 --- /dev/null +++ b/gold/testsuite/gnu_property_b.S @@ -0,0 +1,38 @@ +#define NT_GNU_PROPERTY_TYPE_0 5 + +#define GNU_PROPERTY_STACK_SIZE 1 +#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2 +#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 +#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001 +#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 + +#if __SIZEOF_PTRDIFF_T__ == 8 +# define ALIGN 3 +#elif __SIZEOF_PTRDIFF_T__ == 4 +# define ALIGN 2 +#endif + + .section ".note.gnu.property", "a" + .p2align ALIGN + .long 1f - 0f /* name length */ + .long 3f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align ALIGN +2: .long GNU_PROPERTY_NO_COPY_ON_PROTECTED /* pr_type. */ + .long 0 /* pr_datasz. */ + .p2align ALIGN + .long GNU_PROPERTY_X86_ISA_1_USED + .long 4 + .byte 0x01,0x11,0x00,0x00 + .p2align ALIGN + .long GNU_PROPERTY_X86_ISA_1_NEEDED + .long 4 + .byte 0x01,0x11,0x00,0x00 + .p2align ALIGN + .long GNU_PROPERTY_X86_FEATURE_1_AND + .long 4 + .byte 0x03,0x00,0x00,0x00 + .p2align ALIGN +3: diff --git a/gold/testsuite/gnu_property_c.S b/gold/testsuite/gnu_property_c.S new file mode 100644 index 0000000..ace159a --- /dev/null +++ b/gold/testsuite/gnu_property_c.S @@ -0,0 +1,44 @@ +#define NT_GNU_PROPERTY_TYPE_0 5 + +#define GNU_PROPERTY_STACK_SIZE 1 +#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2 +#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 +#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001 +#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 + +#if __SIZEOF_PTRDIFF_T__ == 8 +# define ALIGN 3 +#elif __SIZEOF_PTRDIFF_T__ == 4 +# define ALIGN 2 +#endif + + .section ".note.gnu.property", "a" + .p2align ALIGN + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long NT_GNU_PROPERTY_TYPE_0 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align ALIGN +2: .long GNU_PROPERTY_STACK_SIZE /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .dc.a 0x111100 /* Stack size. */ +4: + .p2align ALIGN + .long GNU_PROPERTY_NO_COPY_ON_PROTECTED /* pr_type. */ + .long 0 /* pr_datasz. */ + .p2align ALIGN + .long GNU_PROPERTY_X86_ISA_1_USED + .long 4 + .byte 0x11,0x10,0x00,0x00 + .p2align ALIGN + .long GNU_PROPERTY_X86_ISA_1_NEEDED + .long 4 + .byte 0x11,0x10,0x00,0x00 + .p2align ALIGN + .long GNU_PROPERTY_X86_FEATURE_1_AND + .long 4 + .byte 0x01,0x00,0x00,0x00 + .p2align ALIGN +5: diff --git a/gold/testsuite/gnu_property_main.c b/gold/testsuite/gnu_property_main.c new file mode 100644 index 0000000..77bc677 --- /dev/null +++ b/gold/testsuite/gnu_property_main.c @@ -0,0 +1,5 @@ +int +main(void) +{ + return 0; +} diff --git a/gold/testsuite/gnu_property_test.sh b/gold/testsuite/gnu_property_test.sh new file mode 100755 index 0000000..9a188ed --- /dev/null +++ b/gold/testsuite/gnu_property_test.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +# gnu_property_test.sh -- test .note.gnu.property section. + +# Copyright (C) 2018 Free Software Foundation, Inc. +# Written by Cary Coutant <ccoutant@gmail.com>. + +# This file is part of gold. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +# This script checks that after linking the three object files +# gnu_property_[abc].S, each of which contains a .note.gnu.property +# section, the resulting output has only a single such note section, +# and that the properties have been correctly combined. + +check() +{ + if ! grep -q "$2" "$1" + then + echo "Did not find expected output in $1:" + echo " $2" + echo "" + echo "Actual output below:" + cat "$1" + exit 1 + fi +} + +check_count() +{ + if test "`grep -c "$2" "$1"`" != "$3" + then + echo "Did not find correct number of note sections in $1:" + echo " $2" + echo "" + echo "Actual output below:" + cat "$1" + exit 1 + fi +} + +check_count gnu_property_test.stdout "GNU\s*0x[0-9a-f]*\s*NT_GNU_PROPERTY_TYPE_0" 1 + +check gnu_property_test.stdout "stack size: 0x111100" +check gnu_property_test.stdout "no copy on protected" +check gnu_property_test.stdout "x86 ISA used: i486, SSE2, SSE4_2, AVX512CD" +check gnu_property_test.stdout "x86 ISA needed: i486, SSE2, SSE4_2, AVX512CD" +check gnu_property_test.stdout "x86 feature: IBT" + +exit 0 |