blob: fc5ee0e9c0ba863206230d24c3d42352ee687f7d [file] [log] [blame]
Marek Behúnc1094982021-05-20 13:24:03 +02001#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0+
Marek Behún61143f72022-06-01 17:17:06 +02003# Copyright (C) 2020 Marek Behún <kabel@kernel.org>
Marek Behúnc1094982021-05-20 13:24:03 +02004
5# Generate __ADDRESSABLE(symbol) for every linker list entry symbol, so that LTO
6# does not optimize these symbols away
7
Patrick Delaunayff7852d2021-07-21 09:56:07 +02008# The expected parameter of this script is the command requested to have
9# the U-Boot symbols to parse, for example: $(NM) $(u-boot-main)
10
Marek Behúnc1094982021-05-20 13:24:03 +020011set -e
12
Tom Rini03de3052024-05-20 13:35:03 -060013echo '#include <linux/compiler.h>'
Andrew Goodbodybbef8292024-07-02 18:00:09 +010014$@ 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' \
15 -e '__stack_chk_guard' | sort -u | \
16 sed -e 's/^\(.*\)/extern char \1[];\n__ADDRESSABLE(\1);/'