Skip to content

Commit d5f578f

Browse files
committed
selftests/powerpc: Fix 32-bit BE build errors on Ubuntu 24.04
Starting with Ubuntu 24.04, building the selftests with the big endian compiler (which defaults to 32-bit) fails with errors: stack_expansion_ldst.c:178:37: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'rlim_t' {aka 'long long unsigned int'} subpage_prot.c:214:38: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' {aka 'long long int'} Prior to 24.04 rlim_t was long unsigned int, and off_t was long int. Cast to unsigned long long and long long before passing to printf to avoid the errors. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/20241106130453.1741013-3-mpe@ellerman.id.au
1 parent 5543d59 commit d5f578f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

tools/testing/selftests/powerpc/mm/stack_expansion_ldst.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static int test(void)
175175

176176
page_size = getpagesize();
177177
getrlimit(RLIMIT_STACK, &rlimit);
178-
printf("Stack rlimit is 0x%lx\n", rlimit.rlim_cur);
178+
printf("Stack rlimit is 0x%llx\n", (unsigned long long)rlimit.rlim_cur);
179179

180180
printf("Testing loads ...\n");
181181
test_one_type(LOAD, page_size, rlimit.rlim_cur);

tools/testing/selftests/powerpc/mm/subpage_prot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ int test_file(void)
211211
perror("failed to map file");
212212
return 1;
213213
}
214-
printf("allocated %s for 0x%lx bytes at %p\n",
215-
file_name, filesize, fileblock);
214+
printf("allocated %s for 0x%llx bytes at %p\n",
215+
file_name, (long long)filesize, fileblock);
216216

217217
printf("testing file map...\n");
218218

0 commit comments

Comments
 (0)