Re: linux-next: Tree for Jul 6 (arch/riscv/)

From: Palmer Dabbelt
Date: Fri Jul 07 2023 - 01:47:25 EST


On Thu, 06 Jul 2023 16:40:27 PDT (-0700), rdunlap@xxxxxxxxxxxxx wrote:
Hi Palmer,

On 7/6/23 14:46, Palmer Dabbelt wrote:
On Thu, 06 Jul 2023 14:36:05 PDT (-0700), rdunlap@xxxxxxxxxxxxx wrote:


On 7/6/23 14:32, Palmer Dabbelt wrote:
On Thu, 06 Jul 2023 14:27:53 PDT (-0700), rdunlap@xxxxxxxxxxxxx wrote:


On 7/5/23 18:57, Stephen Rothwell wrote:
Hi all,

Please do *not* add any v6.6 related stuff to your linux-next included
branches until after v6.5-rc1 has been released.

Changes since 20230705:


on riscv64:

WARNING: modpost: vmlinux: section mismatch in reference: $xrv64i2p1_m2p0_a2p1_zicsr2p0_zifencei2p0_zihintpause2p0_zmmul1p0+0x14 (section: .text.unlikely.set_bit.constprop.0) -> numa_nodes_parsed (section: .init.data)


Full randconfig file is attached.

Thanks, I'm giving it a look.  Do you happen to also have your toolchain version easily availiable?  The mapping symbols are new and we've seen some odd stuff happen, something is likely broken somewhere...

I'm using gcc-13.1.0 from  https://mirrors.edge.kernel.org/pub/tools/crosstool/

Cool, those are pretty easy to run.  I've yet to actually reproduce the
failures, but I'd guess we just want to ignore the mapping symbols with
something like

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index b29b29707f10..2f801469301d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -614,6 +614,18 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname)
        /* Expoline thunks are linked on all kernel modules during final link of .ko */
        if (strstarts(symname, "__s390_indirect_jump_r"))
            return 1;
+
+    /*
+     * RISC-V defines various special symbols that start with "$".  The
+     * mapping symbols, which exist to differentiate between incompatible
+     * instruction encodings when disassembling, show up all over the place
+     * and are generally not meant to be treated like other symbols.  So
+     * just ignore any of the special symbols.
+     */
+    if (info->hdr->e_machine == EM_RISCV)
+        if (symname[0] == '$')
+            return 1;
+
    /* Do not ignore this symbol */
    return 0;
}

I haven't even built that, though...

That builds without any errors or warnings, but it doesn't fix the section mismatch
warning.

Turns out there's a hook for mapping symbols, this fixes it for me:

https://lore.kernel.org/r/20230707054007.32591-1-palmer@xxxxxxxxxxxx/

These also trip up backtraces, so we probably need something over there as
well.

I think that might fix the backtraces as well.