Index: test/Sema/attr-naked.c
===================================================================
--- test/Sema/attr-naked.c	(revision 0)
+++ test/Sema/attr-naked.c	(revision 0)
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to function types}}
+
+void t1() __attribute__((naked));
+
+void t2() __attribute__((naked(2))); // expected-error {{attribute requires 0 argument(s)}}
+
Index: test/CodeGen/attr-naked.c
===================================================================
--- test/CodeGen/attr-naked.c	(revision 0)
+++ test/CodeGen/attr-naked.c	(revision 0)
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -g -emit-llvm -o %t %s
+// RUN: grep 'naked' %t
+
+void t1() __attribute__((naked));
+
+void t1()
+{
+}
+
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td	(revision 114822)
+++ include/clang/Basic/Attr.td	(working copy)
@@ -245,6 +245,10 @@
   let Args = [UnsignedArgument<"Number">];
 }
 
+def Naked : Attr {
+  let Spellings = ["naked"];
+}
+
 def NoDebug : Attr {
   let Spellings = ["nodebug"];
 }
Index: include/clang/Sema/AttributeList.h
===================================================================
--- include/clang/Sema/AttributeList.h	(revision 114822)
+++ include/clang/Sema/AttributeList.h	(working copy)
@@ -83,6 +83,7 @@
     AT_hiding,
     AT_malloc,
     AT_mode,
+    AT_naked,
     AT_nodebug,
     AT_noinline,
     AT_no_instrument_function,
Index: lib/Sema/SemaDeclAttr.cpp
===================================================================
--- lib/Sema/SemaDeclAttr.cpp	(revision 114822)
+++ lib/Sema/SemaDeclAttr.cpp	(working copy)
@@ -632,6 +632,23 @@
   d->addAttr(::new (S.Context) AliasAttr(Attr.getLoc(), S.Context, Str->getString()));
 }
 
+static void HandleNakedAttr(Decl *d, const AttributeList &Attr,
+                                   Sema &S) {
+  // check the attribute arguments.
+  if (Attr.getNumArgs() != 0) {
+    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
+    return;
+  }
+
+  if (!isa<FunctionDecl>(d)) {
+    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+    << Attr.getName() << 0 /*function*/;
+    return;
+  }
+
+  d->addAttr(::new (S.Context) NakedAttr(Attr.getLoc(), S.Context));
+}
+
 static void HandleAlwaysInlineAttr(Decl *d, const AttributeList &Attr,
                                    Sema &S) {
   // check the attribute arguments.
@@ -2263,6 +2280,7 @@
   case AttributeList::AT_ownership_takes:
   case AttributeList::AT_ownership_holds:
       HandleOwnershipAttr     (D, Attr, S); break;
+  case AttributeList::AT_naked:       HandleNakedAttr       (D, Attr, S); break;
   case AttributeList::AT_noreturn:    HandleNoReturnAttr    (D, Attr, S); break;
   case AttributeList::AT_nothrow:     HandleNothrowAttr     (D, Attr, S); break;
   case AttributeList::AT_override:    HandleOverrideAttr    (D, Attr, S); break;
Index: lib/Sema/AttributeList.cpp
===================================================================
--- lib/Sema/AttributeList.cpp	(revision 114822)
+++ lib/Sema/AttributeList.cpp	(working copy)
@@ -73,6 +73,7 @@
     .Case("unused", AT_unused)
     .Case("aligned", AT_aligned)
     .Case("cleanup", AT_cleanup)
+    .Case("naked", AT_naked)
     .Case("nodebug", AT_nodebug)
     .Case("nonnull", AT_nonnull)
     .Case("nothrow", AT_nothrow)
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp	(revision 114822)
+++ lib/CodeGen/CodeGenModule.cpp	(working copy)
@@ -457,6 +457,9 @@
   if (D->hasAttr<AlwaysInlineAttr>())
     F->addFnAttr(llvm::Attribute::AlwaysInline);
 
+  if (D->hasAttr<NakedAttr>())
+    F->addFnAttr(llvm::Attribute::Naked);
+
   if (D->hasAttr<NoInlineAttr>())
     F->addFnAttr(llvm::Attribute::NoInline);
 
