This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Clarify help wording for --symbol-ordering-file
ClosedPublic

Authored by smeenai on Apr 25 2018, 6:10 PM.

Details

Summary

The input file for this option should contain a list of symbols, not a
list of sections, so it seems clearer to talk about laying out symbols
instead of sections. Referring to the file itself as the "symbol
ordering file" is consistent with --warn-symbol-ordering and less
ambiguous than "symbol file" (albeit slightly redundant).

Event Timeline

smeenai created this revision.Apr 25 2018, 6:10 PM
pcc added a subscriber: pcc.Apr 25 2018, 6:12 PM

One could also read "Lay out symbols" as meaning the order of symbols in the symbol table, so I'm not sure if this is better. No strong opinions though.

ruiu accepted this revision.Apr 25 2018, 6:14 PM

It is arguable which is more accurate, "layout sections" or "layout symbols", because you can't layout symbols alone. But I agree that your new message is more intuitive and easier to understand.

LGTM but please wait for a while in case other people have different opinion.

This revision is now accepted and ready to land.Apr 25 2018, 6:14 PM
In D46099#1078997, @pcc wrote:

One could also read "Lay out symbols" as meaning the order of symbols in the symbol table, so I'm not sure if this is better. No strong opinions though.

That's fair. I'm not sure how to make that unambiguous without being super wordy.

It is arguable which is more accurate, "layout sections" or "layout symbols", because you can't layout symbols alone. But I agree that your new message is more intuitive and easier to understand.

LGTM but please wait for a while in case other people have different opinion.

Yeah, that's also true. Slightly unrelated to this change, but --warn-symbol-ordering is silent right now in case you forget -ffunction-sections (but of course the ordering doesn't work). Would it be reasonable to extend the warnings to cover that case? I'm thinking, for each symbol specified in the symbol ordering file, warn if that symbol's section also contains other symbols, though I don't know if that would lead to false positives and/or be reasonable cost-wise.

Also, if we're willing to go with a longer help text, I think it might be helpful to note that you must compile with -ffunction-sections -fdata-sections in order for symbol ordering to be able to work in the help text itself.

ruiu added a comment.Apr 25 2018, 6:39 PM

Yeah, that's also true. Slightly unrelated to this change, but --warn-symbol-ordering is silent right now in case you forget -ffunction-sections (but of course the ordering doesn't work). Would it be reasonable to extend the warnings to cover that case? I'm thinking, for each symbol specified in the symbol ordering file, warn if that symbol's section also contains other symbols, though I don't know if that would lead to false positives and/or be reasonable cost-wise.

Maybe we can warn if two or more symbols specified by a symbol ordering file belong to one section? I'm not sure if that would cause false positives, but it might be worth to try.

The new message is IMO slightly better, so I am OK with that patch.

But I am actually thinking about something like:
"Layout sections to place symbols in the order specified by symbol ordering file"

Yeah, that's also true. Slightly unrelated to this change, but --warn-symbol-ordering is silent right now in case you forget -ffunction-sections (but of course the ordering doesn't work). Would it be reasonable to extend the warnings to cover that case? I'm thinking, for each symbol specified in the symbol ordering file, warn if that symbol's section also contains other symbols, though I don't know if that would lead to false positives and/or be reasonable cost-wise.

Maybe we can warn if two or more symbols specified by a symbol ordering file belong to one section? I'm not sure if that would cause false positives, but it might be worth to try.

I agree that an additional warning here might be nice. We would probably only want to warn once (or possibly some other low limit) per section, not per symbol, as otherwise if you forget -ffunction-sections, you will get far too many warnings.

Yeah, that's also true. Slightly unrelated to this change, but --warn-symbol-ordering is silent right now in case you forget -ffunction-sections (but of course the ordering doesn't work). Would it be reasonable to extend the warnings to cover that case? I'm thinking, for each symbol specified in the symbol ordering file, warn if that symbol's section also contains other symbols, though I don't know if that would lead to false positives and/or be reasonable cost-wise.

Maybe we can warn if two or more symbols specified by a symbol ordering file belong to one section? I'm not sure if that would cause false positives, but it might be worth to try.

I agree that an additional warning here might be nice. We would probably only want to warn once (or possibly some other low limit) per section, not per symbol, as otherwise if you forget -ffunction-sections, you will get far too many warnings.

I agree. For whatever reason many system libraries (.a) are built without -ffunction-sections. A single warning per file (or even library) is probably OK.

espindola accepted this revision.Apr 26 2018, 2:47 PM

The new message is IMO slightly better, so I am OK with that patch.

But I am actually thinking about something like:
"Layout sections to place symbols in the order specified by symbol ordering file"

I agree. "Layout symbols" sounds a bit odd, but maybe just because I have been working on a linker.

The new message is IMO slightly better, so I am OK with that patch.

But I am actually thinking about something like:
"Layout sections to place symbols in the order specified by symbol ordering file"

I really like this. I'll switch to it; thanks.

I'll look into the other warning as a follow-up.

smeenai updated this revision to Diff 144217.Apr 26 2018, 3:26 PM

Update with @grimar's suggestion

This revision was automatically updated to reflect the committed changes.