+2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
+
+ * testsuite/ld-xtensa/relax-static-defs.s: New file.
+ * testsuite/ld-xtensa/relax-static-local-pie.d: New file.
+ * testsuite/ld-xtensa/relax-static-local-shared.d: New file.
+ * testsuite/ld-xtensa/relax-static-local.s: New file.
+ * testsuite/ld-xtensa/relax-static-pie.d: New file.
+ * testsuite/ld-xtensa/relax-static-shared.d: New file.
+ * testsuite/ld-xtensa/relax-static.s: New file.
+ * testsuite/ld-xtensa/relax-undef-weak-local-pie.d: New file.
+ * testsuite/ld-xtensa/relax-undef-weak-local-shared.d: New file.
+ * testsuite/ld-xtensa/relax-undef-weak-local.s: New file.
+ * testsuite/ld-xtensa/relax-undef-weak-pie.d: New file.
+ * testsuite/ld-xtensa/relax-undef-weak-shared.d: New file.
+ * testsuite/ld-xtensa/relax-undef-weak.s: New file.
+ * testsuite/ld-xtensa/xtensa.exp: New file.
+
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* testsuite/ld-xtensa/xtensa.exp: Rename to xtensa-linux.exp.
--- /dev/null
+ .type fd,@function
+ .globl fd
+
+ .type fh,@function
+ .globl fh
+ .hidden fh
+
+ .type fp,@function
+ .globl fp
+ .protected fp
+
+ .type fi,@function
+ .globl fi
+ .internal fi
+
+ .text
+ .globl _start
+_start:
+ nop
+
+ .section ".text.f"
+ .align 4
+fd:
+ nop
+ .align 4
+fh:
+ nop
+ .align 4
+fp:
+ nop
+ .align 4
+fi:
+ nop
--- /dev/null
+#source: relax-static-local.s
+#source: relax-static-defs.s
+#ld: -pie
+#readelf: -r
+#...
+Relocation section '\.rela\.dyn' .* 6 .*
+#...
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+#failif
+#...
+Relocation section '\.rela\.plt' .*
+#...
--- /dev/null
+#source: relax-static-local.s
+#source: relax-static-defs.s
+#ld: -shared
+#readelf: -r
+#...
+Relocation section '\.rela\.dyn' .* 6 .*
+#...
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+#failif
+#...
+Relocation section '\.rela\.plt' .*
+#...
--- /dev/null
+ .text
+
+ movi a2, fh@plt
+ movi a2, fp@plt
+ movi a2, fi@plt
+
+ movi a2, fh
+ movi a2, fp
+ movi a2, fi
+
+ .section ".text.a"
+
+ movi a2, fh@plt
+ movi a2, fp@plt
+ movi a2, fi@plt
+
+ movi a2, fh
+ movi a2, fp
+ movi a2, fi
--- /dev/null
+#source: relax-static.s
+#source: relax-static-defs.s
+#ld: -pie
+#readelf: -r
+#...
+Relocation section '\.rela\.dyn' .* 2 .*
+#...
+.*R_XTENSA_RELATIVE.*
+.*R_XTENSA_RELATIVE.*
+#failif
+#...
+Relocation section '\.rela\.plt' .*
+#...
--- /dev/null
+#source: relax-static.s
+#source: relax-static-defs.s
+#ld: -shared
+#readelf: -r
+#...
+Relocation section '\.rela\.dyn' .* 3 .*
+#...
+.*R_XTENSA_RTLD.*
+.*R_XTENSA_RTLD.*
+.*R_XTENSA_GLOB_DAT.*fd.*
+#...
+Relocation section '\.rela\.plt' .* 1 .*
+#...
+.*R_XTENSA_JMP_SLOT.*fd.*
+#...
--- /dev/null
+ .text
+
+ movi a2, fd@plt
+ movi a2, fd
+
+ .section ".text.a"
+
+ movi a2, fd@plt
+ movi a2, fd
--- /dev/null
+#source: relax-undef-weak-local.s
+#ld: -pie
+#readelf: -r
+#...
+There are no relocations in this file.
+#...
--- /dev/null
+#source: relax-undef-weak-local.s
+#ld: -shared
+#readelf: -r
+#...
+There are no relocations in this file.
+#...
--- /dev/null
+ .type fp,@function
+ .weak fp
+ .protected fp
+
+ .type fh,@function
+ .weak fh
+ .hidden fh
+
+ .type fi,@function
+ .weak fi
+ .internal fi
+
+ .globl _start
+_start:
+ movi a5, fp@plt
+ movi a5, fh@plt
+ movi a5, fi@plt
+
+ movi a6, fp
+ movi a6, fh
+ movi a6, fi
+
+ .section ".text.a"
+a:
+ movi a5, fp@plt
+ movi a5, fh@plt
+ movi a5, fi@plt
+
+ movi a6, fp
+ movi a6, fh
+ movi a6, fi
--- /dev/null
+#source: relax-undef-weak.s
+#ld: -pie
+#readelf: -r
+#...
+There are no relocations in this file.
+#...
--- /dev/null
+#source: relax-undef-weak.s
+#ld: -shared
+#readelf: -r
+#...
+Relocation section '\.rela\.dyn' .* 3 .*
+#...
+.*R_XTENSA_RTLD.*
+.*R_XTENSA_RTLD.*
+.*R_XTENSA_GLOB_DAT.*fd.*
+#...
+Relocation section '\.rela\.plt' .* 1 .*
+#...
+.*R_XTENSA_JMP_SLOT.*fd.*
+#...
--- /dev/null
+ .type fd,@function
+ .weak fd
+
+ .globl _start
+_start:
+ movi a5, fd@plt
+ movi a6, fd
+
+ .section ".text.a"
+a:
+ movi a5, fd@plt
+ movi a6, fd
--- /dev/null
+# Expect script for ld-xtensa tests
+# Copyright (C) 2008-2018 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+if { !([istarget "xtensa*-*-*"]) } {
+ return
+}
+
+run_dump_test "relax-static-pie"
+run_dump_test "relax-static-local-pie"
+run_dump_test "relax-static-shared"
+run_dump_test "relax-static-local-shared"
+
+run_dump_test "relax-undef-weak-pie"
+run_dump_test "relax-undef-weak-local-pie"
+run_dump_test "relax-undef-weak-shared"
+run_dump_test "relax-undef-weak-local-shared"