Brian Cain <quic_bc...@quicinc.com> writes: > On 9/6/2024 9:39 PM, Brian Cain wrote: >> With newer clang builds (19.x), there's a warning for implicit function >> declarations and it rejects linux-test.c. >> >> glibc/musl's readdir64() declaration in dirent is guarded by >> _LARGEFILE64_SOURCE, so we'll define it to fix the warning. >> >> BUILD hexagon-linux-user guest-tests >> >> /local/mnt/workspace/upstream/toolchain_for_hexagon/qemu/tests/tcg/multiarch/linux/linux-test.c:189:14: >> error: call to undeclared function 'readdir64'; ISO C99 and later do not >> support implicit function declarations [-Wimplicit-function-declaration] >> 189 | de = readdir64(dir); >> | ^ >> >> Signed-off-by: Brian Cain <bc...@quicinc.com> >> --- >> tests/tcg/multiarch/linux/linux-test.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/tests/tcg/multiarch/linux/linux-test.c >> b/tests/tcg/multiarch/linux/linux-test.c >> index 64f57cb287..4e0e862ad9 100644 >> --- a/tests/tcg/multiarch/linux/linux-test.c >> +++ b/tests/tcg/multiarch/linux/linux-test.c >> @@ -17,6 +17,7 @@ >> * along with this program; if not, see <http://www.gnu.org/licenses/>. >> */ >> #define _GNU_SOURCE >> +#define _LARGEFILE64_SOURCE >> #include <stdarg.h> >> #include <stdlib.h> >> #include <stdio.h> > > > Alex -- what do you think about this one?
Looking at the glibc headers the LARGEFILE stuff seems to be mainly about cleanly mapping readdir64 to readdir. I don't think we are trying to exercise 64 on 32 here so we could do: modified tests/tcg/multiarch/linux/linux-test.c @@ -83,7 +83,7 @@ static void test_file(void) struct utimbuf tbuf; struct iovec vecs[2]; DIR *dir; - struct dirent64 *de; + struct dirent *de; /* TODO: make common tempdir creation for tcg tests */ char template[] = "/tmp/linux-test-XXXXXX"; char *tmpdir = mkdtemp(template); @@ -186,7 +186,7 @@ static void test_file(void) error("opendir"); len = 0; for(;;) { - de = readdir64(dir); + de = readdir(dir); if (!de) break; if (strcmp(de->d_name, ".") != 0 && Does that work for your clang case? -- Alex Bennée Virtualisation Tech Lead @ Linaro