diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2019-03-13 14:38:15 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2019-03-13 14:38:29 +0800 |
commit | 44b27f959abf267fc9ec228f4131c932597b01d4 (patch) | |
tree | a678750a291412005272a2d770452a15f69f33dc /bfd/elfxx-x86.c | |
parent | 204f543cae7a5dc908264b49d558191d0ceb989c (diff) | |
download | gdb-44b27f959abf267fc9ec228f4131c932597b01d4.zip gdb-44b27f959abf267fc9ec228f4131c932597b01d4.tar.gz gdb-44b27f959abf267fc9ec228f4131c932597b01d4.tar.bz2 |
x86: Properly set IBT and SHSTK properties for -z ibt/shstk
There should be no AND properties if some input doesn't have them. We
should set IBT and SHSTK properties for -z ibt and -z shstk if needed.
bfd/
PR ld/24322
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Properly
merge GNU_PROPERTY_X86_FEATURE_1_[IBT|SHSTK].
ld/
PR ld/24322
* testsuite/ld-i386/i386.exp: Run PR ld/24322 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr24322a.d: New file.
* testsuite/ld-i386/pr24322b.d: Likewise.
* testsuite/ld-x86-64/pr24322a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322a.d: Likewise.
* testsuite/ld-x86-64/pr24322b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322b.d: Likewise.
* testsuite/ld-x86-64/pr24322a.s: Likewise.
* testsuite/ld-x86-64/pr24322b.s: Likewise.
* testsuite/ld-x86-64/pr24322c.s: Likewise.
Diffstat (limited to 'bfd/elfxx-x86.c')
-rw-r--r-- | bfd/elfxx-x86.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index d6b851c..584a75f 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -2496,6 +2496,9 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, } else { + /* There should be no AND properties since some input doesn't + have them. Set IBT and SHSTK properties for -z ibt and -z + shstk if needed. */ features = 0; if (info->ibt) features = GNU_PROPERTY_X86_FEATURE_1_IBT; @@ -2503,18 +2506,15 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK; if (features) { - /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and - GNU_PROPERTY_X86_FEATURE_1_SHSTK. */ if (aprop != NULL) { - number = aprop->u.number; - aprop->u.number = number | features; - updated = number != (unsigned int) aprop->u.number; + updated = features != (unsigned int) aprop->u.number; + aprop->u.number = features; } else { - bprop->u.number |= features; updated = TRUE; + bprop->u.number = features; } } else if (aprop != NULL) |