From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id DA1553857716 for ; Tue, 19 Sep 2023 08:13:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA1553857716 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-99de884ad25so714205066b.3 for ; Tue, 19 Sep 2023 01:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695111189; x=1695715989; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dZQZxKQoNK9zU1odMTCkdi/0OQCVucOZN2ZqOOL8ZW4=; b=X+kFYekdjMAa3hsNQpH7rbIzTfMGQbuD1OyjrLtH/fQRscT0HIiN6qbtIbQVfpk9w3 A3bhZsz7H4815MbqlRHOKO0vEY+LOKnpj3kbHVEYtf9j1iASJQGm/aGGx4I3GID69yNI k0kpOqRB22Y+tKOoLnLrvz8GxjdVRrS9utvfy6JTtNyX6cse/vBUYSYviZsobiNBE9kI 0wX7Fg9VAkwzaPhM7NmT2Ok4Ci5hTyBhGuDLPPD3AfE3f0dNbngwLjoCGWkXt5o/vWlZ IK/+eD34ptXbCQ3IcIFvmFuKtMJU80O63M/ZWu0v/O7tWTWe8okXWIFXDDH6axBnpcyR Ygkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695111189; x=1695715989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dZQZxKQoNK9zU1odMTCkdi/0OQCVucOZN2ZqOOL8ZW4=; b=QNjA5+0JHp6qohPNiQ8PflIL2PyBaj/1bm4G4Mqx5Guqky/zWNF7uJOCx11+Q/j15I wxBDQszigvTyXtYLZ5h5j56ATyn9GJSKdhjIk7YSIBTIbFvxK/1hvw709SlThitxVyZ3 +PnvDBJ8kFiX8ccrBjpD/y67Ip3wm1+mu7R+vfMU+dkuH0WuNNAw/7W2OkDM71v9SH68 i7VyfBCfombdqDWkD1kCqPDO1bEKcmJwkpQX3FcEuEA5iK77qf0+8Nle/6yka5OfYVji Oq6Kl68QtgXqYIGLFkyXJjGpKe20mqTtPCdRpgGngooQyzibbtLi6kXULpjaGKi1TyvE Eo3A== X-Gm-Message-State: AOJu0YwgLFMvYKHwIV38o6V0MWkw283r18A67DGBV0nrUVut2bKROuAA SANCAwXcW5D614MOpOi/FcIaRrgWDgs= X-Google-Smtp-Source: AGHT+IGb7dq0l6L5jWUmTAUp6HmdFejn4581gMkVwE6iMK8u2xE/rMpefNHhhMIsXwnh/shXhZV12w== X-Received: by 2002:a17:906:32d5:b0:9a5:da6c:6539 with SMTP id k21-20020a17090632d500b009a5da6c6539mr9464143ejk.75.1695111188808; Tue, 19 Sep 2023 01:13:08 -0700 (PDT) Received: from fatty.nomansland ([193.187.151.25]) by smtp.gmail.com with ESMTPSA id qx15-20020a170906fccf00b009a5f1d15644sm7359213ejb.119.2023.09.19.01.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 01:13:08 -0700 (PDT) From: Claudiu Zissulescu To: binutils@sourceware.org Cc: Claudiu Zissulescu Subject: [PATCH 2/7] arc: Add new LD tests for ARCv3. Date: Tue, 19 Sep 2023 11:12:45 +0300 Message-Id: <20230919081250.2496254-3-claziss@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230919081250.2496254-1-claziss@gmail.com> References: <20230919081250.2496254-1-claziss@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Claudiu Zissulescu Add new linker tests for ARCv3 ISA. All the new tests are added in a distinct new folder named arc64. ld/ xxxx-xx-xx Claudiu Zissulescu * ld/testsuite/ld-arc64/arcv3_64-reloc-near-exe.dd: New file. * ld/testsuite/ld-arc64/arcv3_64-reloc-near-so.dd: Likewise. * ld/testsuite/ld-arc64/arcv3_64-reloc-near.s: Likewise. * ld/testsuite/ld-arc64/arcv3_64.exp: Likewise. * ld/testsuite/ld-arc64/bl34.dd: Likewise. * ld/testsuite/ld-arc64/bl34.s: Likewise. * ld/testsuite/ld-arc64/linkscript.ld: Likewise. * ld/testsuite/ld-arc64/plt34-got.dd: Likewise. * ld/testsuite/ld-arc64/plt34-got.s: Likewise. * ld/testsuite/ld-arc64/plt34-reloc.dd: Likewise. * ld/testsuite/ld-arc64/plt34-reloc.s: Likewise. Signed-off-by: Claudiu Zissulescu --- .../ld-arc64/arcv3_64-reloc-near-exe.dd | 29 +++++++++++ .../ld-arc64/arcv3_64-reloc-near-so.dd | 21 ++++++++ ld/testsuite/ld-arc64/arcv3_64-reloc-near.s | 11 +++++ ld/testsuite/ld-arc64/arcv3_64.exp | 48 +++++++++++++++++++ ld/testsuite/ld-arc64/bl34.dd | 12 +++++ ld/testsuite/ld-arc64/bl34.s | 13 +++++ ld/testsuite/ld-arc64/linkscript.ld | 5 ++ ld/testsuite/ld-arc64/plt34-got.dd | 9 ++++ ld/testsuite/ld-arc64/plt34-got.s | 9 ++++ ld/testsuite/ld-arc64/plt34-reloc.dd | 12 +++++ ld/testsuite/ld-arc64/plt34-reloc.s | 14 ++++++ 11 files changed, 183 insertions(+) create mode 100644 ld/testsuite/ld-arc64/arcv3_64-reloc-near-exe.dd create mode 100644 ld/testsuite/ld-arc64/arcv3_64-reloc-near-so.dd create mode 100644 ld/testsuite/ld-arc64/arcv3_64-reloc-near.s create mode 100644 ld/testsuite/ld-arc64/arcv3_64.exp create mode 100644 ld/testsuite/ld-arc64/bl34.dd create mode 100644 ld/testsuite/ld-arc64/bl34.s create mode 100644 ld/testsuite/ld-arc64/linkscript.ld create mode 100644 ld/testsuite/ld-arc64/plt34-got.dd create mode 100644 ld/testsuite/ld-arc64/plt34-got.s create mode 100644 ld/testsuite/ld-arc64/plt34-reloc.dd create mode 100644 ld/testsuite/ld-arc64/plt34-reloc.s diff --git a/ld/testsuite/ld-arc64/arcv3_64-reloc-near-exe.dd b/ld/testsuite/ld-arc64/arcv3_64-reloc-near-exe.dd new file mode 100644 index 00000000000..2c77c412719 --- /dev/null +++ b/ld/testsuite/ld-arc64/arcv3_64-reloc-near-exe.dd @@ -0,0 +1,29 @@ +# an exemplary output +# +# test_static.exe: file format elf64-littlearc64 +# +# +# Disassembly of section .text: +# +# 0000000000001000 <__start>: +# 1000: 78e0 nop_s +# 1002: 2731 ff0e 0000 7000 ldl r14,[pcl,28672@s32] ;8000 <.got> +# 1006: R_ARC_GOTPC32 foo +# 100a: 2731 ff0f 0000 7000 ldl r15,[pcl,28672@s32] ;8008 <.got+0x8> +# 100e: R_ARC_GOTPC32 bar +# 1012: 78e0 nop_s +# 1014: 0000 0000 b 0 ;1014 <__start+0x14> + +[^:]+:\s+file format elf.*-.*arc64 + + +Disassembly of section .text: + +^[0-9a-f]+.*: +\s*[0-9a-f]+:\s+[0-9a-f\s]+nop_s +\s*[0-9a-f]+:\s+[0-9a-f\s]+ldl\s+r14,.* +\s*[0-9a-f]+:\s+R_ARC_GOTPC32\s+foo +\s*[0-9a-f]+:\s+[0-9a-f\s]+ldl\s+r15,.* +\s*[0-9a-f]+:\s+R_ARC_GOTPC32\s+bar +\s*[0-9a-f]+:\s+[0-9a-f\s]+nop_s +\s*[0-9a-f]+:.* diff --git a/ld/testsuite/ld-arc64/arcv3_64-reloc-near-so.dd b/ld/testsuite/ld-arc64/arcv3_64-reloc-near-so.dd new file mode 100644 index 00000000000..2b3cef9418e --- /dev/null +++ b/ld/testsuite/ld-arc64/arcv3_64-reloc-near-so.dd @@ -0,0 +1,21 @@ +# an exemplary output +# +# test_dynamic.so: file format elf64-littlearc64 +# +# +# Disassembly of section .got: +# +# 0000000000002440 <.got>: +# ... +# 2440: R_ARC_GLOB_DAT foo +# 2448: R_ARC_GLOB_DAT bar + +[^:]+:\s+file format elf.*-.*arc64 + + +Disassembly of section .got: + +^[0-9a-f]+.*: +\s*\.\.\. +\s*[0-9a-f]+:\s+R_ARC_GLOB_DAT\s+foo +\s*[0-9a-f]+:\s+R_ARC_GLOB_DAT\s+bar diff --git a/ld/testsuite/ld-arc64/arcv3_64-reloc-near.s b/ld/testsuite/ld-arc64/arcv3_64-reloc-near.s new file mode 100644 index 00000000000..1423f924414 --- /dev/null +++ b/ld/testsuite/ld-arc64/arcv3_64-reloc-near.s @@ -0,0 +1,11 @@ + .comm foo,4 + .comm bar,4 + + .text + .align 8 + + .global __start +__start: + nop_s # messing with the alignment a bit + ldl r14, [pcl, @foo@gotpc] + ldl r15, [pcl, @bar@gotpc] diff --git a/ld/testsuite/ld-arc64/arcv3_64.exp b/ld/testsuite/ld-arc64/arcv3_64.exp new file mode 100644 index 00000000000..d39483cd6dd --- /dev/null +++ b/ld/testsuite/ld-arc64/arcv3_64.exp @@ -0,0 +1,48 @@ +# Copyright (C) 2020 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 arc64-*-*] } { + return +} + +set arcv3_64_tests { + { "Near relocations (executable)" + "-q" "" "" {arcv3_64-reloc-near.s} + { { objdump { -Dr -j .text } arcv3_64-reloc-near-exe.dd } } + "arcv3_64-reloc.exe" } + { "Near relocations (shared object)" + "-shared -q -m arc64linux64" "" "" {arcv3_64-reloc-near.s} + { { objdump -DRj.got arcv3_64-reloc-near-so.dd } } + "arcv3_64-reloc-near.so" } + { "Solve fixed PLT34 reloc" + "-q -T linkscript.ld" "" "" {plt34-reloc.s} + { { objdump -drj.text plt34-reloc.dd } } + "plt34-reloc.x" } + { "Generate PLT entry using PLT34 reloc" + "-shared -m arc64linux64" "" "" {plt34-got.s} + { { objdump -dj.text plt34-got.dd } } + "plt34-got.so" } + { "Solve PCLO32_ME_2 reloc" + "-q -T linkscript.ld" "" "" {bl34.s} + { { objdump -drj.text bl34.dd } } + "bl34.x" } +} + +run_ld_link_tests $arcv3_64_tests diff --git a/ld/testsuite/ld-arc64/bl34.dd b/ld/testsuite/ld-arc64/bl34.dd new file mode 100644 index 00000000000..4f983ecae33 --- /dev/null +++ b/ld/testsuite/ld-arc64/bl34.dd @@ -0,0 +1,12 @@ +[^:]+:\s+file format elf64-.*arc64 + + +Disassembly of section .text: + +^[0-9a-f]+ <__start>: +^\s*[0-9a-f]+:\s+78e0\s+nop_s$ +^\s*[0-9a-f]+:\s+7be0\s4000\s0000\s+bl_s\s\d+@s32\s;100000000\s$ +^\s*[0-9a-f]+:\s+R_ARC_PCLO32_ME_2\s+\.text2$ +^\s*[0-9a-f]+:\s+7be0\s3fff\sfffe\s+bl_s\s\d+@s32\s;100000000\s$ +^\s*[0-9a-f]+:\s+R_ARC_PCLO32_ME_2\s+\.text2$ +^\s*[0-9a-f]+:\s+78e0\s+nop_s$ diff --git a/ld/testsuite/ld-arc64/bl34.s b/ld/testsuite/ld-arc64/bl34.s new file mode 100644 index 00000000000..dfda09133ca --- /dev/null +++ b/ld/testsuite/ld-arc64/bl34.s @@ -0,0 +1,13 @@ + .text + .align 4 + .global __start +__start: + nop_s + bl_s @foo@s32 + bl_s @foo@s32 + +;;; Have a symbol beyond 4G boundary. + .section ".foo.text" + .align 4 +foo: + add r0,r0,r0 diff --git a/ld/testsuite/ld-arc64/linkscript.ld b/ld/testsuite/ld-arc64/linkscript.ld new file mode 100644 index 00000000000..bddc653e29b --- /dev/null +++ b/ld/testsuite/ld-arc64/linkscript.ld @@ -0,0 +1,5 @@ +SECTIONS +{ + .text 0x00 : { *(.text) } + .text2 0x100000000 : { *(.foo.text) } +} diff --git a/ld/testsuite/ld-arc64/plt34-got.dd b/ld/testsuite/ld-arc64/plt34-got.dd new file mode 100644 index 00000000000..3f57f6a00ca --- /dev/null +++ b/ld/testsuite/ld-arc64/plt34-got.dd @@ -0,0 +1,9 @@ +[^:]+:\s+file format elf64-.*arc64 + + +Disassembly of section .text: + +^[0-9a-f]+ <__start>: +^\s*[0-9a-f]+:\s+78e0\s+nop_s$ +^\s*[0-9a-f]+:\s+[0-9a-f]+\s[0-9a-f]+\s+bl\s+[\-0-9]+\s+;[0-9a-f]+\s+<\.plt\+0x[0-9a-f]+>$ +^\s*[0-9a-f]+:\s+7be0\s[0-9a-f]+\s[0-9a-f]+\s+bl_s\s+[\-\d]+@s32\s+;[0-9a-f]+\s+<\.plt\+0x[0-9a-f]+>$ \ No newline at end of file diff --git a/ld/testsuite/ld-arc64/plt34-got.s b/ld/testsuite/ld-arc64/plt34-got.s new file mode 100644 index 00000000000..a74c3213dbb --- /dev/null +++ b/ld/testsuite/ld-arc64/plt34-got.s @@ -0,0 +1,9 @@ +;;; Check if 34bit reloc is correctly solved by the linker. + .text + .align 4 + .global __start +__start: + nop_s + bl @foo@plt + bl_s @foo@plt34 + diff --git a/ld/testsuite/ld-arc64/plt34-reloc.dd b/ld/testsuite/ld-arc64/plt34-reloc.dd new file mode 100644 index 00000000000..36427a5394f --- /dev/null +++ b/ld/testsuite/ld-arc64/plt34-reloc.dd @@ -0,0 +1,12 @@ +[^:]+:\s+file format elf64-.*arc64 + + +Disassembly of section .text: + +^[0-9a-f]+ <__start>: +^\s*[0-9a-f]+:\s+78e0\s+nop_s$ +^\s*[0-9a-f]+:\s+7be0\s4000\s0000\s+bl_s\s\d+@s32\s;100000000\s$ +^\s*[0-9a-f]+:\s+R_ARC_PLT34\s+foo$ +^\s*[0-9a-f]+:\s+7be0\s3fff\sfffe\s+bl_s\s\d+@s32\s;100000000\s$ +^\s*[0-9a-f]+:\s+R_ARC_PLT34\s+foo$ +^\s*[0-9a-f]+:\s+78e0\s+nop_s$ diff --git a/ld/testsuite/ld-arc64/plt34-reloc.s b/ld/testsuite/ld-arc64/plt34-reloc.s new file mode 100644 index 00000000000..2be4aaf51b6 --- /dev/null +++ b/ld/testsuite/ld-arc64/plt34-reloc.s @@ -0,0 +1,14 @@ +;;; Check if 34bit reloc is correctly solved by the linker. + .text + .align 4 + .global __start +__start: + nop_s + bl_s @foo@plt34 + bl_s @foo@plt34 + +;;; Have a symbol beyond 4G boundary. + .section ".foo.text" + .align 4 +foo: + add r0,r0,r0 -- 2.30.2