+2016-05-18  Nick Clifton  <nickc@redhat.com>
+
+       * scripttempl/ft32.sc: Use fixed constants for memory region
+       lengths.  Include DWARF debug sections.
+       (.data .bss): Do not assign locations during relocatable links.
+       * testsuite/ld-elf/compressed1d.d: Skip for FT32.
+       * testsuite/ld-elf/sec-to-seg.exp: Likewise.
+       * testsuite/ld-elf/sec64k.exp: Likewise.
+       * testsuite/ld-elf/init-fini-array.d: XFail for FT32.
+       * testsuite/ld-elf/merge.d: Likewise.
+       * testsuite/ld-elf/orphan-region.d: Likewise.
+       * testsuite/ld-elf/orphan.s: Likewise.
+       * testsuite/ld-elf/orphan3.d: Likewise.
+       * testsuite/ld-elf/pr349.d: Likewise.
+       * testsuite/ld-elf/warn2.d: Likewise.
+       * testsuite/lib/ld-lib.exp (check_shared_lib_support): Note
+       that the FT32 does not support shared libraries.
+
 2016-05-17  H.J. Lu  <hongjiu.lu@intel.com>
 
        * testsuite/lib/ld-lib.exp (at_least_gcc_version): Check
 
   .comment 0 : { *(.comment) }
 EOF
 
-source $srcdir/scripttempl/DWARF.sc
+. $srcdir/scripttempl/DWARF.sc
 
 cat <<EOF
   .MSP430.attributes 0 :
 
 OUTPUT_ARCH(${ARCH})
 ${LIB_SEARCH_DIRS}
 
-PROVIDE( __PMSIZE = 256K );
-PROVIDE( __RAMSIZE = 64K );
-
 MEMORY
 {
-  flash     (rx)   : ORIGIN = 0, LENGTH = __PMSIZE
-  ram       (rw!x) : ORIGIN = 0x800000, LENGTH = __RAMSIZE
+  /* Note - we cannot use "PROVIDE(len)" ... "LENGTH = len" as
+     PROVIDE statements are not evaluated inside MEMORY blocks.  */
+  flash     (rx)   : ORIGIN = 0, LENGTH = 256K
+  ram       (rw!x) : ORIGIN = 0x800000, LENGTH = 64K
 }
 SECTIONS
 {
     . = ALIGN(4);
   } ${RELOCATING+ > flash}
   ${CONSTRUCTING+${TORS}}
-  .data          : AT (ADDR (.text) + SIZEOF (.text))
+  .data        : ${RELOCATING+ AT (ADDR (.text) + SIZEOF (.text))}
   {
     *(.data)
     *(.rodata)
     *(.rodata*)
     ${RELOCATING+ _edata = . ; }
   } ${RELOCATING+ > ram}
-  .bss  SIZEOF(.data) + ADDR(.data) :
+  .bss  ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
   {
     ${RELOCATING+ _bss_start = . ; }
     *(.bss)
   {
     *(.stabstr)
   }
+EOF
+
+. $srcdir/scripttempl/DWARF.sc
+
+cat <<EOF
 }
 EOF
 
 #as: --compress-debug-sections=none
 #ld: -r --compress-debug-sections=zlib-gnu
 #readelf: -SW
-#notarget: arc*-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-* i370-*-* i860-*-* iq2000-*-* mn10200-*-* moxie-*-* msp430-*-* mt-*-* or1k-*-* pj-*-*
+#notarget: arc*-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-* ft32-*-* i370-*-* i860-*-* iq2000-*-* mn10200-*-* moxie-*-* msp430-*-* mt-*-* or1k-*-* pj-*-*
 # Not all ELF targets use the elf.em emulation...
 
 #failif
 
 #source: init-fini-arrays.s
 #ld: -r
 #readelf: -S --wide
-#xfail: cr16-*-* crx-*-* msp430-*-*
+#xfail: cr16-*-* crx-*-* ft32-*-* msp430-*-*
 # msp430 puts the init_array and fini_array inside the .rodata section.
-# cr16 and crx use non-standard scripts with memory regions, which don't play
+# cr16, crx and ft32 use non-standard scripts with memory regions, which don't play
 #  well with unique group sections under ld -r.
 
 #...
 
 #xfail: "i370-*-*" "i860-*-*" "i960-*-*" "ip2k-*-*" "iq2000-*-*" "lm32-*-*"
 #xfail: "mcore-*-*" "mn102*-*-*" "ms1-*-*" "mep-*-*"
 #xfail: "or32-*-*" "pj-*-*" "sparc*-*-*" "tic6x-*-*" "vax-*-*" "xstormy16-*-*"
-#xfail: "xtensa*-*-*" "metag-*-*"
+#xfail: "xtensa*-*-*" "metag-*-*" "ft32-*-*"
 
 .*:     file format .*elf.*
 
 
 #source: orphan-region.s
 #ld: -T orphan-region.ld -N -z stack-size=0
 #readelf: -S -l --wide
-#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf ft32-*-* i860-*-* i960-*-*
 #xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* pj*-*-*
 #xfail: spu-*-* hppa*64*-*-* *-*-nacl*
 # if not using elf32.em, you don't get fancy orphan handling
 
 #source: orphan.s
 #ld: -T orphan.ld
 #readelf: -S --wide
-#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf ft32-*-* i860-*-* i960-*-*
 #xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* pj*-*-*
 # if not using elf32.em, you don't get fancy orphan handling
 
 
 #source: orphan3f.s
 #ld:
 #readelf: -S --wide
-#xfail: "d30v-*-*" "dlx-*-*" "fr30-*-*" "frv-*-elf"
+#xfail: "d30v-*-*" "dlx-*-*" "fr30-*-*" "frv-*-elf" "ft32-*-*"
 #xfail: "i860-*-*" "i960-*-*" "iq2000-*-*" "mn10200-*-*" "msp430-*-*" "mt-*-*"
 #xfail: "pj-*-*"
 #xfail: "xstormy16-*-*"
 
 #source: pr349-2.s
 #ld: -r
 #readelf: -S
-#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf ft32-*-* i860-*-* i960-*-*
 #xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* pj*-*-*
 # if not using elf32.em, you don't get fancy section handling
 
 
      || [istarget cr16-*-*]
      || [istarget crx-*-*]
      || [istarget dlx-*-*]
+     || [istarget ft32-*-*]
      || [istarget h8300-*-*]
      || [istarget i960-*-*]
      || [istarget ip2k-*-*]
 
     return
 }
 
-# m68hc11, m68hc12 and xgate run out of address space.
-if { [istarget "m68hc1*-*"] || [istarget "xgate-*"] } {
+# ft32, m68hc11, m68hc12 and xgate run out of address space.
+if {   [istarget "ft32-*-*"]
+    || [istarget "m68hc1*-*"]
+    || [istarget "xgate-*"] } {
     return
 }
 
 
 #warning: ^[^\\n]*\.[obj]+: warning: function 'Foo' used$
 #readelf: -s
 #notarget: "sparc64-*-solaris2*" "sparcv9-*-solaris2*"
-#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
+#xfail: d30v-*-* dlx-*-* fr30-*-* frv-*-elf ft32-*-* i860-*-* i960-*-*
 #xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* pj*-*-*
 # if not using elf32.em, you don't get fancy section handling
 
 
         && ![istarget dlx-*-*]
         && ![istarget epiphany-*-*]
         && ![istarget fr30-*-*]
+        && ![istarget ft32-*-*]
         && ![istarget frv-*-*]
         && ![istarget h8300-*-*]
         && ![istarget i860-*-*]