Merge branch 'upstream/master'
diff --git a/lib/Makefile-pnacl b/lib/Makefile-pnacl
new file mode 100644
index 0000000..cd41c58
--- /dev/null
+++ b/lib/Makefile-pnacl
@@ -0,0 +1,82 @@
+# This Makefile builds onacl version of libgcc.a
+#
+# More information on the functions of libgcc can be found at:
+# http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc
+# ../README.txt
+#
+# The following variables are expected to be set externally:
+
+# SRC_DIR
+# CC
+# AR
+# CFLAGS
+
+# pick up .c files from another dir
+vpath %.c ${SRC_DIR}
+
+
+# TODO(robertm): augment/prune this as we gain a better understanding of llc
+# http://code.google.com/p/nativeclient/issues/detail?id=842
+# http://code.google.com/p/nativeclient/issues/detail?id=846
+# http://code.google.com/p/nativeclient/issues/detail?id=821
+#
+# List of unused files in this directory with explanation:
+# (this is still quite incomplete, and there is overlap)
+#
+# complex data type:
+# divdc3.c divsc3.c divxc3.c muldc3.c mulsc3.c mulxc3.c
+# 
+# 128 bit data type:
+# fixdfti.c fixxfti.c fixsfti.c 
+# fixunsdfti.c fixunssfti.c fixunsxfti.c
+# floattidf.c floattisf.c floattixf.c
+# floatuntidf.c floatuntisf.c floatuntixf.c
+# udivti3.c  umodti3.c  modti3.c multi3.c divti3.c
+# powitf2.c
+#
+# 80 bit float type:
+# floatdidf.c  floatdixf.c floatdisf.c
+# powixf2.c
+#
+# long double (ppc?):
+# powitf2.c
+#
+#
+# misc:
+# gcc_personality_v0.c
+# apple_versioning.c
+# trampoline_setup.c
+# enable_execute_stack.c
+# clear_cache.c
+
+SRCS=\
+divdi3.c divsi3.c \
+divmoddi4.c divmodsi4.c \
+fixdfdi.c fixdfsi.c \
+fixsfdi.c fixsfsi.c \
+fixunsdfdi.c fixunsdfsi.c \
+fixunssfdi.c fixunssfsi.c \
+floatdidf.c floatdisf.c \
+floatsidf.c floatsisf.c \
+floatundidf.c floatundisf.c \
+floatunsidf.c floatunsisf.c \
+moddi3.c modsi3.c \
+powisf2.c powidf2.c \
+udivdi3.c udivsi3.c \
+udivmoddi4.c udivmodsi4.c \
+umoddi3.c umodsi3.c 
+
+
+
+
+# NOTE: we build pic so we can use this for both pic and non-pic nexes
+EXTRA_FLAGS= -I${SRC_DIR}
+EXTRA_DEFINES= -D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0
+
+# overwrite default rule to make sure nothig unexpected happens
+%.o : %.c
+	$(CC) -c $(CFLAGS) ${EXTRA_DEFINES} ${EXTRA_FLAGS} $< -o $@
+
+# The main target of this Makefile
+libgcc.a: $(SRCS:.c=.o)
+	$(AR) rc $@ $^