[LTP] [PATCH] fcntl37: test posix lock across execve

Cyril Hrubis chrubis@suse.cz
Tue Mar 27 12:19:29 CEST 2018


Hi!
> > > +fcntl37: LDLIBS += -lpthread
> > > +fcntl37_64: LDLIBS += -lpthread
> > 
> > This is wrong, we should use CFLAGS += -pthread instead, also the rest
> 				^ This is not working.
> 
> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -DTST_USE_NEWER64_SYSCALL=1 -pthread -D_FORTIFY_SOURCE=2 -I/home/xzhou/ltp/testcases/kernel/syscalls/fcntl -I/home/xzhou/ltp/testcases/kernel/syscalls/fcntl/../utils -D_GNU_SOURCE -I../../../../include -I../../../../include -I../../../../include/old/ -D_FILE_OFFSET_BITS=64  -c -o fcntl37_64.o fcntl37.c
> gcc   -L../../../../lib  fcntl37_64.o   -lltp -o fcntl37_64
> ../../../../lib/libltp.a(safe_pthread.o): In function `safe_pthread_create':
> /home/xzhou/ltp/lib/safe_pthread.c:30: undefined reference to `pthread_create'
> ../../../../lib/libltp.a(safe_pthread.o): In function `safe_pthread_join':
> /home/xzhou/ltp/lib/safe_pthread.c:46: undefined reference to `pthread_join'
> collect2: error: ld returned 1 exit status

Hmm, looks like something is wrong with the newer_64.mk. It picks up a
linker rule that does not include CFLAGS. Following patch fixes that,
but I'm not 100% sure that it's correct, I will look further into that.

diff --git a/testcases/kernel/syscalls/utils/newer_64.mk b/testcases/kernel/syscalls/utils/newer_64.mk
index 8cd7e03c8..c70c2af53 100644
--- a/testcases/kernel/syscalls/utils/newer_64.mk
+++ b/testcases/kernel/syscalls/utils/newer_64.mk
@@ -49,7 +49,9 @@ HAS_NEWER_64          := 0
 endif
 
 %_64: CFLAGS += -D$(DEF_64)=1
-# XXX (garrcoop): End section of code in question..
 
 %_64.o: %.c
        $(COMPILE.c) $(OUTPUT_OPTION) $<
+
+%_64: %_64.o
+       $(LINK.c) $(OUTPUT_OPTION) $< $(LDLIBS)


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list