This ressurects ideas of abandoned (because of being outdated) D24725 patch.
When -verbose is specified, patch outputs names of each input orphan section
assigned to output.
Differential D37517
[ELF] - Report orphan sections if -verbose given. grimar on Sep 6 2017, 7:40 AM. Authored by
Details This ressurects ideas of abandoned (because of being outdated) D24725 patch. When -verbose is specified, patch outputs names of each input orphan section
Diff Detail
Event TimelineComment Actions In comments for original patch (D24725) initially implemented was concluded that Placing orphans as you know is not well documented and often probably people considers I believe this option can be helpful for people who writes/supports all kinds of linkerscripts. Comment Actions I'm OK if you remove isa<SyntheticSection> check. This is a FYI message and is not guaranteed to correct in either way. Instead of suppressing it for all synthetic sections, I'd just print it out for all synthetic sections. Comment Actions Output would be next then: orphan input section '.text' assigned to output section '.text' orphan input section '.text.2' assigned to output section '.text' orphan input section '.comment' assigned to output section '.comment' orphan input section '.bss' assigned to output section '.bss' orphan input section '.bss.rel.ro' assigned to output section '.bss.rel.ro' orphan input section '.dynsym' assigned to output section '.dynsym' orphan input section '.gnu.version' assigned to output section '.gnu.version' orphan input section '.gnu.version_r' assigned to output section '.gnu.version_r' orphan input section '.hash' assigned to output section '.hash' orphan input section '.dynamic' assigned to output section '.dynamic' orphan input section '.dynstr' assigned to output section '.dynstr' orphan input section '.rela.dyn' assigned to output section '.rela.dyn' orphan input section '.got' assigned to output section '.got' orphan input section '.got.plt' assigned to output section '.got.plt' orphan input section '.got.plt' assigned to output section '.got.plt' orphan input section '.rela.plt' assigned to output section '.rela.plt' orphan input section '.rela.plt' assigned to output section '.rela.plt' orphan input section '.plt' assigned to output section '.plt' orphan input section '.plt' assigned to output section '.plt' orphan input section '.eh_frame' assigned to output section '.eh_frame' orphan input section '.symtab' assigned to output section '.symtab' orphan input section '.shstrtab' assigned to output section '.shstrtab' orphan input section '.strtab' assigned to output section '.strtab' Sections: Idx Name Size Address Type 0 00000000 0000000000000000 1 .text 00000005 0000000000000000 TEXT DATA 2 .dynsym 00000018 0000000000000008 3 .hash 00000010 0000000000000020 4 .dynstr 00000001 0000000000000030 5 .dynamic 00000060 0000000000000038 6 .comment 00000008 0000000000000000 7 .symtab 00000030 0000000000000000 8 .shstrtab 00000049 0000000000000000 9 .strtab 0000000a 0000000000000000 Would it be better to change "orphan input section" to "orphan internal section" for synthetics ? Comment Actions This is still odd. Why don't you use toString? The message should be "foo.o:.bar is being placed in .foo". Comment Actions log() is a regular function, so its argument is evaluated first and then its value is passed to log(). That means toString(S) is always executed even if it's not going to be written. Is it slow? (I do not request you update this patch, but I'm wondering whether it's negligible or not.) Comment Actions I think answer is "it depends". addOrphanSections called only when Script->Opt.HasSections condition is true. And I think if script has SECTIONS, amount of orphan sections in compare with I performed a quck test which tries to simulate the situation (https://ideone.com/p07NYi). It calls some method log() which do nothing with random string argument million of times. Comment Actions
Well, I do not believe that the cost of calling log really matters, but your test doesn't seem to test it correctly. We are talking about the cost of calling toString on InputSectionBase *. I don't think it makes much sense to write some different function and measure its performance on dummy inputs. Why don't you just profile it? Comment Actions So benchmarks were performed (results available in mail list for this thread). Looks we can land it ? Comment Actions LGTM
Your benchmark seems somewhat irrelevant, so I don't think that's a convincing number, but orthogonal to that, I think we don't need to worry too much about it. |