* [LTP] Use of -pthread
@ 2017-05-10 18:51 Steve East
2017-05-11 8:10 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Steve East @ 2017-05-10 18:51 UTC (permalink / raw)
To: ltp
I see a few tests adding -pthread to CFLAGS in the Makefile:
sge@oststbldvm09 ltp $ find . -name Makefile|xargs grep -- -pthread
./lib/newlib_tests/Makefile:test08: CFLAGS+=-pthread
./lib/newlib_tests/Makefile:test09: CFLAGS+=-pthread
./lib/tests/Makefile:tst_cleanup_once: CFLAGS += -pthread
./testcases/kernel/mem/hugetlb/hugemmap/Makefile:hugemmap06: CFLAGS+=-pthread
./testcases/kernel/security/dirtyc0w/Makefile:dirtyc0w_child: CFLAGS+=-pthread
./testcases/kernel/syscalls/futex/Makefile:futex_wait03: CFLAGS+=-pthread
./testcases/kernel/syscalls/futex/Makefile:futex_wake02: CFLAGS+=-pthread
./testcases/kernel/syscalls/futex/Makefile:futex_wake04: CFLAGS+=-pthread
./testcases/kernel/syscalls/sched_getattr/Makefile:CFLAGS += -pthread
./testcases/kernel/syscalls/sched_setattr/Makefile:CFLAGS += -pthread
./testcases/kernel/syscalls/signal/Makefile:signal06: CFLAGS+=-pthread
Other tests (50+) use:
LDLIBS += -lpthread
Instead.
Any reason for the difference?
Steve.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [LTP] Use of -pthread
2017-05-10 18:51 [LTP] Use of -pthread Steve East
@ 2017-05-11 8:10 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2017-05-11 8:10 UTC (permalink / raw)
To: ltp
Hi!
> sge@oststbldvm09 ltp $ find . -name Makefile|xargs grep -- -pthread
> ./lib/newlib_tests/Makefile:test08: CFLAGS+=-pthread
> ./lib/newlib_tests/Makefile:test09: CFLAGS+=-pthread
> ./lib/tests/Makefile:tst_cleanup_once: CFLAGS += -pthread
> ./testcases/kernel/mem/hugetlb/hugemmap/Makefile:hugemmap06: CFLAGS+=-pthread
> ./testcases/kernel/security/dirtyc0w/Makefile:dirtyc0w_child: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/futex/Makefile:futex_wait03: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/futex/Makefile:futex_wake02: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/futex/Makefile:futex_wake04: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/sched_getattr/Makefile:CFLAGS += -pthread
> ./testcases/kernel/syscalls/sched_setattr/Makefile:CFLAGS += -pthread
> ./testcases/kernel/syscalls/signal/Makefile:signal06: CFLAGS+=-pthread
>
>
> Other tests (50+) use:
>
> LDLIBS += -lpthread
>
> Instead.
>
> Any reason for the difference?
Likely only historical. The only correct way how to link against
libpthread is -pthread in CFLAGS (as it's written in any pthread_*
manual page). Adding -lpthread into LDLIBS may work most of the time but
will fail rarely.
The uses of -lpthread should be replaced with -pthread.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-11 8:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-10 18:51 [LTP] Use of -pthread Steve East
2017-05-11 8:10 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox