aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfxx-x86.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-01-09 06:11:06 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-09 06:13:11 -0800
commit0a94990bf64a82bdf73960fec1b47fef7c6a6ced (patch)
tree739ccefb6a395a463262da661010b90716fe9ccc /bfd/elfxx-x86.c
parentf41464416a1744ca0151d61de1a7e405664dd9b7 (diff)
downloadgdb-0a94990bf64a82bdf73960fec1b47fef7c6a6ced.zip
gdb-0a94990bf64a82bdf73960fec1b47fef7c6a6ced.tar.gz
gdb-0a94990bf64a82bdf73960fec1b47fef7c6a6ced.tar.bz2
ld/x86-64: Properly Handle -z lam-u48/lam-u57
Properly merge GNU properties for LAM_U48 and LAM_U57. bfd/ PR ld/27166 * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Handle -z lam-u48 and -z lam-u57. ld/ PR ld/27166 * testsuite/ld-x86-64/lam-u48.rd: New file. * testsuite/ld-x86-64/lam-u57.rd: Likewise. * testsuite/ld-x86-64/x86-64.exp: Add PR ld/27166 tests.
Diffstat (limited to 'bfd/elfxx-x86.c')
-rw-r--r--bfd/elfxx-x86.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index c47f482..3a0dffc 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -2449,8 +2449,15 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
features = GNU_PROPERTY_X86_FEATURE_1_IBT;
if (htab->params->shstk)
features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
- /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
- GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ if (htab->params->lam_u48)
+ features |= (GNU_PROPERTY_X86_FEATURE_1_LAM_U48
+ | GNU_PROPERTY_X86_FEATURE_1_LAM_U57);
+ else if (htab->params->lam_u57)
+ features |= GNU_PROPERTY_X86_FEATURE_1_LAM_U57;
+ /* Add GNU_PROPERTY_X86_FEATURE_1_IBT,
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK,
+ GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
+ GNU_PROPERTY_X86_FEATURE_1_LAM_U57. */
aprop->u.number |= features;
}
updated = number != (unsigned int) aprop->u.number;
@@ -2470,6 +2477,11 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
features = GNU_PROPERTY_X86_FEATURE_1_IBT;
if (htab->params->shstk)
features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+ if (htab->params->lam_u48)
+ features |= (GNU_PROPERTY_X86_FEATURE_1_LAM_U48
+ | GNU_PROPERTY_X86_FEATURE_1_LAM_U57);
+ else if (htab->params->lam_u57)
+ features |= GNU_PROPERTY_X86_FEATURE_1_LAM_U57;
}
if (features)
{