From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1923) id 2C835384F6E6; Thu, 17 Nov 2022 22:26:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C835384F6E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668724010; bh=C78MurYDj7feRIomoaxXq3TfahakTbhGfuKiU28p8rs=; h=From:To:Subject:Date:From; b=YJPjxtRHK8eC4L70vsLzKLH1R3W7FSZpSnmuNyTXw+73UiYT4do1jhNDBC58OrjUd wUkPa/xkBwbMmYDxd7DefN9gyiHtRn3piNOIIngy1O30W5hWc4Hkj7tgzdSp9dxNZo ShtubFnij/jlFvH/qdFB/cUMrRYPLWbaw7UCv4n8= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Philipp Tomsich To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/vrull/heads/for-upstream)] RISC-V: Use .p2align for code-alignment X-Act-Checkin: gcc X-Git-Author: Philipp Tomsich X-Git-Refname: refs/vendors/vrull/heads/for-upstream X-Git-Oldrev: 742a2b526cf47502f7a39f0e01e9b98ebc40b45f X-Git-Newrev: b988c88f53490e7e719535c926abefdcc3ae11c5 Message-Id: <20221117222650.2C835384F6E6@sourceware.org> Date: Thu, 17 Nov 2022 22:26:50 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b988c88f53490e7e719535c926abefdcc3ae11c5 commit b988c88f53490e7e719535c926abefdcc3ae11c5 Author: Philipp Tomsich Date: Wed Mar 16 22:28:11 2022 +0100 RISC-V: Use .p2align for code-alignment RISC-V's .p2align (currently) ignores the max-skip argument. As we have experimental patches underway to address this in a backwards-compatible manner, let's prepare GCC for the day when binutils gets updated. gcc/ChangeLog: * config/riscv/riscv.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Implement. Series-to: gcc-patches@gcc.gnu.org Series-cc: Palmer Dabbelt Series-cc: Vineet Gupta Series-cc: Christoph Muellner Series-cc: Kito Cheng Series-cc: Jeff Law Diff: --- gcc/config/riscv/riscv.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index 2d0d170645c..c216173cf6b 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -938,6 +938,24 @@ typedef struct { fprintf (STREAM, "\t.word\t%sL%d-%sL%d\n", \ LOCAL_LABEL_PREFIX, VALUE, LOCAL_LABEL_PREFIX, REL) +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN +/* Support for -falign-* switches. Use .p2align to ensure that code + sections are padded with NOP instructions, rather than zeros. */ +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ + do \ + { \ + if ((LOG) != 0) \ + { \ + if ((MAX_SKIP) == 0) \ + fprintf ((FILE), "\t.p2align %d\n", (int) (LOG)); \ + else \ + fprintf ((FILE), "\t.p2align %d,,%d\n", \ + (int) (LOG), (int) (MAX_SKIP)); \ + } \ + } while (0) + +#endif /* HAVE_GAS_MAX_SKIP_P2ALIGN */ + /* This is how to output an assembler line that says to advance the location counter to a multiple of 2**LOG bytes. */