lib: debug: add common stack protection feature in lk

-fstack-protector is added in lk and corresponding
__stack_chk_fail function and __stack_chk_guard.

CRs-Fixed: 671500
Change-Id: I2ac186affa311005c4d727c8cd00a93c8f5014c9
diff --git a/include/debug.h b/include/debug.h
index a9f3237..ae7119e 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -1,6 +1,8 @@
 /*
  * Copyright (c) 2008 Travis Geiselbrecht
  *
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files
  * (the "Software"), to deal in the Software without restriction,
@@ -67,6 +69,21 @@
 
 #define PANIC_UNIMPLEMENTED panic("%s unimplemented\n", __PRETTY_FUNCTION__)
 
+void * __stack_chk_guard;
+
+/*
+* Initialize the stack protector canary value.
+*/
+static inline void __stack_chk_guard_setup()
+{
+	void *canary;
+	canary = get_canary();
+	__stack_chk_guard =  canary;
+}
+
+void __attribute__ ((noreturn))
+	__stack_chk_fail (void);
+
 /* spin the cpu for a period of (short) time */
 void spin(uint32_t usecs);