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

Re: [PATCH v5 26/26] xen/riscv: do a 4th linking pass if necessary


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Jul 2026 18:13:50 +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:Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject: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: Romain Caritey <Romain.Caritey@xxxxxxxxxxxxx>, Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 06 Jul 2026 16:14:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.07.2026 17:58, Oleksii Kurochko wrote:
> Embedding the symbol table can shift sections and flip relaxation
> decisions, changing code size and thus the set of emitted symbols
> (e.g. gap end markers).

What difference in symbols is there? (And: Do you mean the ELF symbol
table or what tools/symbols emits?) On ...

>  Re-link with a regenerated table when its
> size differs from the previous pass.
> 
> This mirrors commit 35de7285d508 ("Arm: do a 4th linking pass if
> necessary"), which riscv didn't receive when the underlying
> pass-2-vs-pass-3 check was extended to it in commit aa786d6e3467
> ("non-x86/symbols: check table sizes don't change between linking
> passes 2 and 3").

... Arm the problem was with a symbol (dis)appearing from/in the ELF
symbol table. The situation looks to be different here. Sadly ...

> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> ---
> I faced this issue again in downstream:
>   https://gitlab.com/xen-project/people/olkur/xen/-/jobs/15171254706
> 
> It was found that the difference between .xen-syms.0 and .xen-syms.1 is in
> alignment(?) gap between turn_on_mmu() and the end of simple_strtoull.
> Specifically 0xffffffffc00c05b0 is present in pass 1 but not present in
> pass 2 (where end of simple_strtoull() is just equal to ffffffffc00c05c0)
> because code was shifted:
> 
> ```
> .xen-syms.0:     file format elf64-littleriscv
> 
> ...
> 
> ffffffffc00c0534:       f2e794e3                bne     
> a5,a4,ffffffffc00c045c <simple_strtoull+0x18>
> ffffffffc00c0538:       00280813                addi    a6,a6,2
> ffffffffc00c053c:       f21ff06f                j       ffffffffc00c045c 
> <simple_strtoull+0x18>
> ffffffffc00c0540:       00068813                mv      a6,a3
> ffffffffc00c0544:       00800613                li      a2,8
> ffffffffc00c0548:       f15ff06f                j       ffffffffc00c045c 
> <simple_strtoull+0x18>
> ffffffffc00c054c:       00277713                andi    a4,a4,2
> ffffffffc00c0550:       04070463                beqz    a4,ffffffffc00c0598 
> <simple_strtoull+0x154>
> ffffffffc00c0554:       fe06869b                addiw   a3,a3,-32
> ffffffffc00c0558:       0ff6f693                zext.b  a3,a3
> ffffffffc00c055c:       fc96879b                addiw   a5,a3,-55
> ffffffffc00c0560:       04c7f263                bgeu    
> a5,a2,ffffffffc00c05a4 <simple_strtoull+0x160>
> ffffffffc00c0564:       02a60533                mul     a0,a2,a0
> ffffffffc00c0568:       00f50533                add     a0,a0,a5
> ffffffffc00c056c:       00180813                addi    a6,a6,1
> ffffffffc00c0570:       00084683                lbu     a3,0(a6)
> ffffffffc00c0574:       0006879b                sext.w  a5,a3
> ffffffffc00c0578:       00d30733                add     a4,t1,a3
> ffffffffc00c057c:       00074703                lbu     a4,0(a4)
> ffffffffc00c0580:       04477893                andi    a7,a4,68
> ffffffffc00c0584:       02088063                beqz    a7,ffffffffc00c05a4 
> <simple_strtoull+0x160>
> ffffffffc00c0588:       00477893                andi    a7,a4,4
> ffffffffc00c058c:       fc0880e3                beqz    a7,ffffffffc00c054c 
> <simple_strtoull+0x108>
> ffffffffc00c0590:       fd07879b                addiw   a5,a5,-48
> ffffffffc00c0594:       fcdff06f                j       ffffffffc00c0560 
> <simple_strtoull+0x11c>
> ffffffffc00c0598:       fc97879b                addiw   a5,a5,-55
> ffffffffc00c059c:       fc5ff06f                j       ffffffffc00c0560 
> <simple_strtoull+0x11c>
> ffffffffc00c05a0:       00000513                li      a0,0
> ffffffffc00c05a4:       00058463                beqz    a1,ffffffffc00c05ac 
> <simple_strtoull+0x168>
> ffffffffc00c05a8:       0105b023                sd      a6,0(a1)
> ffffffffc00c05ac:       00008067                ret
>         ...
> 
> ffffffffc00c05c0 <turn_on_mmu>:
> ffffffffc00c05c0:       12000073                sfence.vma
> ffffffffc00c05c4:       00800293                li      t0,8
> ffffffffc00c05c8:       03c29293                slli    t0,t0,0x3c
> ffffffffc00c05cc:       000fc317                auipc   t1,0xfc
> ffffffffc00c05d0:       a3430313                addi    t1,t1,-1484 # 
> ffffffffc01bc000 <stage1_pgtbl_root>
> ffffffffc00c05d4:       00c35313                srli    t1,t1,0xc
> ffffffffc00c05d8:       00536333                or      t1,t1,t0
> ffffffffc00c05dc:       18031073                csrw    satp,t1
> ffffffffc00c05e0:       00050067                jr      a0
> 
> ffffffffc00c05e4 <_ident_end>:
> ffffffffc00c05e4:       0000                    .insn   2, 0x0000
>         ...
> ```

... with all of this disassembly provided it still doesn't become clear what
changed from .xen-syms.0 to .xen-syms.1.

Jan



 


Rackspace

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