From patchwork Mon Aug 12 15:12:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 95694 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 943613858C35 for ; Mon, 12 Aug 2024 15:15:45 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 738FD3858C48 for ; Mon, 12 Aug 2024 15:12:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 738FD3858C48 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 738FD3858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723475577; cv=none; b=qwPgnKT5BLJ/hw2ig1JRfhpTFpPxZHc6HM8QeL2+bIbAspKhsKIlR0RzxUhF/DfgUjEH4RPJenSPDRoWYEf809WLtqchTpVl3f1oNwQYyX0Uy9cVAH40fUgPzc/kWAAcUUf0HcqYU6GXxc/qmuiTofRD3jXzBC6uVXwU9op/Zlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723475577; c=relaxed/simple; bh=REIhoEpqrWfIIPOvS2bbFbni3Yoz5DVIm5TYXVfDbNI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=yBwVApBshQKO4csNkfdpfydxAAgJRo4k7eoASXYxlQdjQnMI/QiHFFFeP+FSWyQCVzlilQR5n3afXtOVm4nttmDj3ZjOg3qBkkIIOiNx+bImTKaaItk3aWUjdY1NfK2ya2CfgQiKg8owX+ghe9/d0nvxwfQYxEHksmhJCHmHt3E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1ff4fa918afso25576265ad.1 for ; Mon, 12 Aug 2024 08:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723475573; x=1724080373; 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=/Svbbo/b0PIh260b41XqnsZFD2SNqLRens/rhBh7zx0=; b=ZLEBfmYSkCq+uIaLZADmT25WfZ0J2bmPR/qxU9RJ+HU8SajD33fptWmq/oaN9hRsAZ NuVXn+/5baEEqxT/BqvorDA2TyqHEaOjUKaB/F3Acz8foXlgsGFbGAsj4iRFDaSGZVl6 xJlxdN0BiAlYF92V9oGCW10Kqg/WPL90Or7hJminPBu4RC4LuFRH1vZPFKHrE7AiRvLq hMN01HfVV+7q/Hse7zQMpw+wpMyOVRVkkbs5yw4xV+6HpvtGOgJPEp6ajWrRLTIfStpy J2uZoYtoaf87DRwnuGx73Gb73soJ8Rvwdsebd/lMHIglMtCr6DXxubOBPYDz/aakhKf3 m4bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723475573; x=1724080373; 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=/Svbbo/b0PIh260b41XqnsZFD2SNqLRens/rhBh7zx0=; b=iVKZXSDzvTrwLeFe0ThmmJ3U6TF/5NNi7PhkjbqJRSDAwlQNWhqgd4t/3zgl0B8Ihf Cx7tzIJ71hRGGRdU7Gp0FU0qbWHXdQ/IJORC2bUWRhFjOLTJQvj8S0keqmMxn4t2/Adk uJ7fCe5NXRMppvHebVWPIOhuJNOjQ9dgnhoni5gEcj9LMCeqBZaQZxe50wazNSrHcEcL j4UVRjYwIZ07zV6ObI0huzOq6MJqaYmDaIsuQ7dq2/UFYNQmXKCX+LVaK4X0WFnc/QpH yB2htBOD0eDTHwMgCMwsDpGCcC4hpKAfCf0laPe32SL3/TsOFWyYUhCnSuLrVbSYsQLQ UnOw== X-Gm-Message-State: AOJu0YwOIaSD1/9uvITe2YM9jMy23jtyqsne18f9ZVnMD51nSU9P8P69 QiEXzuDhNDDtZ+un/04YHsxyEv599A9OK9BE4rOQsRUDToWXT+xrc1b3QRrK X-Google-Smtp-Source: AGHT+IHQAE/tlR+VyVCLIn/vKyZy1TTtQlc6xfHz7IOSJ3elOTLx0QMeTNWjR7IatMXvRPWyohea3g== X-Received: by 2002:a17:903:2301:b0:200:7d10:b88a with SMTP id d9443c01a7336-201ca1cb063mr6866775ad.56.1723475573158; Mon, 12 Aug 2024 08:12:53 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.56.169.70]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-200bb9b2d82sm39213695ad.146.2024.08.12.08.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:12:52 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 49863740768; Mon, 12 Aug 2024 08:12:51 -0700 (PDT) From: "H.J. Lu" To: binutils@sourceware.org Cc: nickc@redhat.com, jbeulich@suse.com Subject: [PATCH v3 3/3] gas: Add macro tests for PR gas/32073 Date: Mon, 12 Aug 2024 08:12:51 -0700 Message-ID: <20240812151251.2315001-4-hjl.tools@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240812151251.2315001-1-hjl.tools@gmail.com> References: <20240812151251.2315001-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3017.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org 1. Add a macro test with expression argument and a white space before argument added by C preprocessor. 2. Add a x86-64 specific macro test. PR gas/32073 * testsuite/gas/i386/x86-64-macro-1.d: New file. * testsuite/gas/i386/x86-64-macro-1.s: Likewise. * testsuite/gas/i386/x86-64.exp: Run x86-64-macro-1. * testsuite/gas/macros/arg1.d: New file. * testsuite/gas/macros/arg1.s: Likewise. * testsuite/gas/macros/macros.exp: Run arg1. Signed-off-by: H.J. Lu --- gas/testsuite/gas/i386/x86-64-macro-1.d | 11 +++++++++++ gas/testsuite/gas/i386/x86-64-macro-1.s | 9 +++++++++ gas/testsuite/gas/i386/x86-64.exp | 2 ++ gas/testsuite/gas/macros/arg1.d | 7 +++++++ gas/testsuite/gas/macros/arg1.s | 12 ++++++++++++ gas/testsuite/gas/macros/macros.exp | 2 ++ 6 files changed, 43 insertions(+) create mode 100644 gas/testsuite/gas/i386/x86-64-macro-1.d create mode 100644 gas/testsuite/gas/i386/x86-64-macro-1.s create mode 100644 gas/testsuite/gas/macros/arg1.d create mode 100644 gas/testsuite/gas/macros/arg1.s diff --git a/gas/testsuite/gas/i386/x86-64-macro-1.d b/gas/testsuite/gas/i386/x86-64-macro-1.d new file mode 100644 index 00000000000..586dbded1a4 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-macro-1.d @@ -0,0 +1,11 @@ +#as: -mrelax-relocations=yes +#objdump: -dwr + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: + +[a-f0-9]+: ff 15 00 00 00 00 call \*0x0\(%rip\) # 6 <_start\+0x6> 2: R_X86_64_GOTPCRELX acos-0x4 +#pass diff --git a/gas/testsuite/gas/i386/x86-64-macro-1.s b/gas/testsuite/gas/i386/x86-64-macro-1.s new file mode 100644 index 00000000000..20b4416195a --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-macro-1.s @@ -0,0 +1,9 @@ +# Test a white space before argument added by C preprocessor. + + .macro WRAPPER_IMPL_SSE2 callee + call *\ callee@GOTPCREL(%rip) + .endm + + .text +_start: + WRAPPER_IMPL_SSE2 acos diff --git a/gas/testsuite/gas/i386/x86-64.exp b/gas/testsuite/gas/i386/x86-64.exp index a14ed32727f..57cb4aa165a 100644 --- a/gas/testsuite/gas/i386/x86-64.exp +++ b/gas/testsuite/gas/i386/x86-64.exp @@ -698,6 +698,8 @@ if [is_elf_format] then { run_dump_test "x86-64-no-got" + run_dump_test "x86-64-macro-1" + run_dump_test "x86-64-addend" run_dump_test "x86-64-nop-3" run_dump_test "x86-64-nop-4" diff --git a/gas/testsuite/gas/macros/arg1.d b/gas/testsuite/gas/macros/arg1.d new file mode 100644 index 00000000000..0a9d8b10fdb --- /dev/null +++ b/gas/testsuite/gas/macros/arg1.d @@ -0,0 +1,7 @@ +#objdump: -s -j .data + +.*: .* + +Contents of section .data: + 0000 10111213 1415 ...... +#pass diff --git a/gas/testsuite/gas/macros/arg1.s b/gas/testsuite/gas/macros/arg1.s new file mode 100644 index 00000000000..1833ef24cbb --- /dev/null +++ b/gas/testsuite/gas/macros/arg1.s @@ -0,0 +1,12 @@ +# Test expression argument and a white space before argument added by +# C preprocessor. + + .macro test arg1, arg2, arg3 + .byte \arg1 + .byte \arg2 + .byte \ arg3 + .endm + + .data + test 0x10 + 0, 0x10 + 1, 0x10 + 2 + test 0x10 + 3, 0x10 + 4, 0x15 diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp index bb5d4abf25b..3e84902c65f 100644 --- a/gas/testsuite/gas/macros/macros.exp +++ b/gas/testsuite/gas/macros/macros.exp @@ -75,6 +75,8 @@ if { ![istarget tic30-*-*] } { run_list_test app6 "" } +run_dump_test arg1 + run_list_test badarg "" switch -glob $target_triplet {