From patchwork Tue Sep 9 15:18:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 272 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=1757431166; bh=ARcPXS4Jc2ZlSWlNQ/qrvEvOj7Jf2T50KucGY/1822c=; 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=dxmjvpVhkzCTExjPl8SxVZfxbgr9GUbCY1S3GWrERIyE+xQEsv7rom3LpsETP83Xl tJKHVwWmRsNk6ytvJ6EFSbElBX2J0KmTEkdZZ0aj8QakuymxrGyD9m7gb4kaPQtC5h 7b88eOMLKEEuuCH3jRQKZQ5C9phjWXxt9Uck7m+Ti3gOo05Rj/50NCtyYFE8T+ZL// dqu2OIwg3lMgvJyN3rYVU5GJFbsSkyke/7iJ7oObPxUvRCHbWpwOu+kQ5XECZuCyTO +medBf1P1LQp63mX9QctoS26awrnG+xyrLwrkO9xrqUnzi0uaRUrr/NBFJSzXnt75l UP64Cx7JQD6SA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1371667A83 for ; Tue, 9 Sep 2025 09:19:26 -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 Kc-a7Lw0yB0R for ; Tue, 9 Sep 2025 09:19:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757431166; bh=ARcPXS4Jc2ZlSWlNQ/qrvEvOj7Jf2T50KucGY/1822c=; 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=dxmjvpVhkzCTExjPl8SxVZfxbgr9GUbCY1S3GWrERIyE+xQEsv7rom3LpsETP83Xl tJKHVwWmRsNk6ytvJ6EFSbElBX2J0KmTEkdZZ0aj8QakuymxrGyD9m7gb4kaPQtC5h 7b88eOMLKEEuuCH3jRQKZQ5C9phjWXxt9Uck7m+Ti3gOo05Rj/50NCtyYFE8T+ZL// dqu2OIwg3lMgvJyN3rYVU5GJFbsSkyke/7iJ7oObPxUvRCHbWpwOu+kQ5XECZuCyTO +medBf1P1LQp63mX9QctoS26awrnG+xyrLwrkO9xrqUnzi0uaRUrr/NBFJSzXnt75l UP64Cx7JQD6SA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0294E60026 for ; Tue, 9 Sep 2025 09:19:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757431164; bh=+J/+X2QZEJU2g0yPSTaGKQkV2BQuAI1Av4VhRA/MKeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsCB6nBCwBntqZJES7Dk+saGs3K2jQe+Uu4isyqG9dO9FyMwt/XiB+d3d5qdLjtrw azkC99XkMnt2fE8WZr3iCfhVgFlM0msOrt1y03WcBZgDZQhOxQh6EidSKDT+m1atav lNqbJooDoT164uedmYIttoEa5VaiNhUzT063/PoJzXrPiaWRIKksXLwbfDV0NotcKv yo0WUhysK60PzPst8E6h8m4l9cOYzU529X8a6sH+KWVLQBIRcbRsuyFCRfxYf5mouy RHjtAbURtTyjNsc3leUCMvMF9rFn2rzbzaNzg8g+BWiV6DxuDxtXW6IR9/Bur9ckSN 2FRGn9k282xVA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07DF560026; Tue, 9 Sep 2025 09:19:24 -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 yn4cqNnVGakR; Tue, 9 Sep 2025 09:19:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757431163; bh=hewJGnZB909Qt0Dh0C5OOrh/MAePpjGM8BWHMvGvpWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DX7ywmf7patmWxsvnddLGO0dSFZhNh0zh7cL0FD4uodgulQoGg3Kl3Hrir+T9WUWi zaR3GMlEnmW+7u5PNat0P8LFow3BnivetMGQ7l2Nq/Gd1NxtmOlQ2Ma8i+Ees+6bf3 O9FhYvUYtFtUSMFFhn3bZ830RWbWd0Shv7hPaGZjRqCFwaqdr+q5At5YsOwQinfbNj QoMQ/7v05qIgSjVJ3aFom4hFEOvXf7YpCusFm/fL1muegBZUDW2xQLAY+mBfQmYeeP D/FHWRCS4gmV1IW9bGc0QrcySpSladA2FQWSYKWZH5Q1NaEqGcB6Lh3seuL8BXF/Yl VCMqMm8Xjf5yA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 74EAC679D6; Tue, 9 Sep 2025 09:19:23 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 9 Sep 2025 09:18:09 -0600 Message-ID: <20250909151824.2327219-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250909151824.2327219-1-sjg@u-boot.org> References: <20250909151824.2327219-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: F4IPR5T2JQ2NIRXEJWZBTCNUNSNJFHHG X-Message-ID-Hash: F4IPR5T2JQ2NIRXEJWZBTCNUNSNJFHHG 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/18] ulib: Makefile: Create a library with renamed symbols 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 way to create a .ulib-objs file which contains all of the object files from the build, but with symbols renamed according to the rename.syms file. The file excludes main() which is present in the sandbox build, so that programs which link with libu-boot can provide their own main() For now this file is not used. Signed-off-by: Simon Glass --- Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Makefile b/Makefile index cfd24de82d5..f6527cca136 100644 --- a/Makefile +++ b/Makefile @@ -1859,6 +1859,25 @@ ifeq ($(CONFIG_RISCV),y) @tools/prelink-riscv $@ endif +# Common step: create archive and prepare modified object files +quiet_cmd_ulib-objs = OBJS $@ + cmd_ulib-objs = \ + rm -f $@.tmp $@.objlist $@; \ + $(AR) rcT $@.tmp $(u-boot-init) $(u-boot-main) \ + $(u-boot-keep-syms-lto); \ + $(AR) t $@.tmp | grep -v "arch/sandbox/cpu/main\.o$$" > $@.objlist; \ + mkdir -p $@.objdir; \ + $(PYTHON3) $(srctree)/scripts/build_api.py \ + $(srctree)/lib/ulib/rename.syms \ + --redefine $$(cat $@.objlist) --output-dir $@.objdir \ + $(if $(filter -j%,$(MAKEFLAGS)),--jobs $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))) \ + > $@; \ + rm -f $@.tmp $@.objlist + +.ulib-objs: $(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) \ + $(srctree)/lib/ulib/rename.syms FORCE + $(call if_changed,ulib-objs) + # Build U-Boot as a shared library quiet_cmd_libu-boot.so = LD $@ cmd_libu-boot.so = $(CC) -shared -o $@ -Wl,--build-id=none \