From patchwork Sat Oct 28 10:32:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 738941 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp302028wrt; Sat, 28 Oct 2023 03:37:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdQj3BrmwRFkF3T2KnWN85SvAtwIMxbxlJruZd09WOlPEyo6qphtqfiwYcQoMqs2X4Xgd3 X-Received: by 2002:a05:622a:15cf:b0:418:af7:e00a with SMTP id d15-20020a05622a15cf00b004180af7e00amr6731898qty.21.1698489433665; Sat, 28 Oct 2023 03:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698489433; cv=none; d=google.com; s=arc-20160816; b=qVqZkBur0IlWCbIAXvoSTezsD2UEdqc7+EmdEaWSajAhIr5SqeSJ5w5MDRafUj9QP+ TkfF6evIDTRLjsD6F96nAz/6k4QIuYLWOTLq312DIPoraRpZeEHEg0QAm4dMX9RuwjtR 9Ieo6/VOTFDs0UN4st0zKw++NaZilH494WMR6Y7cyP6br9VpY/Sr9dlQvyF6Hjp7By9/ Po7dY03hdlUI9BYN2d9+s+50PFwcDn+6xURgoCCcOk/tu/ayw6a9bpQrMCfFPKTN64M9 Mbtvt0cO2tDv7iOEcKLxQXyXZFisSa8UllRbF/nWlRTe11Kgieyc7wplDUFDcbgGTzUQ 7neQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=maGo4SQ2Nh/uMnXYztWkxCmfjY3u1YXmSOVeK9kBr3c=; fh=nJM5jO7eiVNcYdEhmlCXCeK22LQiGBuZV7XYo+7hMdc=; b=apoEXaVqJEMAVVYzvtZVuVFZTUvq0gl7HTbu+iN/7Gj94YHsFu2TRIwtG2UAsw46RL lzjbqnqnDpv3yDdx2h+BA2nV1817VpGft1kLWRq6jl8NUy8HuAc0vthKYPxfHv3ipXOR dPQJoE9fMaOxXAaPBINI+q/KbgcasaMemfG2xFZ3IUGtWd7wA9HFDWsLl7NSQK5tto9s HUMK5bBnuKpr5nIQ3YO/8nDwOfjVC8Z+aN6MGLPSurkUmn/hDEK/1jS/CobNTy+zxGLF qSoZsJojXhQE4G1XsVDwhOY74EWXQu53owF11D2QfguPsBCImQoeJcpqdax3ZARnWAXN qrRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BvCtYU81; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c3-20020ac85a83000000b004198ca3515bsi2013220qtc.310.2023.10.28.03.37.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Oct 2023 03:37:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BvCtYU81; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwgdM-0006L5-1i; Sat, 28 Oct 2023 06:33:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qwgdF-0006El-FX for qemu-devel@nongnu.org; Sat, 28 Oct 2023 06:33:29 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwgd6-00038s-7f for qemu-devel@nongnu.org; Sat, 28 Oct 2023 06:33:29 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4083740f92dso22744745e9.3 for ; Sat, 28 Oct 2023 03:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698489193; x=1699093993; darn=nongnu.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=maGo4SQ2Nh/uMnXYztWkxCmfjY3u1YXmSOVeK9kBr3c=; b=BvCtYU81hoRd6YnGZtDkgSxAwQ6Qjd7EEKG16HQTINlyaALDCW0AeU+0pdPH/s+oG3 4ePw2bjVBYdLp/TLC3HELS6C0wPNIqn/SvMRClMt8I1IMj0JdpiH7btIGyCYD5gYVOca fAL3rHn4mYa35tmPs1B7Iw/JsVfbD5+geomBFtAFq0MNeLo+xmp4LD77QdEIEAUUziSq cKLnI1z/SVDoJRubaIdLjeodi1sUeVeSBQVe+xYUyZUDMy5FFdq4/J9btfA63o7r4YOf f4rpOBTPh5mBdCVNiXbgIt0Z1eiK31bTrcLd6CbjS4q1go3bWqo4XqED1N5e3PQvItIG 2jDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698489193; x=1699093993; 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=maGo4SQ2Nh/uMnXYztWkxCmfjY3u1YXmSOVeK9kBr3c=; b=I/Fbo31A+nX0o/ZqQ8Bvapzn9K2GL0FkS1tSNmMu3JVHkj07MbUy6R/G6i7x4LUj4n 5pSTyTcn+RtfhnaM4hBfXAI0lymwtnKHwhArreYVrnERbaFA3NtfAxWrb9L7dZNCfvEZ TIYXXHKgiFKXWED3Ol0eEYpzKWIP8HDQwdt3Yl+WxoQAsIlH4jeSZJswgvkN+amkDvuO ttF1p+49hT82b7T18Labu8UXQHUXm6Obabd5KHOdLSq09KPbAF+dYKIyGBBJS5uAhU3T vQqETD8WrKm/LnudHoeh9yMxcgHWf4MZdwSy3Ayqmy4hNusQe8TPw9wBjN1jkj3hHqUT v/HA== X-Gm-Message-State: AOJu0YwRJcEWuVPmAN6akrf9oS71s0evmyvU1Nw9tuGL5OLKYYaw3hMw aMNdDfXqMaRpoq51Z6nBFDaLUQ== X-Received: by 2002:a05:600c:4f55:b0:408:3707:b199 with SMTP id m21-20020a05600c4f5500b004083707b199mr4073665wmq.3.1698489193301; Sat, 28 Oct 2023 03:33:13 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id y20-20020a1c4b14000000b0040588d85b3asm7021327wma.15.2023.10.28.03.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 03:33:13 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2E37F5F798; Sat, 28 Oct 2023 11:33:12 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Mahmoud Mandour , Brian Cain , Paolo Bonzini , Warner Losh , Eduardo Habkost , Alexandre Iooss , "Edgar E. Iglesias" , Kyle Evans , qemu-arm@nongnu.org, Aleksandar Rikalo , Aurelien Jarno , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Richard Henderson , Wainer dos Santos Moschetta , Peter Maydell , Brad Smith , Jiaxun Yang , Thomas Huth , Akihiko Odaki Subject: [PATCH 02/17] tests/tcg: Add -fno-stack-protector Date: Sat, 28 Oct 2023 11:32:56 +0100 Message-Id: <20231028103311.347104-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231028103311.347104-1-alex.bennee@linaro.org> References: <20231028103311.347104-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Akihiko Odaki Message-Id: <20230731091042.139159-3-akihiko.odaki@daynix.com> [AJB: fix comment string typo] Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- tests/tcg/mips/hello-mips.c | 4 ++-- tests/tcg/Makefile.target | 2 +- tests/tcg/aarch64/Makefile.target | 2 +- tests/tcg/arm/Makefile.target | 2 +- tests/tcg/cris/Makefile.target | 2 +- tests/tcg/hexagon/Makefile.target | 2 +- tests/tcg/i386/Makefile.target | 2 +- tests/tcg/minilib/Makefile.target | 2 +- tests/tcg/mips/Makefile.target | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/tcg/mips/hello-mips.c b/tests/tcg/mips/hello-mips.c index 4e1cf501af..38e22d00e3 100644 --- a/tests/tcg/mips/hello-mips.c +++ b/tests/tcg/mips/hello-mips.c @@ -5,8 +5,8 @@ * http://www.linux-mips.org/wiki/MIPSABIHistory * http://www.linux.com/howtos/Assembly-HOWTO/mips.shtml * -* mipsel-linux-gcc -nostdlib -mno-abicalls -fno-PIC -mabi=32 \ -* -O2 -static -o hello-mips hello-mips.c +* mipsel-linux-gcc -nostdlib -mno-abicalls -fno-PIC -fno-stack-protector \ +* -mabi=32 -O2 -static -o hello-mips hello-mips.c * */ #define __NR_SYSCALL_BASE 4000 diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index f3a189c9d4..8cf65f68dd 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -123,7 +123,7 @@ else # For system targets we include a different Makefile fragment as the # build options for bare programs are usually pretty different. They # are expected to provide their own build recipes. -EXTRA_CFLAGS += -ffreestanding +EXTRA_CFLAGS += -ffreestanding -fno-stack-protector -include $(SRC_PATH)/tests/tcg/minilib/Makefile.target -include $(SRC_PATH)/tests/tcg/multiarch/system/Makefile.softmmu-target -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.softmmu-target diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index 62b38c792f..0c84b61ae0 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -53,7 +53,7 @@ endif # bti-1 tests the elf notes, so we require special compiler support. ifneq ($(CROSS_CC_HAS_ARMV8_BTI),) AARCH64_TESTS += bti-1 bti-3 -bti-1 bti-3: CFLAGS += -mbranch-protection=standard +bti-1 bti-3: CFLAGS += -fno-stack-protector -mbranch-protection=standard bti-1 bti-3: LDFLAGS += -nostdlib endif # bti-2 tests PROT_BTI, so no special compiler support required. diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 0038cef02c..3473f4619e 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -12,7 +12,7 @@ float_madds: CFLAGS+=-mfpu=neon-vfpv4 # Basic Hello World ARM_TESTS = hello-arm -hello-arm: CFLAGS+=-marm -ffreestanding +hello-arm: CFLAGS+=-marm -ffreestanding -fno-stack-protector hello-arm: LDFLAGS+=-nostdlib # IWMXT floating point extensions diff --git a/tests/tcg/cris/Makefile.target b/tests/tcg/cris/Makefile.target index 43587d2769..713e2a5b6c 100644 --- a/tests/tcg/cris/Makefile.target +++ b/tests/tcg/cris/Makefile.target @@ -30,7 +30,7 @@ AS = $(CC) -x assembler-with-cpp LD = $(CC) # we rely on GCC inline:ing the stuff we tell it to in many places here. -CFLAGS = -Winline -Wall -g -O2 -static +CFLAGS = -Winline -Wall -g -O2 -static -fno-stack-protector NOSTDFLAGS = -nostartfiles -nostdlib ASFLAGS += -mcpu=v10 -g -Wa,-I,$(SRC_PATH)/tests/tcg/cris/bare CRT_FILES = crt.o sys.o diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile.target index 87ed2c90b9..f839b2c0d5 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -19,7 +19,7 @@ EXTRA_RUNS = CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal -CFLAGS += -fno-unroll-loops +CFLAGS += -fno-unroll-loops -fno-stack-protector HEX_SRC=$(SRC_PATH)/tests/tcg/hexagon VPATH += $(HEX_SRC) diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index fdf757c6ce..3dec7c6c42 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -35,7 +35,7 @@ run-test-aes: QEMU_OPTS += -cpu max # # hello-i386 is a barebones app # -hello-i386: CFLAGS+=-ffreestanding +hello-i386: CFLAGS+=-ffreestanding -fno-stack-protector hello-i386: LDFLAGS+=-nostdlib # test-386 includes a couple of additional objects that need to be diff --git a/tests/tcg/minilib/Makefile.target b/tests/tcg/minilib/Makefile.target index c821d2806a..af0bf54be9 100644 --- a/tests/tcg/minilib/Makefile.target +++ b/tests/tcg/minilib/Makefile.target @@ -12,7 +12,7 @@ SYSTEM_MINILIB_SRC=$(SRC_PATH)/tests/tcg/minilib MINILIB_SRCS=$(wildcard $(SYSTEM_MINILIB_SRC)/*.c) MINILIB_OBJS=$(patsubst $(SYSTEM_MINILIB_SRC)/%.c, %.o, $(MINILIB_SRCS)) -MINILIB_CFLAGS+=-nostdlib -ggdb -O0 +MINILIB_CFLAGS+=-nostdlib -fno-stack-protector -ggdb -O0 MINILIB_INC=-isystem $(SYSTEM_MINILIB_SRC) .PRECIOUS: $(MINILIB_OBJS) diff --git a/tests/tcg/mips/Makefile.target b/tests/tcg/mips/Makefile.target index 1a994d5525..5d17c1706e 100644 --- a/tests/tcg/mips/Makefile.target +++ b/tests/tcg/mips/Makefile.target @@ -14,6 +14,6 @@ MIPS_TESTS=hello-mips TESTS += $(MIPS_TESTS) -hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -mabi=32 +hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -fno-stack-protector -mabi=32 hello-mips: LDFLAGS+=-nostdlib endif