aboutsummaryrefslogtreecommitdiff
path: root/deps/gcc-4.9.4-naked.patch
blob: c3c7e7488e0d138a5817af1b04392c396438ff22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
diff -Naur gcc-4.9.4-orig/gcc/config/i386/i386.c gcc-4.9.4/gcc/config/i386/i386.c
--- gcc-4.9.4-orig/gcc/config/i386/i386.c
+++ gcc-4.9.4/gcc/config/i386/i386.c
@@ -6041,6 +6041,14 @@
   return false;
 }
 
+static bool
+ix86_function_naked (const_tree fn)
+{
+  if (fn && lookup_attribute ("naked", DECL_ATTRIBUTES (fn)))
+    return true;
+  return false;
+}
+
 static enum calling_abi
 ix86_function_abi (const_tree fndecl)
 {
@@ -9078,6 +9086,9 @@
 {
   struct ix86_frame frame;
 
+  if (ix86_function_naked (current_function_decl))
+    return false;
+
   if (! reload_completed || frame_pointer_needed)
     return 0;
 
@@ -9090,7 +9101,7 @@
   return (frame.stack_pointer_offset == UNITS_PER_WORD
 	  && (frame.nregs + frame.nsseregs) == 0);
 }
-
+
 /* Value should be nonzero if functions must have frame pointers.
    Zero means the frame pointer need not be set up (and parms may
    be accessed via the stack pointer) in functions that seem suitable.  */
@@ -10753,6 +10764,9 @@
   bool int_registers_saved;
   bool sse_registers_saved;
 
+  if (ix86_function_naked (current_function_decl))
+    return;
+
   ix86_finalize_stack_realign_flags ();
 
   /* DRAP should not coexist with stack_realign_fp */
@@ -11459,6 +11473,9 @@
   bool restore_regs_via_mov;
   bool using_drap;
 
+  if (ix86_function_naked (current_function_decl))
+    return;
+
   ix86_finalize_stack_realign_flags ();
   ix86_compute_frame_layout (&frame);
 
@@ -42414,6 +42431,8 @@
     false },
   { "callee_pop_aggregate_return", 1, 1, false, true, true,
     ix86_handle_callee_pop_aggregate_return, true },
+  { "naked", 0, 0, true, false, false,
+    ix86_handle_fndecl_attribute, false },
   /* End element.  */
   { NULL,        0, 0, false, false, false, NULL, false }
 };