|
|
d1152b |
diff -rup binutils.orig/gold/testsuite/gnu_property_a.S binutils-2.35/gold/testsuite/gnu_property_a.S
|
|
|
d1152b |
--- binutils.orig/gold/testsuite/gnu_property_a.S 2021-01-18 14:01:41.228809868 +0000
|
|
|
d1152b |
+++ binutils-2.35/gold/testsuite/gnu_property_a.S 2021-01-18 14:01:52.542736705 +0000
|
|
|
d1152b |
@@ -1,8 +1,8 @@
|
|
|
d1152b |
#define NT_GNU_PROPERTY_TYPE_0 5
|
|
|
d1152b |
|
|
|
d1152b |
#define GNU_PROPERTY_STACK_SIZE 1
|
|
|
d1152b |
-#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
|
|
|
d1152b |
-#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
|
|
|
d1152b |
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
|
|
|
d1152b |
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
|
|
|
d1152b |
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
|
|
|
d1152b |
|
|
|
d1152b |
#if __SIZEOF_PTRDIFF_T__ == 8
|
|
|
d1152b |
diff -rup binutils.orig/gold/testsuite/gnu_property_b.S binutils-2.35/gold/testsuite/gnu_property_b.S
|
|
|
d1152b |
--- binutils.orig/gold/testsuite/gnu_property_b.S 2021-01-18 14:01:41.233809836 +0000
|
|
|
d1152b |
+++ binutils-2.35/gold/testsuite/gnu_property_b.S 2021-01-18 14:01:52.542736705 +0000
|
|
|
d1152b |
@@ -2,8 +2,8 @@
|
|
|
d1152b |
|
|
|
d1152b |
#define GNU_PROPERTY_STACK_SIZE 1
|
|
|
d1152b |
#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
|
|
|
d1152b |
-#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
|
|
|
d1152b |
-#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
|
|
|
d1152b |
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
|
|
|
d1152b |
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
|
|
|
d1152b |
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
|
|
|
d1152b |
|
|
|
d1152b |
#if __SIZEOF_PTRDIFF_T__ == 8
|
|
|
d1152b |
diff -rup binutils.orig/gold/testsuite/gnu_property_c.S binutils-2.35/gold/testsuite/gnu_property_c.S
|
|
|
d1152b |
--- binutils.orig/gold/testsuite/gnu_property_c.S 2021-01-18 14:01:41.232809843 +0000
|
|
|
d1152b |
+++ binutils-2.35/gold/testsuite/gnu_property_c.S 2021-01-18 14:01:52.542736705 +0000
|
|
|
d1152b |
@@ -2,8 +2,8 @@
|
|
|
d1152b |
|
|
|
d1152b |
#define GNU_PROPERTY_STACK_SIZE 1
|
|
|
d1152b |
#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
|
|
|
d1152b |
-#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
|
|
|
d1152b |
-#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
|
|
|
d1152b |
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
|
|
|
d1152b |
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
|
|
|
d1152b |
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
|
|
|
d1152b |
|
|
|
d1152b |
#if __SIZEOF_PTRDIFF_T__ == 8
|
|
|
d1152b |
diff -rup binutils.orig/gold/testsuite/gnu_property_test.sh binutils-2.35/gold/testsuite/gnu_property_test.sh
|
|
|
d1152b |
--- binutils.orig/gold/testsuite/gnu_property_test.sh 2021-01-18 14:01:41.236809817 +0000
|
|
|
d1152b |
+++ binutils-2.35/gold/testsuite/gnu_property_test.sh 2021-01-18 14:01:52.543736699 +0000
|
|
|
d1152b |
@@ -57,8 +57,8 @@ check_count gnu_property_test.stdout "GN
|
|
|
d1152b |
|
|
|
d1152b |
check gnu_property_test.stdout "stack size: 0x111100"
|
|
|
d1152b |
check gnu_property_test.stdout "no copy on protected"
|
|
|
d1152b |
-check gnu_property_test.stdout "x86 ISA used: i486, SSE2, SSE4_2, AVX512CD"
|
|
|
d1152b |
-check gnu_property_test.stdout "x86 ISA needed: i486, SSE2, SSE4_2, AVX512CD"
|
|
|
d1152b |
+check gnu_property_test.stdout "x86 ISA used: x86-64-v2, <unknown: 10>, <unknown: 100>, <unknown: 1000>"
|
|
|
d1152b |
+check gnu_property_test.stdout "x86 ISA needed: x86-64-v2, <unknown: 10>, <unknown: 100>, <unknown: 1000>"
|
|
|
d1152b |
check gnu_property_test.stdout "x86 feature: IBT"
|
|
|
d1152b |
|
|
|
d1152b |
exit 0
|
|
|
d1152b |
diff -rup binutils.orig/gold/x86_64.cc binutils-2.35/gold/x86_64.cc
|
|
|
d1152b |
--- binutils.orig/gold/x86_64.cc 2021-01-18 14:01:41.225809888 +0000
|
|
|
d1152b |
+++ binutils-2.35/gold/x86_64.cc 2021-01-18 14:01:52.543736699 +0000
|
|
|
d1152b |
@@ -706,8 +706,9 @@ class Target_x86_64 : public Sized_targe
|
|
|
d1152b |
rela_irelative_(NULL), copy_relocs_(elfcpp::R_X86_64_COPY),
|
|
|
d1152b |
got_mod_index_offset_(-1U), tlsdesc_reloc_info_(),
|
|
|
d1152b |
tls_base_symbol_defined_(false), isa_1_used_(0), isa_1_needed_(0),
|
|
|
d1152b |
- feature_1_(0), object_isa_1_used_(0), object_feature_1_(0),
|
|
|
d1152b |
- seen_first_object_(false)
|
|
|
d1152b |
+ feature_1_(0), feature_2_used_(0), feature_2_needed_(0),
|
|
|
d1152b |
+ object_isa_1_used_(0), object_feature_1_(0),
|
|
|
d1152b |
+ object_feature_2_used_(0), seen_first_object_(false)
|
|
|
d1152b |
{ }
|
|
|
d1152b |
|
|
|
d1152b |
// Hook for a new output section.
|
|
|
d1152b |
@@ -1382,6 +1383,8 @@ class Target_x86_64 : public Sized_targe
|
|
|
d1152b |
uint32_t isa_1_used_;
|
|
|
d1152b |
uint32_t isa_1_needed_;
|
|
|
d1152b |
uint32_t feature_1_;
|
|
|
d1152b |
+ uint32_t feature_2_used_;
|
|
|
d1152b |
+ uint32_t feature_2_needed_;
|
|
|
d1152b |
// Target-specific properties from the current object.
|
|
|
d1152b |
// These bits get ORed into ISA_1_USED_ after all properties for the object
|
|
|
d1152b |
// have been processed. But if either is all zeroes (as when the property
|
|
|
d1152b |
@@ -1391,6 +1394,7 @@ class Target_x86_64 : public Sized_targe
|
|
|
d1152b |
// These bits get ANDed into FEATURE_1_ after all properties for the object
|
|
|
d1152b |
// have been processed.
|
|
|
d1152b |
uint32_t object_feature_1_;
|
|
|
d1152b |
+ uint32_t object_feature_2_used_;
|
|
|
d1152b |
// Whether we have seen our first object, for use in initializing FEATURE_1_.
|
|
|
d1152b |
bool seen_first_object_;
|
|
|
d1152b |
};
|
|
|
d1152b |
@@ -1594,9 +1598,15 @@ Target_x86_64<size>::record_gnu_property
|
|
|
d1152b |
|
|
|
d1152b |
switch (pr_type)
|
|
|
d1152b |
{
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_USED:
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED:
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED:
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED:
|
|
|
d1152b |
case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
|
|
|
d1152b |
case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
|
|
|
d1152b |
case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
|
|
|
d1152b |
if (pr_datasz != 4)
|
|
|
d1152b |
{
|
|
|
d1152b |
gold_warning(_("%s: corrupt .note.gnu.property section "
|
|
|
d1152b |
@@ -1625,6 +1635,12 @@ Target_x86_64<size>::record_gnu_property
|
|
|
d1152b |
// If we see multiple feature props in one object, OR them together.
|
|
|
d1152b |
this->object_feature_1_ |= val;
|
|
|
d1152b |
break;
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
|
|
|
d1152b |
+ this->object_feature_2_used_ |= val;
|
|
|
d1152b |
+ break;
|
|
|
d1152b |
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
|
|
|
d1152b |
+ this->feature_2_needed_ |= val;
|
|
|
d1152b |
+ break;
|
|
|
d1152b |
}
|
|
|
d1152b |
}
|
|
|
d1152b |
|
|
|
d1152b |
@@ -1642,15 +1658,23 @@ Target_x86_64<size>::merge_gnu_propertie
|
|
|
d1152b |
else if (this->isa_1_used_ != 0)
|
|
|
d1152b |
this->isa_1_used_ |= this->object_isa_1_used_;
|
|
|
d1152b |
this->feature_1_ &= this->object_feature_1_;
|
|
|
d1152b |
+ // If any object is missing the FEATURE_2_USED property, we must
|
|
|
d1152b |
+ // omit it from the output file.
|
|
|
d1152b |
+ if (this->object_feature_2_used_ == 0)
|
|
|
d1152b |
+ this->feature_2_used_ = 0;
|
|
|
d1152b |
+ else if (this->feature_2_used_ != 0)
|
|
|
d1152b |
+ this->feature_2_used_ |= this->object_feature_2_used_;
|
|
|
d1152b |
}
|
|
|
d1152b |
else
|
|
|
d1152b |
{
|
|
|
d1152b |
this->isa_1_used_ = this->object_isa_1_used_;
|
|
|
d1152b |
this->feature_1_ = this->object_feature_1_;
|
|
|
d1152b |
+ this->feature_2_used_ = this->object_feature_2_used_;
|
|
|
d1152b |
this->seen_first_object_ = true;
|
|
|
d1152b |
}
|
|
|
d1152b |
this->object_isa_1_used_ = 0;
|
|
|
d1152b |
this->object_feature_1_ = 0;
|
|
|
d1152b |
+ this->object_feature_2_used_ = 0;
|
|
|
d1152b |
}
|
|
|
d1152b |
|
|
|
d1152b |
static inline void
|
|
|
d1152b |
@@ -1676,6 +1700,12 @@ Target_x86_64<size>::do_finalize_gnu_pro
|
|
|
d1152b |
if (this->feature_1_ != 0)
|
|
|
d1152b |
add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND,
|
|
|
d1152b |
this->feature_1_);
|
|
|
d1152b |
+ if (this->feature_2_used_ != 0)
|
|
|
d1152b |
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED,
|
|
|
d1152b |
+ this->feature_2_used_);
|
|
|
d1152b |
+ if (this->feature_2_needed_ != 0)
|
|
|
d1152b |
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED,
|
|
|
d1152b |
+ this->feature_2_needed_);
|
|
|
d1152b |
}
|
|
|
d1152b |
|
|
|
d1152b |
// Write the first three reserved words of the .got.plt section.
|
|
|
d1152b |
--- binutils.orig/elfcpp/elfcpp.h 2021-01-18 14:01:40.778812778 +0000
|
|
|
d1152b |
+++ binutils-2.35/elfcpp/elfcpp.h 2021-01-18 14:50:05.144035077 +0000
|
|
|
d1152b |
@@ -1009,9 +1009,21 @@ enum
|
|
|
d1152b |
GNU_PROPERTY_STACK_SIZE = 1,
|
|
|
d1152b |
GNU_PROPERTY_NO_COPY_ON_PROTECTED = 2,
|
|
|
d1152b |
GNU_PROPERTY_LOPROC = 0xc0000000,
|
|
|
d1152b |
- GNU_PROPERTY_X86_ISA_1_USED = 0xc0000000,
|
|
|
d1152b |
- GNU_PROPERTY_X86_ISA_1_NEEDED = 0xc0000001,
|
|
|
d1152b |
- GNU_PROPERTY_X86_FEATURE_1_AND = 0xc0000002,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_COMPAT_ISA_1_USED = 0xc0000000,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED = 0xc0000001,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_UINT32_AND_LO = 0xc0000002,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_UINT32_AND_HI = 0xc0007fff,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_UINT32_OR_LO = 0xc0008000,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_UINT32_OR_HI = 0xc000ffff,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_UINT32_OR_AND_LO = 0xc0010000,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_UINT32_OR_AND_HI = 0xc0017fff,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 0,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_FEATURE_1_AND = GNU_PROPERTY_X86_UINT32_AND_LO + 0,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_ISA_1_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 2,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_FEATURE_2_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 1,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_ISA_1_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2,
|
|
|
d1152b |
+ GNU_PROPERTY_X86_FEATURE_2_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1,
|
|
|
d1152b |
GNU_PROPERTY_HIPROC = 0xdfffffff,
|
|
|
d1152b |
GNU_PROPERTY_LOUSER = 0xe0000000,
|
|
|
d1152b |
GNU_PROPERTY_HIUSER = 0xffffffff
|