Skip to content

ARM: AT expected, but got NOCROSSREFS #1609

Open

Description

@nathanchance

After commit b9baf5c8c5c3 ("ARM: Spectre-BHB workaround"):

$ make -skj"$(nproc)" ARCH=arm LLVM=1 mrproper defconfig all
...
ld.lld: error: ./arch/arm/kernel/vmlinux.lds:34: AT expected, but got NOCROSSREFS
>>>  __vectors_lma = .; OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { .vectors { *(.vectors) } .vectors.bhb.loop8 { *(.vectors.bhb.loop8) } .vectors.bhb.bpiall { *(.vectors.bhb.bpiall) } } __vectors_start = LOADADDR(.vectors); __vectors_end = LOADADDR(.vectors) + SIZEOF(.vectors); __vectors_bhb_loop8_start = LOADADDR(.vectors.bhb.loop8); __vectors_bhb_loop8_end = LOADADDR(.vectors.bhb.loop8) + SIZEOF(.vectors.bhb.loop8); __vectors_bhb_bpiall_start = LOADADDR(.vectors.bhb.bpiall); __vectors_bhb_bpiall_end = LOADADDR(.vectors.bhb.bpiall) + SIZEOF(.vectors.bhb.bpiall); . = __vectors_lma + SIZEOF(.vectors) + SIZEOF(.vectors.bhb.loop8) + SIZEOF(.vectors.bhb.bpiall); __stubs_lma = .; .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { *(.stubs) } __stubs_start = LOADADDR(.stubs); __stubs_end = LOADADDR(.stubs) + SIZEOF(.stubs); . = __stubs_lma + SIZEOF(.stubs); PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
>>>
...

From the GNU ld documentation:

NOCROSSREFS(section section …)

This command may be used to tell ld to issue an error about any
references among certain output sections.

In certain types of programs, particularly on embedded systems when
using overlays, when one section is loaded into memory, another section
will not be. Any direct references between the two sections would be
errors. For example, it would be an error if code in one section called
a function defined in the other section.

The NOCROSSREFS command takes a list of output section names. If ld
detects any cross references between the sections, it reports an error
and returns a non-zero exit status. Note that the NOCROSSREFS command
uses output section names, not input section names.

The link succeeds with ld.bfd.

Activity

  1. added
    [BUG] linux
    [TOOL] lld
    [ARCH] arm32
    [BUG] llvm
    on Mar 9, 2022
  2. added
    Reported upstream
    on Mar 9, 2022
  3. nathanchance commented on Mar 9, 2022

    @nathanchance
    MemberAuthor
    diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h
    index 0ef21bfae9f6..90f385ec6ddd 100644
    --- a/arch/arm/include/asm/vmlinux.lds.h
    +++ b/arch/arm/include/asm/vmlinux.lds.h
    @@ -26,6 +26,11 @@
     #define ARM_MMU_DISCARD(x)     x
     #endif
    
    +/* https://github.com/ClangBuiltLinux/linux/issues/1609 */
    +#ifdef CONFIG_LD_IS_LLD
    +#define NOCROSSREFS
    +#endif
    +
     /* Set start/end symbol names to the LMA for the section */
     #define ARM_LMA(sym, section)                                          \
            sym##_start = LOADADDR(section);                                \

    appears to work, not sure if this is acceptable upstream.

  4. nathanchance commented on Mar 9, 2022

    @nathanchance
    MemberAuthor
  5. added
    [PATCH] Submitted
    on Mar 9, 2022
  6. nathanchance commented on Mar 9, 2022

    @nathanchance
    MemberAuthor
  7. added
    [WORKAROUND] Applied
    and removed
    [PATCH] Submitted
    [BUG] linux
    on Mar 9, 2022
  8. 207 remaining items

  9. ghost added a commit that references this issue on Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Reported upstream[ARCH] arm32[BUG] llvm[TOOL] lld[WORKAROUND] Appliedfeature-request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions