Build rule updates for aosp

Various build rule changes to match AOSP:
Add libunwind_llvm and libdl as dependencies for libc++ on device
Always add libcompiler_rt-extras as a dependency
Add libm, libc, and libdl as depnendencies for libc++ static binaries
Disable some clang warnings, and add some clang filtered cflags
Add -fstack-protector to host linux builds
Add jack_flags property to java modules (currently ignored)

Change-Id: Ic0da617bdeaf25f58cb8298dd9ea91b7d6509151
diff --git a/cc/cc_test.go b/cc/cc_test.go
new file mode 100644
index 0000000..3bf0c65
--- /dev/null
+++ b/cc/cc_test.go
@@ -0,0 +1,56 @@
+package cc
+
+import (
+	"reflect"
+	"testing"
+)
+
+var lastUniqueElementsTestCases = []struct {
+	in  []string
+	out []string
+}{
+	{
+		in:  []string{"a"},
+		out: []string{"a"},
+	},
+	{
+		in:  []string{"a", "b"},
+		out: []string{"a", "b"},
+	},
+	{
+		in:  []string{"a", "a"},
+		out: []string{"a"},
+	},
+	{
+		in:  []string{"a", "b", "a"},
+		out: []string{"b", "a"},
+	},
+	{
+		in:  []string{"b", "a", "a"},
+		out: []string{"b", "a"},
+	},
+	{
+		in:  []string{"a", "a", "b"},
+		out: []string{"a", "b"},
+	},
+	{
+		in:  []string{"a", "b", "a", "b"},
+		out: []string{"a", "b"},
+	},
+	{
+		in:  []string{"liblog", "libdl", "libc++", "libdl", "libc", "libm"},
+		out: []string{"liblog", "libc++", "libdl", "libc", "libm"},
+	},
+}
+
+func TestLastUniqueElements(t *testing.T) {
+	for _, testCase := range lastUniqueElementsTestCases {
+		out := lastUniqueElements(testCase.in)
+		if !reflect.DeepEqual(out, testCase.out) {
+			t.Errorf("incorrect output:")
+			t.Errorf("     input: %#v", testCase.in)
+			t.Errorf("  expected: %#v", testCase.out)
+			t.Errorf("       got: %#v", out)
+		}
+	}
+}