[PATCH] D72194: [MC][ELF] Ensure that mergeable globals with an explicit section are assigned to SHF_MERGE sections with compatible entsizes

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 13:10:11 PDT 2020


nickdesaulniers added a comment.

Patch looks good with everything I was able to throw at it; let's get that test fixed up so we don't land new tests that are red, and we should be good to go here.



================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:743
+        (Section->getEntrySize() != getEntrySizeForKind(Kind)))
+      report_fatal_error(
+          "Symbol '" + GO->getName() + "' from module '" +
----------------
If we have a way of producing a non-fatal warning, that may be preferred to crashing the compiler, which encourages users to send us a bug report. In this case, we don't care about their buggy code with impossible to solve constraints, and the text you provide here should be enough information for them to solve their code.

Maybe a warning, but proceed with codegen? The warning can encourage them that referencing those variables is undefined behavior.


================
Comment at: llvm/test/CodeGen/X86/explict-section-mergeable.ll:291
+;; Emit error if an incompatible symbol is explicitly placed into a mergeable section.
+; NO-I-ASM: LLVM ERROR: Symbol 'explicit_default_1' from module '<stdin>' required a section with entry-size=0 but was placed in section '.rodata.cst16' with entry-size=16: Explicit assignment by pragma or attribute of incompatible symbol to this section?
----------------
Running the unit tests with this diff version Diff 253031, this added test case fails.  Please triple check by running:

```
$ llvm-lit -vv llvm/test/CodeGen/X86/explict-section-mergeable.ll
```

It seems like there's something tricky going on with output redirection, as
```
$ llc < llvm/test/CodeGen/X86/explict-section-mergeable.ll -mtriple=x86_64-linux-gnu --no-integrated-as 2>&1| less
```
produces no output related to checks, but
```
$ llc < llvm/test/CodeGen/X86/explict-section-mergeable.ll -mtriple=x86_64-linux-gnu --no-integrated-as 2>&1
```
does.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72194/new/

https://reviews.llvm.org/D72194





More information about the llvm-commits mailing list