From e39702c2720cd2959dd4458c796ac25ac5c31e3f Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Thu, 16 May 2024 09:42:41 +0200 Subject: [PATCH] newt: Extend link tables filter So far for link time generated tables only exact section name was added to filter like in this example: pkg.link_tables: - foo would generate link_tables.ld.h with following content __foo_start__ = .; KEEP(*(.foo)) __foo_end__ = .; Now additional filter will be added __foo_start__ = .; KEEP(*(.foo)) KEEP(*(SORT(.foo.*))) __foo_end__ = .; This is general rule for many sections like .text or .data This is specifically required for xc32 compiler that adds variable name to section by itself even though __attribute__((section, "foo")) is used and arm gcc treats name in attribute verbatim and not as prefix. --- newt/builder/extcmd.go | 1 + 1 file changed, 1 insertion(+) diff --git a/newt/builder/extcmd.go b/newt/builder/extcmd.go index e75530f8b..dcad7a409 100644 --- a/newt/builder/extcmd.go +++ b/newt/builder/extcmd.go @@ -189,6 +189,7 @@ func getLinkTableEntry(name string) string { entry := indent + "__" + name + "_start__ = .;\n" + indent + "KEEP(*(." + name + "))\n" + + indent + "KEEP(*(SORT(." + name + ".*)))\n" + indent + "__" + name + "_end__ = .;\n\n" return entry