From patchwork Thu Sep 4 13:04:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 225 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991159; bh=5sUkLUhrSIBFZbF0ciND4sDB9LJFFFkDxZMVA3IJG1M=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=SkEpYr30kIHbCun7RN2hcjMydA9HeWn2hUMD5UhAIltw5yvORm0/uu8vDPUkUkuty zaWdbeIAvm/oRUBrr3/NB2Pqzp7YVmflTsrqQaTGV807xSH6F/aIuYcBA4PnbjXgaq leiHEOKYMIqxIrrvDW/uqsO+oh7yV6ZA3mQa3WsUGq4+BAe2xC1IBVmV0wupEON8KJ fLhS8B3Rld1qOGiPv3hXYiJEPWL3AvgmZjS/hWhXZCoz79yo3rAeoT9ZDlwsp005Pi 4M/V0eCMoEjxEnv75oCbnNTwTDAb8FH1gIhZBb7f/aQYPt03xAWzYvGBqBBO8viEgJ 4zqHxYBllN01Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 87FA467961 for ; Thu, 4 Sep 2025 07:05:59 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id d9UJBJi6Qbiv for ; Thu, 4 Sep 2025 07:05:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991159; bh=5sUkLUhrSIBFZbF0ciND4sDB9LJFFFkDxZMVA3IJG1M=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=SkEpYr30kIHbCun7RN2hcjMydA9HeWn2hUMD5UhAIltw5yvORm0/uu8vDPUkUkuty zaWdbeIAvm/oRUBrr3/NB2Pqzp7YVmflTsrqQaTGV807xSH6F/aIuYcBA4PnbjXgaq leiHEOKYMIqxIrrvDW/uqsO+oh7yV6ZA3mQa3WsUGq4+BAe2xC1IBVmV0wupEON8KJ fLhS8B3Rld1qOGiPv3hXYiJEPWL3AvgmZjS/hWhXZCoz79yo3rAeoT9ZDlwsp005Pi 4M/V0eCMoEjxEnv75oCbnNTwTDAb8FH1gIhZBb7f/aQYPt03xAWzYvGBqBBO8viEgJ 4zqHxYBllN01Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 77D28678BF for ; Thu, 4 Sep 2025 07:05:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991157; bh=4DDg0QhRWbe/VXgCPP6eRBjplw6ft/Em/O6IawfUJts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hBUYfQqpYMw66dQjV0HDfu6q5Zy+95JAqBxN8XmlG4O+V4tCVIeqbpjLde7RkBnsZ GEfruLnxewz3C7kW7Xjbs/hdSnCv/2+AkQt8VHk3mkCcY7EULv/bYpHPuuwZK2lkgk gnnLmvZdrdclF3PWhB0QtLC27KxcfLIqOXaSiIPb6InqdAzK8Vzb5wYNzlbI2y3u7r 6YmkdKlnqaCEI98Ca9Egh336rmf5hBbPXgH4T/WuF+cB6l412ZPIDBovr+1uccGcXc rACA8A8ck+FHTG5ywQoAmYef6XgBplLAlBHBMroXkxrkhU3ZXQRo/ak5RTVN/Dcu0S dgCo+O6ZeALvw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B0C8267959; Thu, 4 Sep 2025 07:05:57 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 2P_wKP-bnuXj; Thu, 4 Sep 2025 07:05:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991153; bh=OBd8Y9GgA3W+gcJ/lB1d/87O+OrnUvWjS4lfeb1x6LI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ChjjghnmvL2YwImZgLOowkOeBCH1JW0zKSQbi+kz3rBTRSCI2QaTjPQvd5A4/ng7u 1Py8WHZEY/fGqlYUd4PR3xYBPfJOHURlzEDpCGy2cQ0cNABx3+ikd/AHFS5SYVpe9N b1CnoNNj9JaAa/LTioqYl57uV77o9QgRCJePXmAltu82Pz2ifuies0Vq1QsPrxlvgf daiBh+VPgeqjkXk0ZZezF+mviggcJFMHSBP/zWugR8xkP6mFEwjgA9q1JJHrB+V4AW /QuJGS/FNcZW2mAp/VhtOVPk9XQzUwbvcG7yTfaUj4lYhT33Tjo7ha6liVP+ZMh5KJ O9wbGvI9AYEDA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 077D6678BF; Thu, 4 Sep 2025 07:05:52 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 4 Sep 2025 07:04:44 -0600 Message-ID: <20250904130459.848794-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250904130459.848794-1-sjg@u-boot.org> References: <20250904130459.848794-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6QYJHWULSYKFG64BWDIHJ6BEH5YZUZLE X-Message-ID-Hash: 6QYJHWULSYKFG64BWDIHJ6BEH5YZUZLE X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/18] ulib: Add linker script for shared library build List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a proper linker script (u-boot-lib.lds) for building libu-boot.so to ensure correct section alignment and placement, particularly for the linker lists. Co-developed-by: Claude Signed-off-by: Simon Glass --- arch/sandbox/cpu/u-boot-lib.lds | 88 +++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 arch/sandbox/cpu/u-boot-lib.lds diff --git a/arch/sandbox/cpu/u-boot-lib.lds b/arch/sandbox/cpu/u-boot-lib.lds new file mode 100644 index 00000000000..f57292b0a8d --- /dev/null +++ b/arch/sandbox/cpu/u-boot-lib.lds @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2025 Canonical + * Written by Simon Glass + * + * Linker script for U-Boot shared library (libu-boot.so) + */ + +SECTIONS +{ + /* Text sections first */ + .text : { + *(.text*) + } + + . = ALIGN(32); + __u_boot_list : { + KEEP(*(SORT(__u_boot_list*))); + } + + _u_boot_sandbox_getopt : { + *(_u_boot_sandbox_getopt_start) + KEEP(*(_u_boot_sandbox_getopt)) + *(_u_boot_sandbox_getopt_end) + } + + efi_runtime : { + __efi_runtime_start = .; + *(efi_runtime_text) + *(efi_runtime_data) + __efi_runtime_stop = .; + } + + efi_runtime_rel : { + __efi_runtime_rel_start = .; + *(.relefi_runtime_text) + *(.relefi_runtime_data) + __efi_runtime_rel_stop = .; + } + + /* Read-only data */ + . = ALIGN(8); + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + + /* Data sections */ + . = ALIGN(8); + .data : { + *(.data*) + } + + /* BSS section */ + . = ALIGN(8); + .bss : { + __bss_start = .; + *(.bss*) + *(COMMON) + . = ALIGN(8); + __bss_end = .; + } + + /* Dynamic linking sections for shared library */ + .dynamic : { *(.dynamic) } + .dynsym : { + __dyn_sym_start = .; + *(.dynsym) + __dyn_sym_end = .; + } + .dynstr : { *(.dynstr) } + .gnu.hash : { *(.gnu.hash) } + .hash : { *(.hash) } + .got : { *(.got) } + .got.plt : { *(.got.plt) } + .plt : { *(.plt) } + .rela.dyn : { *(.rela.dyn) } + .rela.plt : { *(.rela.plt) } + + /* Debugging sections */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_ranges 0 : { *(.debug_ranges) } + .debug_line 0 : { *(.debug_line) } + .debug_str 0 : { *(.debug_str) } + .debug_frame 0 : { *(.debug_frame) } + .debug_loc 0 : { *(.debug_loc) } + + /DISCARD/ : { *(.note*) } +}