aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMatthieu Longo <matthieu.longo@arm.com>2024-11-28 11:13:23 +0000
committerMatthieu Longo <matthieu.longo@arm.com>2024-12-02 15:18:40 +0000
commitcaded0cf73cb914e5d2d61f4696af154c2ba4360 (patch)
treec6892ad69e4b1147b1a6b991b5bb06dbc15b0589 /bfd
parent23189e9db77b280f88bb55ca8748e7edb72c61b1 (diff)
downloadbinutils-caded0cf73cb914e5d2d61f4696af154c2ba4360.zip
binutils-caded0cf73cb914e5d2d61f4696af154c2ba4360.tar.gz
binutils-caded0cf73cb914e5d2d61f4696af154c2ba4360.tar.bz2
aarch64: use only one type for feature marking report
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elfnn-aarch64.c4
-rw-r--r--bfd/elfxx-aarch64.c17
-rw-r--r--bfd/elfxx-aarch64.h23
3 files changed, 25 insertions, 19 deletions
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 8500a50..0350325 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -10644,12 +10644,12 @@ elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
{
const aarch64_protection_opts *sw_protections
= &elf_aarch64_tdata (info->output_bfd)->sw_protections;
- aarch64_bti_report bti_report = sw_protections->bti_report;
+ aarch64_feature_marking_report bti_report = sw_protections->bti_report;
/* If output has been marked with BTI using command line argument, give
out warning if necessary. */
if ((prop & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)
- && (bti_report != BTI_NONE))
+ && (bti_report != MARKING_NONE))
{
if ((aprop && !(aprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI))
|| !aprop)
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index b4dd523..1993a97 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -926,15 +926,18 @@ _bfd_aarch64_elf_link_fixup_gnu_properties
/* Check AArch64 BTI report. */
void
-_bfd_aarch64_elf_check_bti_report (aarch64_bti_report bti_report, bfd *ebfd)
+_bfd_aarch64_elf_check_bti_report (aarch64_feature_marking_report bti_report,
+ bfd *ebfd)
{
- if (bti_report == BTI_NONE)
+ if (bti_report == MARKING_NONE)
return;
- const char *log_level = (bti_report == BTI_WARN ? "warning" : "error");
+ const char *msg
+ = (bti_report == MARKING_WARN)
+ ? _("%pB: warning: BTI turned on by -z force-bti on the output when all "
+ "inputs do not have BTI in NOTE section.")
+ : _("%pB: error: BTI turned on by -z force-bti on the output when all "
+ "inputs do not have BTI in NOTE section.");
- const char *msg = _("%pB: %s: BTI turned on by -z force-bti on the output "
- "when all inputs do not have BTI in NOTE section.");
-
- _bfd_error_handler (msg, ebfd, log_level);
+ _bfd_error_handler (msg, ebfd);
} \ No newline at end of file
diff --git a/bfd/elfxx-aarch64.h b/bfd/elfxx-aarch64.h
index 298edd4..43db992 100644
--- a/bfd/elfxx-aarch64.h
+++ b/bfd/elfxx-aarch64.h
@@ -39,16 +39,19 @@ typedef enum
PLT_BTI_PAC = PLT_BTI | PLT_PAC
} aarch64_plt_type;
-/* Indicates whether the linker should generate warnings/errors when input
- objects are missing BTI markings and the output has BTI markings. */
+/* Indicates whether the linker should generate warnings, errors, or nothing
+ when input objects are missing GNU feature property markings and the output
+ has the markings. */
typedef enum
{
- BTI_NONE = 0, /* Does not emit any warning/error messages. */
- BTI_WARN = 1, /* Emit warning when the input objects are missing BTI
- markings and output have BTI marking. */
- BTI_ERROR = 2, /* Emit error when the input objects are missing BTI
- markings and output have BTI marking. */
-} aarch64_bti_report;
+ MARKING_NONE = 0, /* Does not emit any warning/error messages. */
+ MARKING_WARN = 1, /* Emit warning when the input objects are missing GNU
+ feature property markings, and the output has the
+ markings. */
+ MARKING_ERROR = 2, /* Emit error when the input objects are missing GNU
+ feature property markings, and the output has the
+ markings. */
+} aarch64_feature_marking_report;
/* A structure to encompass all information about software protections coming
from BTI or PAC related command line options. */
@@ -58,7 +61,7 @@ struct aarch64_protection_opts
aarch64_plt_type plt_type;
/* Report level for BTI issues. */
- aarch64_bti_report bti_report;
+ aarch64_feature_marking_report bti_report;
};
typedef struct aarch64_protection_opts aarch64_protection_opts;
@@ -165,7 +168,7 @@ _bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *, bfd *,
uint32_t);
extern void
-_bfd_aarch64_elf_check_bti_report (aarch64_bti_report, bfd *);
+_bfd_aarch64_elf_check_bti_report (aarch64_feature_marking_report, bfd *);
extern void
_bfd_aarch64_elf_link_fixup_gnu_properties (struct bfd_link_info *,