summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2012-11-15 21:48:15 +0000
committermiod <miod@openbsd.org>2012-11-15 21:48:15 +0000
commitff385ce478f0d42146acbb1036ae30279941e715 (patch)
treed6cec5260bae39b69546bc539378651d7ba6738d
parentMake this cross-compile friendly by defining ATTRIBUTE_UNUSED to an empty (diff)
downloadwireguard-openbsd-ff385ce478f0d42146acbb1036ae30279941e715.tar.xz
wireguard-openbsd-ff385ce478f0d42146acbb1036ae30279941e715.zip
Only allow the "return" insn construct (which simply yields a "jmp r1" line)
if null_prologue(), i.e. if there is no stack frame to undo and no r1 to restore. Make the "epilogue" insn construct no longer depend on "return", but rather on "(use (const_int 0))" as "prologue" and as generally done on other backends. On the other hand, make it unconditionnal, instead of "! null_prologue()". These changes make sure than a leaf procedure call does not end up "returning" (i.e. jmp r1) upon return from the call, without restoring r1 and r30 (whenever applicable) from the existing stack frame. This makes a gcc3-compiled __main() (from libgcc2.c) no longer spin after invoking the constructors, and gives the real payload (i.e. main() and whatever follows from there) a chance to run.
-rw-r--r--gnu/usr.bin/gcc/gcc/config/m88k/m88k.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/gnu/usr.bin/gcc/gcc/config/m88k/m88k.md b/gnu/usr.bin/gcc/gcc/config/m88k/m88k.md
index a79cce0778c..7b2d6905984 100644
--- a/gnu/usr.bin/gcc/gcc/config/m88k/m88k.md
+++ b/gnu/usr.bin/gcc/gcc/config/m88k/m88k.md
@@ -4001,18 +4001,18 @@
(define_insn "return"
[(return)]
- "reload_completed"
+ "null_prologue()"
"jmp%. %#r1"
[(set_attr "type" "jump")])
(define_expand "prologue"
- [(const_int 0)]
+ [(use (const_int 0))]
""
"m88k_expand_prologue (); DONE;")
(define_expand "epilogue"
- [(return)]
- "! null_prologue ()"
+ [(use (const_int 0))]
+ ""
"m88k_expand_epilogue ();")
(define_insn "blockage"