[PATCH] D13950: ELF2: Implement --gc-sections.
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 21 14:33:37 PDT 2015
Just applied the patch locally to review it. There are a few
formatting issues. Please git-clang-format.
On 21 October 2015 at 13:30, Rui Ueyama <ruiu at google.com> wrote:
> ruiu created this revision.
> ruiu added a reviewer: rafael.
> ruiu added a subscriber: llvm-commits.
>
> Section garbage collection is a feature to remove unused sections
> from outputs. Unused sections are sections that cannot be reachable
> from known GC-root symbols or sections. Naturally the feature is
> implemented as a mark-sweep garbage collector.
>
> In this patch, I added Live bit to InputSectionBase. If and only
> if Live bit is on, the section will be written to the output.
> Starting from GC-root symbols or sections, a new function, markLive(),
> visits all reachable sections and sets their Live bits. Writer then
> ignores sections whose Live bit is off, so that such sections are
> excluded from the output.
>
> This change has small negative impact on performance. The time to
> link Clang changes from 0.356s to 0.386s, or +8%.
>
> It reduces Clang size from 57,764,984 bytes to 55,296,600 bytes.
> That is 4.3% reduction.
>
>
> http://reviews.llvm.org/D13950
>
> Files:
> ELF/CMakeLists.txt
> ELF/Config.h
> ELF/Driver.cpp
> ELF/InputFiles.cpp
> ELF/InputFiles.h
> ELF/InputSection.h
> ELF/MarkLive.cpp
> ELF/Options.td
> ELF/OutputSections.cpp
> ELF/SymbolTable.h
> ELF/Symbols.h
> ELF/Writer.cpp
> ELF/Writer.h
> test/elf2/gc-sections.s
>
More information about the llvm-commits
mailing list