Skip to content

Reduce binary size #131

Description

@metarutaiga

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate.
  • Provided a clear description of your suggestion.
  • Included any relevant context or examples.

Issue or Suggestion Description

the Clang has a bad design to collect all unnamed string into .rodata.str?.?
For example, the MbedTLS has many self tests but we don't use it,
But it still keep many string into .rodata.str?.?

GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);

to

GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::None); 

After the patch, all unnamed string would be one string per .rodata..L.str.??? section

Then we need to add a line to the linker script [ld.flash.sections] to keep string addresses.

  .flash.rodata : ALIGN(0x10)
  {
    _flash_rodata_start = ABSOLUTE(.);

+    *(.rodata..L.*)    
    SECTION_MAPPINGS(flash_rodata)

So we need a option to control the enum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions