Skip to content

Undefined symbols __start_linkm2_*, __start_linkme_*, __stop_linkm2_*, __stop_linkme_* #111

@douglas-raillard-arm

Description

@douglas-raillard-arm

The following symbols are not defined:
__start_linkm2_*, __start_linkme_*, __stop_linkm2_*, __stop_linkme_*

The build is a static archive for a freestanding custom target with rust-lld with rust 1.85.0. The issue seems identical to the one reported at #88 .
I'm not sure if the issue is supposed to be fixed or not, but none of the workarounds seems to work:

  • -Clink-arg=-Wl,-z,nostart-stop-gc
  • -Clink-dead-code is broken for my setup (-Zbuild-std) so I cannot test it
  • used_linker feature

The resulting .a file contains:

  • linkme_* and linkm2_* sections:
[12] linkme_FEATURES   PROGBITS        0000000000000000 00dd28 000000 00  WA  0   0  1
[13] linkm2_FEATURES   PROGBITS        0000000000000000 00dd28 000008 00   A  0   0  8
[130] linkme_FEATURES  PROGBITS        0000000000000000 016881 000002 00   A  0   0  1
  • a global undefined symbol for each of __start_linkm2_*, __start_linkme_*, __stop_linkm2_*, __stop_linkme_*:
565: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND __stop_linkm2_FEATURES
566: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND __start_linkm2_FEATURES
567: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND __start_linkme_FEATURES
568: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND __stop_linkme_FEATURES
  • and relocations mentioning them:
0000000000007804  0000023700000113 R_AARCH64_ADR_PREL_PG_HI21 0000000000000000 __start_linkme_FEATURES + 0

But no definition anywhere.

Using rust-lld is important here so I don't depend on the platform linker, as this build is done dynamically along some C code, with a wide range of C toolchains. Relying on the user-provided linker would be a recipe for build failure in exotic configurations. OTH rust-lld provides me with the same linker everywhere for the Rust part of the code. If rust-lld is not supported at the moment, it may be a good idea to mention it in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions