CgptManagerTests: fix linking order

We need all the libraries to come after the objects, not before, otherwise
static and --as-needed linking fails when the linker drops the libraries.

BUG=None
TEST=`emerge vboot_reference` still works

Change-Id: Id98571a90115ab5ace68a0c795de86d7fe78f133
Reviewed-on: https://gerrit.chromium.org/gerrit/18290
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
diff --git a/tests/Makefile b/tests/Makefile
index 5412981..f7f0cba 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -55,7 +55,7 @@
 # Allow multiple definitions, so tests can mock functions from other libraries
 CFLAGS +=  -MMD -MF $@.d -Xlinker --allow-multiple-definition
 CXXFLAGS +=  -MMD -MF $@.d -Xlinker --allow-multiple-definition
-LDFLAGS += -luuid
+LDLIBS += $(PC_LIBS) -luuid
 
 LIBS := ${TEST_LIB} $(HOSTLIB)
 
@@ -78,8 +78,8 @@
 	$(CXX) -DWITH_UTIL_MAIN $(CXXFLAGS) $(INCLUDES) -c $< -o $@
 
 ${BUILD_ROOT}/CgptManagerTests: ${BUILD_ROOT}/CgptManagerTests.o
-	$(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) -lgtest -lgflags $^ \
-	${BUILD}/cgpt/libcgpt-cc.a $(PC_LIBS) -o $@
+	$(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) $^ \
+	${BUILD}/cgpt/libcgpt-cc.a -lgtest -lgflags $(LDLIBS) -o $@
 
 ${BUILD_ROOT}/vboot_audio_for_test.o : $(FWDIR)/lib/vboot_audio.c
 	$(CC) $(CFLAGS) -DCUSTOM_MUSIC $(INCLUDES) \