[PATCH] D118840: [ELF] Support (TYPE=<value>) to customize the output section type

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 14:30:54 PDT 2022


manojgupta added a comment.
Herald added a subscriber: StephenFan.
Herald added a project: All.

This change is breaking rust embedded use cases where NOLOAD in a linker script is no longer being honored. So we had to revert it (locally) in ChromeOS.

example:

  #[link_section = ".arena"]
  static mut IMAGE_DATA: [i8; NUM_PIXELS] = [0i8; NUM_PIXELS];

Linker script :

  PROVIDE( end = . );
        SECTIONS {
            .arena (NOLOAD) :
            {
                    _farena = .;
                    *(.arena)
                    _earena = .;
            } > arena
        }

With this commit where NOBITS is changed to PROGBITS.

  Before:
    [ 8] .arena            NOBITS          60000000 006000 012c00 00  WA  0   0  1
  After:
    [ 8] .arena            PROGBITS        60000000 006000 012c00 00  WA  0   0  1

This seems to break a common use case in rust embedded
e.g. https://github.com/rust-embedded/cortex-m/commit/94fbbe01189f97aefa8d6a97cc7cd73e5c6f6ec9

Rust currently do not have a specify to section type and I am not sure llvm even provides an API for that.

@peter.smith wdyt? Should this be reverted for now since it breaks rust embedded without any short term alternatives.
Fangrui currently is out so we prefer to not revert outright before consulting you.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118840/new/

https://reviews.llvm.org/D118840



More information about the llvm-commits mailing list