A unique module id, which is a part of sinit and sterm function names, is necessary to be unique. However, getUniqueModuleId will fail if there is no strong external symbol within a module.
We will turn to use PID and timestamp when this happens.
Details
Diff Detail
Event Timeline
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | ||
---|---|---|
1841 | Not sure what this condition is trying to achieve. | |
1867 | I think in theory, we only want to take this path when we have a stdin input file. | |
llvm/test/CodeGen/PowerPC/aix-static-init-no-unique-module-id.ll | ||
10–24 | Need a TODO here as well to indicate that this is not the final solution for this specific case. |
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | ||
---|---|---|
1873 | time_t is likely to be a signed integral on most target, because specification required return (std::time_t)(-1) on error. |
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | ||
---|---|---|
1872 | I believe concatenating two strings of decimal digits without a separator increases the chance of collisions. Adding a separator is low cost for the value it would bring. |
llvm/test/CodeGen/PowerPC/aix-static-init-no-unique-module-id.ll | ||
---|---|---|
15 | Sorry for not mentioning this earlier, but could we replace clang here with clangPidTime or similar? More generally, I think we should want to indicate the format style in that position. |
llvm/test/CodeGen/PowerPC/aix-static-init-no-unique-module-id.ll | ||
---|---|---|
15 | Do we only add indicator of format style when getUniqueModuleId[or source file full path later] does not work? i.e. do we also want to add one when getUniqueModuleId[or source file full path] does work and replace clang with something like clangUniqueModId[or clangSrcFullPath]? |
llvm/test/CodeGen/PowerPC/aix-static-init-no-unique-module-id.ll | ||
---|---|---|
15 | I think we would also want a format indicator for the other cases. This would help in case we find reasons for having more than one format available. |
llvm/test/CodeGen/PowerPC/aix-static-init-no-unique-module-id.ll | ||
---|---|---|
15 | I see. Since "adding format indicator" doesn't really belong to the scope of this patch, and we will later have a follow-up patch of using source file full path to generate module id, I am thinking for this "the other case" we can leave a TODO and address it later? |
llvm/test/CodeGen/PowerPC/aix-static-init-no-unique-module-id.ll | ||
---|---|---|
15 | That's fine. We can still handle the current case here first though. |
Thanks; this LGTM with comments. Please double check to make sure the capitalization of clangPidTime is consistent (including in comments) if making that change.
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | ||
---|---|---|
158–159 | s/as a/to form/; s/part of/part of the/; | |
1864 | Minor nits: s/which are/to be/; s/part of/part of the/; | |
1875 | Add "the" before "PID" and "unique module id". | |
1880 | The LLVM-style for camelCase indicates that acronyms are to be capitalized in the style of regular words. I suggest that we be consistent with that, but (noting that this is not an identifier name in the source) I am okay with the current form as well. | |
llvm/test/CodeGen/PowerPC/aix-static-init-no-unique-module-id.ll | ||
12 | s/PID/the PID/; | |
19–20 | We should check that the alias descriptor label immediately follows the start of the descriptor csect. Please adjust the alignment of the other lines to match. | |
21–22 | Same comment for the entry point labels. |
s/as a/to form/; s/part of/part of the/;