aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot/scripts/gen_ll_addressable_symbols.sh
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/u-boot/scripts/gen_ll_addressable_symbols.sh
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/u-boot/scripts/gen_ll_addressable_symbols.sh')
-rwxr-xr-xroms/u-boot/scripts/gen_ll_addressable_symbols.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/roms/u-boot/scripts/gen_ll_addressable_symbols.sh b/roms/u-boot/scripts/gen_ll_addressable_symbols.sh
new file mode 100755
index 000000000..3978a39d9
--- /dev/null
+++ b/roms/u-boot/scripts/gen_ll_addressable_symbols.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (C) 2020 Marek BehĂșn <marek.behun@nic.cz>
+
+# Generate __ADDRESSABLE(symbol) for every linker list entry symbol, so that LTO
+# does not optimize these symbols away
+
+set -e
+
+echo '#include <common.h>'
+$NM "$@" 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' | \
+ sort -u | sed -e 's/^\(.*\)/extern char \1[];\n__ADDRESSABLE(\1);/'