For proper order put -lpthreads as a 'library' not a 'linker flag'

Linker flags appear early among the link command line arguments,
before other libraries that need pthreads. Changing it to a library
puts it at the end of the command line.

Change-Id: I2d0cc5e44a33d72f9fcaa67f3a6fbc0da565a735
Reviewed-on: https://gn-review.googlesource.com/c/4060
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 c426c0b..c330abc 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -334,7 +334,7 @@
       ldflags.append('-maix64')
 
     if platform.is_posix():
-      ldflags.append('-lpthread')
+      libs.append('-lpthread')
 
     if options.use_lto:
       cflags.extend(['-flto', '-fwhole-program-vtables'])