[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] symbols: explicitly specify source file name for symtab


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 11 May 2026 12:00:03 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Autocrypt:Subject:From:Cc:To:Content-Language:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Mon, 11 May 2026 10:00:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

If there are any local symbols in an object file, GNU ld will create an
STT_FILE symbol derived from the object file name if there is none in the
incoming symbol table. The object file name, however, varies between
linking passes. As a result, symbol name compression can yield different
results if any of those local symbols need retaining (Arm [and RISC-V]
mapping symbols are omitted, for example). If that difference in
compression would yield a difference in the sizes of symbol_names[] or
symbols_token_table[], the compare-symbol-tables sanity check will fail.

Fixes: d37d63d4b548 ("symbols: prefix static symbols with their source file 
names")
Reported-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
The observed problem was with a stub generated as Arm64 erratum 843419
workaround. Such stubs' symbols (imo wrongly) are associated with the last
input object, rather than the input object they belong to. Also for other
kinds of stubs, afaict. See
https://sourceware.org/bugzilla/show_bug.cgi?id=34140.

As per the above, having a Fixes: tag here is questionable.

--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -200,7 +200,8 @@ $(TARGET).efi: $(objtree)/prelink.o $(no
 ifeq ($(CONFIG_DEBUG_INFO),y)
        $(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug 
info from $(@F)"
 endif
-       $(objtree)/tools/symbols $(all_symbols) --empty > $(dot-target).0s.S
+       $(objtree)/tools/symbols $(all_symbols) --source-name=$(@F).S --empty \
+               > $(dot-target).0s.S
        $(MAKE) $(build)=$(@D) .$(@F).0s.o
        $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
                  $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds $< 
$(relocs-dummy) \
@@ -210,6 +211,7 @@ endif
                > $(dot-target).1r.S
        $(NM) -pa --format=sysv $(dot-target).$(VIRT_BASE).0 \
                | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
+                  --source-name=$(@F).S \
                > $(dot-target).1s.S
        $(MAKE) $(build)=$(@D) .$(@F).1r.o .$(@F).1s.o
        $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
@@ -220,6 +222,7 @@ endif
                > $(dot-target).2r.S
        $(NM) -pa --format=sysv $(dot-target).$(VIRT_BASE).1 \
                | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
+                  --source-name=$(@F).S \
                > $(dot-target).2s.S
        $(MAKE) $(build)=$(@D) .$(@F).2r.o .$(@F).2s.o
        $(call compare-symbol-tables, $(dot-target).1r.o, $(dot-target).2r.o)
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -66,6 +66,7 @@ int token_profit[0x10000];
 unsigned char best_table[256][2];
 unsigned char best_table_len[256];
 
+static const char *srcname = "xen-syms.S";
 
 static void usage(void)
 {
@@ -356,6 +357,7 @@ static void write_src(void)
        printf("#define ALGN 4\n");
        printf("#endif\n");
 
+       printf("\t.file \"%s\"\n", srcname);
        printf("\t.section .rodata, \"a\"\n");
 
        printf("#ifndef SYMBOLS_ORIGIN\n");
@@ -679,6 +681,8 @@ int main(int argc, char **argv)
                                unsorted = true;
                        else if (strcmp(argv[i], "--sort-by-name") == 0)
                                sort_by_name = 1;
+                       else if (strncmp(argv[i], "--source-name=", 14) == 0)
+                               srcname = argv[i] + 14;
                        else if (strcmp(argv[i], "--warn-dup") == 0)
                                warn_dup = true;
                        else if (strcmp(argv[i], "--error-dup") == 0)



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.