Backport upstream assember fix and disassembler fix.

Backport upstream fix in disassembler to handle mapping
symbol properly.
http://www.cygwin.com/ml/binutils-cvs/2009-03/msg00242.html

Backport upstream assembler fix.
This backports the following upstream fix for forward references
http://sourceware.org/ml/binutils-cvs/2010-09/msg00204.html

Change-Id: I2dc54d9cbe09a793a50b7ace4628c0e120616a32
diff --git a/binutils-2.19/README.android b/binutils-2.19/README.android
index 5c04089..63d0694 100644
--- a/binutils-2.19/README.android
+++ b/binutils-2.19/README.android
@@ -1,3 +1,29 @@
+2010-10-28  Doug Kwan  <dougkwan@google.com>
+
+	Backport upstream fix in disassembler to handle mapping
+	symbol properly.
+
+	http://www.cygwin.com/ml/binutils-cvs/2009-03/msg00242.html
+
+	Changed file:
+
+	opcodes/arm-dis.c
+
+	Added files:
+
+	gas/testsuite/gas/arm/mapsecs.d
+	gas/testsuite/gas/arm/mapsecs.s
+
+2010-09-29  Doug Kwan  <dougkwan@google.com>
+
+	Backport upstream fix in assembler.  This is required for LIPO.
+
+	http://sourceware.org/ml/binutils-cvs/2010-09/msg00204.html
+
+	Changed files:
+
+	gas/expr.c
+
 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
 
 	Backport upstream fix to disable inlining of merge section in ICF for
diff --git a/binutils-2.19/gas/expr.c b/binutils-2.19/gas/expr.c
index 285b438..b494a98 100644
--- a/binutils-2.19/gas/expr.c
+++ b/binutils-2.19/gas/expr.c
@@ -1866,16 +1866,27 @@
 
       if (retval != rightseg)
 	{
-	  if (! SEG_NORMAL (retval))
-	    {
-	      if (retval != undefined_section || SEG_NORMAL (rightseg))
-		retval = rightseg;
-	    }
-	  else if (SEG_NORMAL (rightseg)
+	  if (retval == undefined_section)
+	    ;
+	  else if (rightseg == undefined_section)
+	    retval = rightseg;
+	  else if (retval == expr_section)
+	    ;
+	  else if (rightseg == expr_section)
+	    retval = rightseg;
+	  else if (retval == reg_section)
+	    ;
+	  else if (rightseg == reg_section)
+	    retval = rightseg;
+	  else if (rightseg == absolute_section)
+	    ;
+	  else if (retval == absolute_section)
+	    retval = rightseg;
 #ifdef DIFF_EXPR_OK
-		   && op_left != O_subtract
+	  else if (op_left == O_subtract)
+	    ;
 #endif
-		   )
+	  else
 	    as_bad (_("operation combines symbols in different segments"));
 	}
 
diff --git a/binutils-2.19/gas/testsuite/gas/arm/mapsecs.d b/binutils-2.19/gas/testsuite/gas/arm/mapsecs.d
new file mode 100644
index 0000000..52bca8c
--- /dev/null
+++ b/binutils-2.19/gas/testsuite/gas/arm/mapsecs.d
@@ -0,0 +1,45 @@
+#as: -EL
+#objdump: --syms --special-syms -d
+#name: ARM Mapping Symbols with multiple sections
+# This test is only valid on EABI based ports.
+#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf
+#source: mapsecs.s
+
+
+.*: +file format .*arm.*
+
+SYMBOL TABLE:
+0+00 l    d  .text	00000000 .text
+0+00 l    d  .data	00000000 .data
+0+00 l    d  .bss	00000000 .bss
+0+00 l    d  .text.f1	00000000 .text.f1
+0+00 l     F .text.f1	00000000 f1
+0+00 l       .text.f1	00000000 \$a
+0+08 l       .text.f1	00000000 f1a
+0+00 l    d  .text.f2	00000000 .text.f2
+0+00 l     F .text.f2	00000000 f2
+0+00 l       .text.f2	00000000 \$a
+0+04 l       .text.f2	00000000 \$d
+0+08 l       .text.f2	00000000 f2a
+0+08 l       .text.f2	00000000 \$a
+0+00 l    d  .ARM.attributes	00000000 .ARM.attributes
+
+
+
+Disassembly of section .text.f1:
+
+00000000 <f1>:
+   0:	e1a00000 	nop			\(mov r0,r0\)
+   4:	e1a00000 	nop			\(mov r0,r0\)
+
+00000008 <f1a>:
+   8:	e1a00000 	nop			\(mov r0,r0\)
+
+Disassembly of section .text.f2:
+
+00000000 <f2>:
+   0:	e1a00000 	nop			\(mov r0,r0\)
+   4:	00000001 	.word	0x00000001
+
+00000008 <f2a>:
+   8:	e1a00000 	nop			\(mov r0,r0\)
diff --git a/binutils-2.19/gas/testsuite/gas/arm/mapsecs.s b/binutils-2.19/gas/testsuite/gas/arm/mapsecs.s
new file mode 100644
index 0000000..005c339
--- /dev/null
+++ b/binutils-2.19/gas/testsuite/gas/arm/mapsecs.s
@@ -0,0 +1,15 @@
+	.text
+	.section .text.f1,"ax",%progbits
+	.type f1, %function
+f1:
+	nop
+	nop
+f1a:
+	nop
+	.section .text.f2,"ax",%progbits
+	.type f2, %function
+f2:
+	nop
+	.word 1
+f2a:
+	nop
diff --git a/binutils-2.19/opcodes/arm-dis.c b/binutils-2.19/opcodes/arm-dis.c
index 95ba822..e70d908 100644
--- a/binutils-2.19/opcodes/arm-dis.c
+++ b/binutils-2.19/opcodes/arm-dis.c
@@ -4071,7 +4071,9 @@
 	     for a preceeding one.  */
 	  for (; n >= 0; n--)
 	    {
-	      if (get_sym_code_type (info, n, &type))
+	      if ((info->section == NULL
+		   || info->section == info->symtab[n]->section)
+		  && get_sym_code_type (info, n, &type))
 		{
 		  last_sym = n;
 		  found = TRUE;