From nobody Sun Feb 8 20:59:55 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7568540759B for ; Wed, 4 Feb 2026 12:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770209169; cv=none; b=nxn9t/WrDlmeB4omUh8/ppgbDmKcEK1acnXvpQDn2Bp45fA0d1tpqlx38F5fXXj0RBRE1zXlPx25O4lNjuAcixK+N6GowZlpDrGuWkAA1ek84aR4k6zXbO/L46EsieVmIsNp30SanM/tckAP75nzaXPFKq05CCwoKPss+yCAjtU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770209169; c=relaxed/simple; bh=opLHo4fm18mdrEX23VuwnVvQDJ+lI0n6ntdc8dyjZZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s4tmocy8EOdDUDZIp9J96Ytq3V3Y4hsUC7hP2B4JEUbCsYGuwHNfSEeNrvfA3RSn3BK6YRsSR16ldsxEl4a5qx7ZBeRNrErxXHennkkO0Z/DLodqlyiS9zlzWRsMLtfYcttniTugEZk5hFN+mRGDt9fp16JsBj4hz3DHpruBd9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thingy.jp; spf=pass smtp.mailfrom=0x0f.com; dkim=pass (1024-bit key) header.d=thingy.jp header.i=@thingy.jp header.b=PozJSE8N; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thingy.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=0x0f.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=thingy.jp header.i=@thingy.jp header.b="PozJSE8N" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-81ecbdfdcebso3723463b3a.1 for ; Wed, 04 Feb 2026 04:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thingy.jp; s=google; t=1770209169; x=1770813969; darn=vger.kernel.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=pNvWfRWqxUd/IFngJuH9rrMFeO8aVqebLe9MltDnISQ=; b=PozJSE8NZWyLNTv0jOjhBxtfY4Ydj42go49Ki/Dmwgs6YpZg4OvlY7YtXfL08Adn+P M5WVEnDvjOjJ+GXpc+kLJlmtPWQQOtgoWe7pb7Ot5Faf7L4tFDwZwGAqc/mLECW5R0Fc 8BlqR4F5LdeG2F7SDPzK4VA5pB7d6xZ2SX2dk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770209169; x=1770813969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pNvWfRWqxUd/IFngJuH9rrMFeO8aVqebLe9MltDnISQ=; b=I/RfYdUGyqX1+sO1foEPK4/8mEviPnLxrC8RixIgCBOUUXlDfBKgFH22bnHQOCywCY h8zgso72yc8zVOLwiJMlTU8QH0tR1dZo42KvsSwwkOVoaNbtq1IRmT+SEPXuuwToYqvp RBkfpxr1Xroupalf2H5F1S3CzTVNxr5Hhbn8ts+EZvbg81PUj3GeFEkz/MJExl4aBVyR tTdGHlYAy3IUOybIZrAVd31b55bxeqd8I4+oUPzJrr4OdnWtG5RdpqsNxw3PBqmZz0H6 DxNry4503eaBdeAUMMyU41VhmHvP13TVDP7zU890/2Wc6XQy/YW74xCmMxCLKkwpDLUW I7SA== X-Gm-Message-State: AOJu0Yz4gtRvjiZ7aRqARNimgvF3GcWZ0A4edFNwXl5NWCt0Rq0ofB5J LxzvPXfmGiUP03xgsfZg4B8xzXmkXYclcrOFhhjRlB44IlpLkVtpqUdSjz8279+/Cbc= X-Gm-Gg: AZuq6aLGPN+lxjmexzpe+CQm0GUb1XobYU96tJHxMvG0ENW9AkcqtVo/aSyiiojkrgP bJ14pBzB4SsQUnEIqAm1Q7ds0J7GUW2pUkO7huQhxeGRGSgq+CuGg28dWqJvZ7MS+SdhRcwr2RT SzzOqi2x/hhX8Jo9oQdqmrPsxrwvHf8OEPDfunAeLT9hBS8unZjf0qMsgd1IKLiZxwFilYhxvq/ 85F0tMQTCVWkVNJxGBPea0X6SEZYUWff6dzw1oWoL8+ZsdN3FYNtRXO3a3W84v/sR1zsOhfosgd PhnZQZO7j1dp7q505ej85rXHDIJfv096jrRCOqsLSTq2wB96mnyzQiPhcazKSFp86j0SVgEOWpo Pp7KnlaMWrL8JNryWAaZzmHtDbGm+Zd1WgyOKf0kYMDvk1bnNEIKoW7xgc16pfxWpnLuetCeaB7 /JWgjTztvIIk9BBHCjDNc1W1UCNemR0cHz0HUIK/vSbvlJwdpbGPNev2wDrJnJ7bcsh+20Cp++s w8R X-Received: by 2002:a05:6a21:6b85:b0:364:be7:6ffc with SMTP id adf61e73a8af0-393720db58dmr2966940637.18.1770209168747; Wed, 04 Feb 2026 04:46:08 -0800 (PST) Received: from kinako.work.home.arpa (p1490223-ipxg00b01sizuokaden.shizuoka.ocn.ne.jp. [153.223.134.223]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-354862effa6sm2378920a91.9.2026.02.04.04.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Feb 2026 04:46:08 -0800 (PST) From: Daniel Palmer To: w@1wt.eu, linux@weissschuh.net Cc: linux-kernel@vger.kernel.org, Daniel Palmer Subject: [RFC PATCH v2 04/10] tools/nolibc: m68k: Add relocation support Date: Wed, 4 Feb 2026 21:45:36 +0900 Message-ID: <20260204124542.523567-5-daniel@thingy.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260204124542.523567-1-daniel@thingy.jp> References: <20260204124542.523567-1-daniel@thingy.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for handling relocations on m68k. This also changes the branch to _start_c to be relative. This might break FLAT binaries so needs to be checked and probably wrapped in some #ifdef .. magic. Signed-off-by: Daniel Palmer --- tools/include/nolibc/arch-m68k.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/arch-m68k.h b/tools/include/nolibc/arch-m= 68k.h index 2a4fbada5e79..e82ff48d3fb8 100644 --- a/tools/include/nolibc/arch-m68k.h +++ b/tools/include/nolibc/arch-m68k.h @@ -10,8 +10,16 @@ #ifndef _NOLIBC_ARCH_M68K_H #define _NOLIBC_ARCH_M68K_H =20 +#include "elf.h" + +#ifdef R_68K_RELATIVE +#define _NOLIBC_ARCH_HAS_RELOC +#define _NOLIBC_ARCH_ELF32 +#endif + #include "compiler.h" #include "crt.h" +#include "reloc.h" =20 #define _NOLIBC_SYSCALL_CLOBBERLIST "memory" =20 @@ -129,12 +137,29 @@ }) =20 #ifndef NOLIBC_NO_RUNTIME + +#ifdef NOLIBC_WANT_RELOC +static __inline__ int __relocate_rela(unsigned long base, _nolibc_elf_rela= *entry) +{ + switch (_nolibc_elf_r_type(entry->r_info)) { + case R_68K_RELATIVE: + __relocate_rela_relative(base, entry); + break; + default: + return -1; + } + + return 0; +} +#endif /* NOLIBC_WANT_RELOC */ + void _start(void); void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protec= tor _start(void) { __asm__ volatile ( "movel %sp, %sp@-\n" - "jsr _start_c\n" + "lea _start_c(%pc), %a0\n" + "jsr (%a0)\n" ); __nolibc_entrypoint_epilogue(); } --=20 2.51.0