This is an archive of the discontinued LLVM Phabricator instance.

build: disable unwind tables whenever possible
ClosedPublic

Authored by compnerd on May 2 2019, 9:30 AM.

Details

Summary

The unwind tables (.eh_frame, .arm.extab) add a significant chunk of data to
the final binaries. These should not be needed normally, particularly when
exceptions are disabled. This enables shrinking lldb-server by ~18% (3 MiB)
when built with gold.

Diff Detail

Repository
rL LLVM

Event Timeline

compnerd created this revision.May 2 2019, 9:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2019, 9:30 AM

clang 6.0.0, gold, x86_64-unknown-linux-gnu, MinSizeRel, unstripped binary

BEFORE

bin/lldb-server  :
section                       size       addr
.interp                         28    4194928
.note.ABI-tag                   32    4194956
.dynsym                      11232    4194992
.gnu.hash                      104    4214336
.gnu.version                   936    4214440
.gnu.version_r                 608    4215376
.init                           26    4224816
.plt                          5552    4224848
.text                      4339327    4230400
.fini                            9    8569728
.rodata                    7704540    8569744
.eh_frame                   676948   16274288
.eh_frame_hdr               156220   16951236
.tbss                           41   17111616
.jcr                             8   17111616
.fini_array                      8   17111624
.init_array                    432   17111632
.data.rel.ro               1224760   17112064
.dynamic                       640   18336824
.got                           304   18337464
.got.plt                      2792   18337768
.tm_clone_table                  0   18340560
.data                        59856   18340560
.bss                         45808   18400416
.comment                       443          0
.note.gnu.gold-version          28          0
*COM*                            0          0
Total                     14230682

AFTER

bin/lldb-server  :
section                       size       addr
.interp                         28    4194928
.note.ABI-tag                   32    4194956
.dynsym                      11232    4194992
.gnu.hash                      104    4214336
.gnu.version                   936    4214440
.gnu.version_r                 608    4215376
.init                           26    4224816
.plt                          5552    4224848
.text                      4338799    4230400
.fini                            9    8569200
.rodata                    7704540    8569216
.eh_frame                     1660   16273760
.eh_frame_hdr                  332   16275420
.tbss                           41   16280128
.jcr                             8   16280128
.fini_array                      8   16280136
.init_array                    432   16280144
.data.rel.ro               1224760   16280576
.dynamic                       640   17505336
.got                           304   17505976
.got.plt                      2792   17506280
.tm_clone_table                  0   17509072
.data                        59856   17509072
.bss                         45808   17568928
.comment                       443          0
.note.gnu.gold-version          28          0
*COM*                            0          0
Total                     13398978
compnerd updated this revision to Diff 197826.May 2 2019, 10:35 AM
  • provide an option to control the behaviour
  • add some documentation
compnerd updated this revision to Diff 197832.May 2 2019, 11:14 AM

fix the name of the option

smeenai accepted this revision.May 2 2019, 11:41 AM

LGTM, given it doesn't have any effect by default. I'm not sure if there are negative consequences around e.g. stack walking for crashes, but having the option shouldn't hurt.

This revision is now accepted and ready to land.May 2 2019, 11:41 AM
compnerd closed this revision.May 2 2019, 12:35 PM

SVN r359819