From patchwork Fri Jun 23 12:54:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 1798982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cLfEcoi9; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cLfEcoi9; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qncfl4kTxz20XB for ; Fri, 23 Jun 2023 22:55:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cLfEcoi9; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cLfEcoi9; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Qncfl3YCpz3bmQ for ; Fri, 23 Jun 2023 22:55:43 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cLfEcoi9; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cLfEcoi9; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=thuth@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QncdN5wvFz30K8 for ; Fri, 23 Jun 2023 22:54:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687524870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f9FlVKICNiWWOTLAUDVXkMHSMxYT88XK2ozTojvfz0A=; b=cLfEcoi9hM3Xn6/BrdEetOO9C78pEDT5Im2VvFEff7yaG9gZVT5hMiy+IoHleuabxRKMBL caoBqM03l0k0o4B+3Hg1ujhzJq5BAt2GPUOfqWf8ePRT6ryWrOf60rZP1ujxT1qt0XcFqi aC0rIOy2WTrfglmwoJhX87nsNP0fo98= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687524870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f9FlVKICNiWWOTLAUDVXkMHSMxYT88XK2ozTojvfz0A=; b=cLfEcoi9hM3Xn6/BrdEetOO9C78pEDT5Im2VvFEff7yaG9gZVT5hMiy+IoHleuabxRKMBL caoBqM03l0k0o4B+3Hg1ujhzJq5BAt2GPUOfqWf8ePRT6ryWrOf60rZP1ujxT1qt0XcFqi aC0rIOy2WTrfglmwoJhX87nsNP0fo98= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-rj93KqrSNS6LOwWJEI-KbQ-1; Fri, 23 Jun 2023 08:54:24 -0400 X-MC-Unique: rj93KqrSNS6LOwWJEI-KbQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DAB3E3C11CD3; Fri, 23 Jun 2023 12:54:23 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEF0CF41C8; Fri, 23 Jun 2023 12:54:21 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , =?utf-8?q?Nico?= =?utf-8?q?_B=C3=B6hr?= , Claudio Imbrenda , Janosch Frank , Andrew Jones Subject: [kvm-unit-tests PATCH 1/2] Rework the common LDFLAGS to become more useful again Date: Fri, 23 Jun 2023 14:54:15 +0200 Message-Id: <20230623125416.481755-2-thuth@redhat.com> In-Reply-To: <20230623125416.481755-1-thuth@redhat.com> References: <20230623125416.481755-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvmarm@lists.linux.dev, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Laurent Vivier , David Hildenbrand Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently the LDFLAGS settings from the main Makefile are ignored in most architecture specific directories (except s390x), which is very confusing when you try to add a linker switch for all architectures. Let's change this so that all architectures extend the common LDFLAGS instead of replacing them. So it is sufficient now to specify the "-nostdlib" switch in the main Makefile now instead of repeating it everywhere. While we're at it, avoid to repeat the whole set of CFLAGS in the common LDFLAGS - the options that are meant for the C compiler should not be exposed unconditionally to the linker. Signed-off-by: Thomas Huth --- Makefile | 2 +- arm/Makefile.common | 2 +- powerpc/Makefile.common | 2 +- s390x/Makefile | 2 +- x86/Makefile.common | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 6ed5deac..0e5d85a1 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -LDFLAGS += $(CFLAGS) +LDFLAGS += -nostdlib $(libcflat): $(cflatobjs) $(AR) rcs $@ $^ diff --git a/arm/Makefile.common b/arm/Makefile.common index 1bbec64f..e2cb1a56 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -60,7 +60,7 @@ libeabi = lib/arm/libeabi.a eabiobjs = lib/arm/eabi_compat.o FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libeabi) -%.elf: LDFLAGS = -nostdlib $(arch_LDFLAGS) +%.elf: LDFLAGS += $(arch_LDFLAGS) %.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o) $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c \ -DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS) diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common index 8ce00340..f8f47490 100644 --- a/powerpc/Makefile.common +++ b/powerpc/Makefile.common @@ -49,7 +49,7 @@ OBJDIRS += lib/powerpc FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) -%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie -n +%.elf: LDFLAGS += $(arch_LDFLAGS) -pie -n %.elf: %.o $(FLATLIBS) $(SRCDIR)/powerpc/flat.lds $(cstart.o) $(reloc.o) $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c \ -DPROGNAME=\"$@\" diff --git a/s390x/Makefile b/s390x/Makefile index a80db538..d75e86c2 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -76,7 +76,7 @@ CFLAGS += -O2 CFLAGS += -march=zEC12 CFLAGS += -mbackchain CFLAGS += -fno-delete-null-pointer-checks -LDFLAGS += -nostdlib -Wl,--build-id=none +LDFLAGS += -Wl,--build-id=none # We want to keep intermediate files .PRECIOUS: %.o %.lds diff --git a/x86/Makefile.common b/x86/Makefile.common index 365e199f..e64aac52 100644 --- a/x86/Makefile.common +++ b/x86/Makefile.common @@ -31,7 +31,7 @@ endif OBJDIRS += lib/x86 -$(libcflat): LDFLAGS += -nostdlib $(arch_LDFLAGS) +$(libcflat): LDFLAGS += $(arch_LDFLAGS) $(libcflat): CFLAGS += -ffreestanding -I $(SRCDIR)/lib -I lib COMMON_CFLAGS += -m$(bits) @@ -62,7 +62,7 @@ else # We want to keep intermediate file: %.elf and %.o .PRECIOUS: %.elf %.o -%.elf: LDFLAGS = -nostdlib $(arch_LDFLAGS) +%.elf: LDFLAGS += $(arch_LDFLAGS) %.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o) $(LD) $(LDFLAGS) -T $(SRCDIR)/x86/flat.lds -o $@ \ $(filter %.o, $^) $(FLATLIBS) From patchwork Fri Jun 23 12:54:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 1798983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UZmqge38; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UZmqge38; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qncgk4PtVz20XB for ; Fri, 23 Jun 2023 22:56:34 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UZmqge38; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UZmqge38; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Qncgk1W93z3btX for ; Fri, 23 Jun 2023 22:56:34 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UZmqge38; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UZmqge38; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=thuth@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Qncdl4tgQz3bmp for ; Fri, 23 Jun 2023 22:54:51 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687524888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rMJsEqZxFDEiOpUmf5NTUaCgnapiJoAxYbiFoSk82wQ=; b=UZmqge38PD/Glp2nnW7D0nuwZy+cC4HwY86QtQFR1c4Og3EzMRUM+S7lGnqAIHNYoDlX2z wGc/PhstdCHxkuuE8GYylJvsG/xOgYCj+HnYbXMH+qIqp6kVPzbNGnCfGxRGzCzy07tMTh D4FJplMgg5gjhsd1yvTikHcDIP+7xCU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687524888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rMJsEqZxFDEiOpUmf5NTUaCgnapiJoAxYbiFoSk82wQ=; b=UZmqge38PD/Glp2nnW7D0nuwZy+cC4HwY86QtQFR1c4Og3EzMRUM+S7lGnqAIHNYoDlX2z wGc/PhstdCHxkuuE8GYylJvsG/xOgYCj+HnYbXMH+qIqp6kVPzbNGnCfGxRGzCzy07tMTh D4FJplMgg5gjhsd1yvTikHcDIP+7xCU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-UhauKGHCN2CMcbORgDFUJg-1; Fri, 23 Jun 2023 08:54:43 -0400 X-MC-Unique: UhauKGHCN2CMcbORgDFUJg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 965728CC200; Fri, 23 Jun 2023 12:54:42 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2AD80F5AC5; Fri, 23 Jun 2023 12:54:24 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , =?utf-8?q?Nico?= =?utf-8?q?_B=C3=B6hr?= , Claudio Imbrenda , Janosch Frank , Andrew Jones Subject: [kvm-unit-tests PATCH 2/2] Link with "-z noexecstack" to avoid warning from newer versions of ld Date: Fri, 23 Jun 2023 14:54:16 +0200 Message-Id: <20230623125416.481755-3-thuth@redhat.com> In-Reply-To: <20230623125416.481755-1-thuth@redhat.com> References: <20230623125416.481755-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvmarm@lists.linux.dev, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Laurent Vivier , David Hildenbrand Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Newer versions of ld (from binutils 2.40) complain on s390x and x86: ld: warning: s390x/cpu.o: missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker We can silence these warnings by using "-z noexecstack" for linking (which should not have any real influence on the kvm-unit-tests since the information from the ELF header is not used here anyway, so it's just cosmetics). Signed-off-by: Thomas Huth --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0e5d85a1..20f7137c 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ CFLAGS += -Woverride-init -Wmissing-prototypes -Wstrict-prototypes autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -LDFLAGS += -nostdlib +LDFLAGS += -nostdlib -z noexecstack $(libcflat): $(cflatobjs) $(AR) rcs $@ $^