static void
bti_failed (struct link_map *l, const char *program)
{
- if (program)
- _dl_fatal_printf ("%s: %s: failed to turn on BTI protection\n",
- program, l->l_name);
+ if (program != NULL)
+ {
+ if (program[0] != '\0' && l->l_name[0] != '\0')
+ /* A program's dependency is not BTI compatible. */
+ _dl_fatal_printf ("%s: %s: failed to turn on BTI protection\n",
+ program, l->l_name);
+ if (program[0] != '\0')
+ /* The program itself is not BTI compatible. */
+ _dl_fatal_printf ("%s: failed to turn on BTI protection\n", program);
+ /* For static binaries, program will be an empty string. */
+ _dl_fatal_printf ("error: failed to turn on BTI protection\n");
+ }
else
- /* Note: the errno value is not available any more. */
+ /* If program is NULL, we are processing a dlopen operation.
+ Note: the errno value is not available any more. */
_dl_signal_error (0, l->l_name, "dlopen",
- N_("failed to turn on BTI protection"));
+ "failed to turn on BTI protection");
}
static void
fail (struct link_map *l, const char *program)
{
- if (program && program[0])
- _dl_fatal_printf ("%s: %s: %s\n", program, l->l_name, "not GCS compatible");
- else if (program)
- _dl_fatal_printf ("%s\n", "not GCS compatible");
+ if (program != NULL)
+ {
+ if (program[0] != '\0' && l->l_name[0] != '\0')
+ /* A program's dependency is not GCS compatible. */
+ _dl_fatal_printf ("%s: %s: not GCS compatible\n", program, l->l_name);
+ if (program[0] != '\0')
+ /* The program itself is not GCS compatible. */
+ _dl_fatal_printf ("%s: not GCS compatible\n", program);
+ /* For static binaries, program will be an empty string. */
+ _dl_fatal_printf ("error: not GCS compatible\n");
+ }
else
+ /* If program is NULL, we are processing a dlopen operation.
+ Note: the errno value is not available any more. */
_dl_signal_error (0, l->l_name, "dlopen", "not GCS compatible");
}
static void
unsupported (void)
{
- _dl_fatal_printf ("%s\n", "unsupported GCS policy");
+ _dl_fatal_printf ("unsupported GCS policy\n");
}
/* This function is called only when binary markings are not
#include <stddef.h>
#include <stdint.h>
#include <string.h>
+#include <sys/auxv.h>
#include <support/check.h>
#include <support/support.h>
static int
do_test (void)
{
+ unsigned long hwcap2 = getauxval (AT_HWCAP2);
+ if ((hwcap2 & HWCAP2_BTI) == 0)
+ FAIL_UNSUPPORTED ("BTI is not supported by this system");
return 0;
}