summaryrefslogtreecommitdiff
path: root/tests/libexec
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2018-03-09 20:15:03 +0000
committerjoerg <joerg@NetBSD.org>2018-03-09 20:15:03 +0000
commit8856f2a9b378fe27faedfaf95379219923be2d45 (patch)
tree84d034206f83c26c463fd54370279bac17204a01 /tests/libexec
parente7623c93c08993c76b73331a41dbd52ba1d6d22f (diff)
Avoid casting fun by switching ifunc helper functions to return
long long. Dead beef is too useful to switch to a different constant.
Diffstat (limited to 'tests/libexec')
-rw-r--r--tests/libexec/ld.elf_so/h_ifunc.c6
-rw-r--r--tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c22
-rw-r--r--tests/libexec/ld.elf_so/t_ifunc.c34
3 files changed, 31 insertions, 31 deletions
diff --git a/tests/libexec/ld.elf_so/h_ifunc.c b/tests/libexec/ld.elf_so/h_ifunc.c
index ac446fa2a0e..8929a93e808 100644
--- a/tests/libexec/ld.elf_so/h_ifunc.c
+++ b/tests/libexec/ld.elf_so/h_ifunc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: h_ifunc.c,v 1.1 2014/08/25 20:40:53 joerg Exp $ */
+/* $NetBSD: h_ifunc.c,v 1.2 2018/03/09 20:15:03 joerg Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <stdlib.h>
-extern int ifunc(void);
+extern long long ifunc(void);
int
main(int argc, char **argv)
@@ -39,5 +39,5 @@ main(int argc, char **argv)
if (argc != 2)
return 1;
- return ifunc() != atoi(argv[1]);
+ return ifunc() != atoll(argv[1]);
}
diff --git a/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c b/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c
index 9c175b650ee..ddb1d02205d 100644
--- a/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c
+++ b/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c
@@ -30,27 +30,27 @@
#include <stdlib.h>
#include <string.h>
-static int
+static long long
ifunc1(void)
{
- return 0xdeadbeef;
+ return 0xdeadbeefll;
}
-static int
+static long long
ifunc2(void)
{
- return 0xbeefdead;
+ return 0xbeefdeadll;
}
static __attribute__((used))
-int (*resolve_ifunc(void))(void)
+long long (*resolve_ifunc(void))(void)
{
const char *e = getenv("USE_IFUNC2");
return e && strcmp(e, "1") == 0 ? ifunc2 : ifunc1;
}
static __attribute__((used))
-int (*resolve_ifunc2(void))(void)
+long long (*resolve_ifunc2(void))(void)
{
const char *e = getenv("USE_IFUNC2");
return e && strcmp(e, "1") == 0 ? ifunc1 : ifunc2;
@@ -59,17 +59,17 @@ int (*resolve_ifunc2(void))(void)
__ifunc(ifunc, resolve_ifunc);
__hidden_ifunc(ifunc_hidden, resolve_ifunc2);
-int ifunc_hidden(void);
-int ifunc_plt(void);
+long long ifunc_hidden(void);
+long long ifunc_plt(void);
-int ifunc_plt(void)
+long long ifunc_plt(void)
{
return ifunc_hidden();
}
-int (*ifunc_indirect(void))(void);
+long long (*ifunc_indirect(void))(void);
-int (*ifunc_indirect(void))(void)
+long long (*ifunc_indirect(void))(void)
{
return ifunc_hidden;
}
diff --git a/tests/libexec/ld.elf_so/t_ifunc.c b/tests/libexec/ld.elf_so/t_ifunc.c
index 1554fc92dfb..a022c73f1a2 100644
--- a/tests/libexec/ld.elf_so/t_ifunc.c
+++ b/tests/libexec/ld.elf_so/t_ifunc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ifunc.c,v 1.7 2018/01/01 06:34:13 maya Exp $ */
+/* $NetBSD: t_ifunc.c,v 1.8 2018/03/09 20:15:03 joerg Exp $ */
/*
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -53,12 +53,12 @@ ATF_TC_BODY(rtld_ifunc, tc)
const char *envstr[] = {
"0", "1"
};
- int expected_result[] = {
- 0xdeadbeef, 0xbeefdead
+ long long expected_result[] = {
+ 0xdeadbeefll, 0xbeefdeadll
};
void *handle;
- int (*sym)(void);
- int result;
+ long long (*sym)(void);
+ long long result;
const char *error;
size_t i;
@@ -86,7 +86,7 @@ ATF_TC_BODY(rtld_ifunc, tc)
ATF_CHECK(error == NULL);
char *command;
- easprintf(&command, "%s/h_ifunc %d",
+ easprintf(&command, "%s/h_ifunc %lld",
atf_tc_get_config_var(tc, "srcdir"), expected_result[i]);
if (system(command) != EXIT_SUCCESS)
atf_tc_fail("Test failed; see output for details");
@@ -106,13 +106,13 @@ ATF_TC_BODY(rtld_hidden_ifunc, tc)
const char *envstr[] = {
"0", "1"
};
- int expected_result[] = {
- 0xdeadbeef, 0xbeefdead
+ long long expected_result[] = {
+ 0xdeadbeefll, 0xbeefdeadll
};
void *handle;
- int (*sym)(void);
- int (*(*sym2)(void))(void);
- int result;
+ long long (*sym)(void);
+ long long (*(*sym2)(void))(void);
+ long long result;
const char *error;
size_t i;
@@ -149,7 +149,7 @@ ATF_TC_BODY(rtld_hidden_ifunc, tc)
ATF_CHECK(error == NULL);
char *command;
- easprintf(&command, "%s/h_ifunc %d",
+ easprintf(&command, "%s/h_ifunc %lld",
atf_tc_get_config_var(tc, "srcdir"), expected_result[i]);
if (system(command) != EXIT_SUCCESS)
atf_tc_fail("Test failed; see output for details");
@@ -165,26 +165,26 @@ ATF_TC_HEAD(rtld_main_ifunc, tc)
}
#if LINKER_SUPPORT
-static unsigned int
+static long long
ifunc_helper(void)
{
- return 0xdeadbeef;
+ return 0xdeadbeefll;
}
static __attribute__((used))
-unsigned int (*resolve_ifunc(void))(void)
+long long (*resolve_ifunc(void))(void)
{
return ifunc_helper;
}
__hidden_ifunc(ifunc, resolve_ifunc);
#endif
-unsigned int ifunc(void);
+long long ifunc(void);
ATF_TC_BODY(rtld_main_ifunc, tc)
{
if (!LINKER_SUPPORT)
atf_tc_skip("Missing linker support for ifunc relocations");
- ATF_CHECK(ifunc() == 0xdeadbeef);
+ ATF_CHECK(ifunc() == 0xdeadbeefll);
}
ATF_TP_ADD_TCS(tp)