[llvm-bugs] [Bug 42088] New: Should we sort common symbols by alignment?

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 31 02:54:48 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42088

            Bug ID: 42088
           Summary: Should we sort common symbols by alignment?
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: ruiu at google.com
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

I believe we used to sort common symbols by alignment for better packing, but
looks like the code is now gone. I don't know whether this is a good thing or a
bad thing. To make a decision whether we should sort common symbols or not, I
think we need to answer to the following questions:

 1. Do people still use common symbols? I think the common symbol is a hack to
workaround existing C source files (especially header files) that don't have
"extern" for global variable definitions. This is usually considered a bad
practice.

 2. Does sorting common symbols really makes a difference? If a space we can
save by sorting them is tiny, we shouldn't be bothered to do that.

 3. How does it affect memory locality? By sorting common symbols, common
symbols in the same file would be allocated to two distant places. Does this
affect the performance?

 4. If sorting common symbols makes difference, and that doesn't negatively
affect the performance, why don't we sort symbols in BSS as well? How about
other data sections?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190531/b3471a5e/attachment-0001.html>


More information about the llvm-bugs mailing list