Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

--print-gc-sections: print group signatures #45752

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR46783
Status NEW
Importance P enhancement
Reported by Fangrui Song (i@maskray.me)
Reported on 2020-07-20 11:05:47 -0700
Last modified on 2020-07-28 10:08:49 -0700
Version unspecified
Hardware PC Linux
CC llvm-bugs@lists.llvm.org, phosek@chromium.org, smithp352@googlemail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Petr Hosek reported that GNU ld has a nicer information. For example:

% cat a.s
.section .text.foo,"aG",@progbits,foo,comdat
.byte 0
.section __sancov_cntrs,"aG",@progbits,foo,comdat
.byte 0

% ld.lld --gc-sections --print-gc-sections -e 0 a.o -o a
removing unused section a.o:(.text)
removing unused section a.o:(.text.foo)
removing unused section a.o:(__sancov_cntrs)

### Ggroup signature in the output.
% ld.bfd --gc-sections --print-gc-sections -e 0 a.o -o a
ld.bfd: removing unused section '.group' in file 'a.o'
ld.bfd: removing unused section '.text.foo[foo]' in file 'a.o'
ld.bfd: removing unused section '__sancov_cntrs[foo]' in file 'a.o'
Quuxplusone commented 4 years ago

Another problem I find is that when we are constructing nextInSectionGroup, we do not check whether it can form a loop.