From patchwork Wed Jun 16 15:33:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 461413 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp763902jae; Wed, 16 Jun 2021 08:40:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+Iy/LSssL+ScZuxAQ8uzO4NQe2m3TgWO/qizuY25nIgbu7AwnJIx9OfXDSFoYYudF1iHf X-Received: by 2002:a17:906:edb3:: with SMTP id sa19mr133213ejb.75.1623858011576; Wed, 16 Jun 2021 08:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623858011; cv=none; d=google.com; s=arc-20160816; b=kJqqGRQADkFtCLaOHUJHyuxDCvWXTgBbdoHYOqzJYpW+irxFmjjdErXLS2C7CRXugS dMov2YTPzEwB5urxxbNn6dsRWxP228BUvAxuXOppPXB6Fsb7t080BTWz4avFF8GZ8klx FeRaRDP/R4KVb4fAU8tQqtHdJxDswElzIuqpGqxp9wYzlQU8XHuPbnUcuM1P0BU+MRh3 ol97/7UO2SYpQLXleuH2uGnKCff6NXP/Ehs6QnXld+k+7i6Spy0GxqGixWj2RWSO6gT5 WeSiE8AHVemeyj0teKvk3eHS5x5Khxvl8AQ8wLeHx/NEHkNSDXoKmGufzifxd1FnIU7l nBJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t+lY0Rb27heFCgJ4gSBzepHc3nokkLnoNlflqImi2YY=; b=Q0ARIZiDNKpslaPJ4MdKYSsBTC1+2Sa7sAJODFNPYLsakneZxFqN5qqamPcKZNMhxJ SYTTzr3COueSPkfK4bG7qFJUPIm/PQbWYkRWoZvlU4XCuXsQBRH7QuDPsSDYWJcSFvVT 1GtscQjBr9YcTH0yt6dECkH9jMFFq4AqtRsGzXGEeYtxBMXQVAOaCamU52XSoWn2RD/Q YePyqDUMmH1mviep6AGZTUrrcr0IJRzXmTOUIKbxvOZBXe7VmZyFIbLrVHvx2nP65Hl0 lWKweKKhw27txuvhDpm0ZG5M0BJ5Itr8dprsY05l5nRhGDSQjuGNhNTmWVYjetlpCtKK qNnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hSyyIf25; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e11si2602707ejm.421.2021.06.16.08.40.11; Wed, 16 Jun 2021 08:40:11 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hSyyIf25; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235542AbhFPPmN (ORCPT + 12 others); Wed, 16 Jun 2021 11:42:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:51404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235324AbhFPPkF (ORCPT ); Wed, 16 Jun 2021 11:40:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2674613F2; Wed, 16 Jun 2021 15:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623857837; bh=qdx3A4dL/aV5aO0z1JewHyWSwi8Q7i9bcnqPBVn6azs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hSyyIf25jYQa6ryxSpC8P1xaiUHsu/a17HhholcXkhpwaze9hUTu7+GXmQJOL/4x0 5lPiq7pqWiRrLFOJz+oYu+GuFDXyHGj+C06pgXkSbyFUgHdzBbsqlvqL7XCCPmMFzm SWIH/FGOGPgGPf77Ggx7comapTn7wLBxw9FTRTmY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khem Raj , Nathan Chancellor , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.12 26/48] riscv: Use -mno-relax when using lld linker Date: Wed, 16 Jun 2021 17:33:36 +0200 Message-Id: <20210616152837.474295346@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616152836.655643420@linuxfoundation.org> References: <20210616152836.655643420@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Khem Raj [ Upstream commit ec3a5cb61146c91f0f7dcec8b7e7157a4879a9ee ] lld does not implement the RISCV relaxation optimizations like GNU ld therefore disable it when building with lld, Also pass it to assembler when using external GNU assembler ( LLVM_IAS != 1 ), this ensures that relevant assembler option is also enabled along. if these options are not used then we see following relocations in objects 0000000000000000 R_RISCV_ALIGN *ABS*+0x0000000000000002 These are then rejected by lld ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax but the .o is already compiled with -mno-relax Signed-off-by: Khem Raj Reviewed-by: Nathan Chancellor Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.30.2 diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 1368d943f1f3..5243bf2327c0 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -38,6 +38,15 @@ else KBUILD_LDFLAGS += -melf32lriscv endif +ifeq ($(CONFIG_LD_IS_LLD),y) + KBUILD_CFLAGS += -mno-relax + KBUILD_AFLAGS += -mno-relax +ifneq ($(LLVM_IAS),1) + KBUILD_CFLAGS += -Wa,-mno-relax + KBUILD_AFLAGS += -Wa,-mno-relax +endif +endif + # ISA string setting riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima