Pass -lpthread when linking instead of -pthread

-pthread is meant to be passed when compiling, not linking.
Prevents build errors on clang 9 like the following:

    clang++ -fuse-ld=lld -nodefaultlibs libc++.so -lc -lm -Wl,-rpath="\$ORIGIN/." -Wl,-rpath-link=. -O3 -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-strip-all -static-libstdc++ -Wl,--as-needed -pthread -o gn -Wl,--start-group tools/gn/gn_main.o base.a gn_lib.a -Wl,--end-group -ldl
     clang-9: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
     ld.lld: error: undefined symbol: pthread_create
     >>> referenced by worker_pool.cc
     >>>               util/worker_pool.o:(WorkerPool::WorkerPool(unsigned long)) in archive gn_lib.a

Verified the build works on earlier versions of clang and gcc.

BUG=chromium:932041,chromium:807400
R=brettw

Change-Id: I1b876ae43a5b9b04f82828680612641e49f86de2
Reviewed-on: https://gn-review.googlesource.com/c/4000
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/build/gen.py b/build/gen.py
index a7142fa..c426c0b 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -334,7 +334,7 @@
       ldflags.append('-maix64')
 
     if platform.is_posix():
-      ldflags.append('-pthread')
+      ldflags.append('-lpthread')
 
     if options.use_lto:
       cflags.extend(['-flto', '-fwhole-program-vtables'])