Skip to content

Commit 7f33105

Browse files
Xie XiuQiakpm00
authored andcommitted
tools/mm: fix undefined reference to pthread_once
Commit 97d5f2e ("tools api fs: More thread safety for global filesystem variables") introduces pthread_once, so the libpthread should be added at link time, or we'll meet the following compile error when 'make -C tools/mm': gcc -Wall -Wextra -I../lib/ -o page-types page-types.c ../lib/api/libapi.a ~/linux/tools/lib/api/fs/fs.c:146: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:147: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:148: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:149: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:150: undefined reference to `pthread_once' /usr/bin/ld: ../lib/api/libapi.a(libapi-in.o):~/linux/tools/lib/api/fs/fs.c:151: more undefined references to `pthread_once' follow collect2: error: ld returned 1 exit status make: *** [Makefile:22: page-types] Error 1 Link: https://lkml.kernel.org/r/[email protected] Fixes: 97d5f2e ("tools api fs: More thread safety for global filesystem variables") Signed-off-by: Xie XiuQi <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Matthew Wilcox <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6f0df8e commit 7f33105

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/mm/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ TARGETS=page-types slabinfo page_owner_sort
88
LIB_DIR = ../lib/api
99
LIBS = $(LIB_DIR)/libapi.a
1010

11-
CFLAGS += -Wall -Wextra -I../lib/
12-
LDFLAGS += $(LIBS)
11+
CFLAGS += -Wall -Wextra -I../lib/ -pthread
12+
LDFLAGS += $(LIBS) -pthread
1313

1414
all: $(TARGETS)
1515

0 commit comments

Comments
 (0)