diff options
| author | joerg <joerg@NetBSD.org> | 2017-11-06 21:16:03 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2017-11-06 21:16:03 +0000 |
| commit | 79b9ae539bab769b0d0234fc22ca5df8346f44c3 (patch) | |
| tree | ddd40728eeb1d26f11f9065fcdea4928596f3cb6 /tests/libexec | |
| parent | 52b3386259d12c627438c633d661982ad653e46a (diff) | |
init/fini for the main program is handled by crt0.o, so ifunc handling
is skipped right now as it iterates the same list. Don't repeat that
mistake and explicitly take care of it in the dynamic linker.
Diffstat (limited to 'tests/libexec')
| -rw-r--r-- | tests/libexec/ld.elf_so/t_ifunc.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/libexec/ld.elf_so/t_ifunc.c b/tests/libexec/ld.elf_so/t_ifunc.c index 356cce67e22..79f8c71e589 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.4 2017/08/12 09:03:28 joerg Exp $ */ +/* $NetBSD: t_ifunc.c,v 1.5 2017/11/06 21:16:03 joerg Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -149,9 +149,36 @@ ATF_TC_BODY(rtld_hidden_ifunc, tc) } } +ATF_TC(rtld_main_ifunc); +ATF_TC_HEAD(rtld_main_ifunc, tc) +{ + atf_tc_set_md_var(tc, "descr", + "ifunc functions are resolved in the executable"); +} + +static unsigned int +ifunc_helper(void) +{ + return 0xdeadbeef; +} + +static __attribute__((used)) +unsigned int (*resolve_ifunc(void))(void) +{ + return ifunc_helper; +} +__hidden_ifunc(ifunc, resolve_ifunc); +unsigned int ifunc(void); + +ATF_TC_BODY(rtld_main_ifunc, tc) +{ + ATF_CHECK(ifunc() == 0xdeadbeef); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, rtld_ifunc); ATF_TP_ADD_TC(tp, rtld_hidden_ifunc); + ATF_TP_ADD_TC(tp, rtld_main_ifunc); return 0; } |
