[PATCH] D81104: [XCOFF][AIX] report_fatal_error when an overflow section is needed

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 14:57:24 PDT 2020


jasonliu marked an inline comment as done.
jasonliu added inline comments.


================
Comment at: llvm/test/CodeGen/PowerPC/aix-xcoff-reloc-overflow.ll:6
+
+; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff \
+; RUN:     -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | \
----------------
hubert.reinterpretcast wrote:
> jasonliu wrote:
> > daltenty wrote:
> > > We're able to sed and friends in tests, so I think we can do an expansion based on @hubert.reinterpretcast original preprocessor example. Replacing the repeated line with 'A' and using something like this seems like it would do the trick:
> > > 
> > > ```
> > > sed "s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;s/A/ABA/g;" %s| tr B "\n" | sed "s/A/call\ void\ bitcast\ \(void (...)*\ @foo\ to\ void\ ()*)()/g"|llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o
> > > ```
> > Thanks for the suggestion. 
> > I could not 'sed' the same file that the 'sed' command resides. So I created an input file instead.
> Would `grep -v` have helped there?
Hmm... I'm not sure how `grep -v` would help.
The problem I'm seeing is:
when this file get passed into the `sed` command, `sed` command would replace the A recursively inside this `sed` command, which would result in an output file like:

```
;; This test generates more than 65535 relocation entries in a single section,
;; which would trigger an overflow section to be generated in 32-bit mode.
;; Since overflow section is not supported yet, we will emit an error instead of
;; generating an invalid binary for now.

; RUN: sed "s/call void bitcast (void (...)* @foo to void ()*)()
call void bitcast (void (...)* @foo to void ()*)()
call void bitcast (void (...)* @foo to void ()*)()
call void bitcast (void (...)* @foo to void ()*)()
.... 
/g;" \
; RUN:     %p/Inputs/reloc-sed.ll | tr B "\n" | \
....
```


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

https://reviews.llvm.org/D81104





More information about the llvm-commits mailing list