linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: linux-mips@vger.kernel.org
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
	clang-built-linux@googlegroups.com,
	Fangrui Song <maskray@google.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2] MIPS: Truncate load-y into 32bit for 32bit kernel
Date: Tue,  7 Apr 2020 16:06:11 +0800	[thread overview]
Message-ID: <20200407080611.859256-1-jiaxun.yang@flygoat.com> (raw)
In-Reply-To: <20200405082451.694910-1-jiaxun.yang@flygoat.com>

LLD failed to link vmlinux with 64bit load address for 32bit ELF
while bfd will strip 64bit address into 32bit silently.
To fix LLD build, we should truncate load address provided by platform
into 32bit for 32bit kernel.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Fangrui Song <maskray@google.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>

--
V2: Take MaskRay's shell magic.
---
 arch/mips/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e1c44aed8156..f8fd3c39fb55 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -286,6 +286,9 @@ ifdef CONFIG_64BIT
       $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
     endif
   endif
+else
+	# Truncate address into 32-bit
+	load-y := 0x$(shell echo "$(load-y)" | rev | head -c 8 | rev)
 endif
 
 KBUILD_AFLAGS	+= $(cflags-y)
-- 
2.26.0.rc2



  parent reply	other threads:[~2020-04-07  8:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05  8:24 [PATCH] MIPS: malta: Set load address for 32bit kernel correctly Jiaxun Yang
2020-04-05 16:47 ` Maciej W. Rozycki
2020-04-05 16:53   ` Jiaxun Yang
2020-04-05 17:23     ` Maciej W. Rozycki
2020-04-06 10:57       ` YunQiang Su
2020-04-06 11:10         ` Jiaxun Yang
2020-04-06 16:43           ` Fangrui Song
2020-04-07  8:06 ` Jiaxun Yang [this message]
2020-04-07 17:21   ` [PATCH v2] MIPS: Truncate load-y into 32bit for 32bit kernel Nick Desaulniers
2020-04-07 18:00     ` Fangrui Song
2020-04-07 18:10     ` Maciej W. Rozycki
2020-04-10  9:06   ` [PATCH v3] MIPS: Truncate link address " Jiaxun Yang
2020-04-10 20:45     ` Kees Cook
2020-04-10 23:40       ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200407080611.859256-1-jiaxun.yang@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maskray@google.com \
    --cc=natechancellor@gmail.com \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).