This testcase is failing on ppc64 BE system, because address of &test_profil does not reference beginning of code, but entry in .opd section: "This section contains the official procedure descriptors. A pointer to a function shall reference a procedure descriptor in this section." which was at address larger than all .text of test_profil.
This patch is replacing address of function approach with gcc's __builtin_return_address() to get current pc value. Signed-off-by: Jan Stancek <[email protected]> --- testcases/kernel/syscalls/profil/profil01.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/syscalls/profil/profil01.c b/testcases/kernel/syscalls/profil/profil01.c index 5511f68..521ef97 100644 --- a/testcases/kernel/syscalls/profil/profil01.c +++ b/testcases/kernel/syscalls/profil/profil01.c @@ -31,9 +31,11 @@ #define PROFIL_TIME 5 -/* should be large enough to hold data for test_profil() .text - * on x86_64 this is ~600 bytes, so 16k should enough for all arches */ -#define PROFIL_BUFLEN (16*1024) +/* Should be large enough to hold data for test_profil() .text, + * on x86_64 this is ~600 bytes, so 16k should enough for all arches. + * We will monitor 16k on each side around current pc value, + * just in case compiler put call to get_pc() below "data shuffling" code */ +#define PROFIL_BUFLEN (32*1024) char *TCID = "profil01"; int TST_TOTAL = 1; @@ -46,11 +48,16 @@ static void alrm_handler(int sig) profil_done = 1; } +static void __attribute__ ((noinline)) *get_pc(void) +{ + return __builtin_return_address(0); +} + static void test_profil(void) { unsigned short buf[PROFIL_BUFLEN] = { 0 }; volatile int data[8] = { 0 }; - size_t offset = (size_t) &test_profil, count = 0; + size_t offset = (size_t) get_pc() - PROFIL_BUFLEN/2, count = 0; int ret, i; /* reset for test looping */ -- 1.7.1 ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
