[llvm] [X86] Set SHF_X86_64_LARGE for globals with explicit well-known large section name (PR #74381)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 14:59:53 PST 2023


================
@@ -55,17 +52,22 @@ bool TargetMachine::isLargeGlobalObject(const GlobalObject *GO) const {
     return false;
 
   // Allowing large metadata sections in the presence of an explicit section is
-  // useful, even if GCC does not allow them. However, we should not mark
-  // certain well-known prefixes as large, because it would make the whole
-  // output section large and cause the linker to move it, which is almost
-  // always undesired.
+  // useful, even if GCC does not allow them. However, we should properly mark
----------------
rnk wrote:

The first sentence of this comment doesn't make sense anymore. You can probably delete everything up to and including "However,". Regardless of the code model, we try to infer the large-ness of the global from certain well-known explicit section names.

This is a micro-nit / premature optimization, but I'd throw all this code into a `if (!Name.empty()) {` conditional, as a way to mean "if we have an explicit section, here's a bunch of logic you can skip over".

https://github.com/llvm/llvm-project/pull/74381


More information about the llvm-commits mailing list