[PATCH] D33018: [compiler-rt][cmake] Provide empty version of enable_execute_stack for baremetal targets

Catherine Moore via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 15:40:31 PDT 2017


clm updated this revision to Diff 98360.
clm added a comment.

The first version of the patch failed to include the empty version of enable_execute_stack.  The diff is now updated.


https://reviews.llvm.org/D33018

Files:
  CMakeLists.txt
  lib/builtins/CMakeLists.txt
  lib/builtins/README.txt
  lib/builtins/enable_execute_stack_empty.c


Index: lib/builtins/enable_execute_stack_empty.c
===================================================================
--- lib/builtins/enable_execute_stack_empty.c
+++ lib/builtins/enable_execute_stack_empty.c
@@ -0,0 +1,8 @@
+/* Dummy implementation of __enable_execute_stack.  */
+
+extern void __enable_execute_stack (void *);
+
+void
+__enable_execute_stack (void *addr __attribute__((__unused__)))
+{
+}
Index: lib/builtins/README.txt
===================================================================
--- lib/builtins/README.txt
+++ lib/builtins/README.txt
@@ -204,7 +204,8 @@
 
 // __enable_execute_stack() is used with nested functions when a trampoline
 // function is written onto the stack and that page range needs to be made
-// executable.
+// executable.  A dummy version is provided for baremetal targets that do
+// not have support for mprotect.
 void __enable_execute_stack(void* addr);
 
 // __gcc_personality_v0() is normally only called by the system unwinder.
Index: lib/builtins/CMakeLists.txt
===================================================================
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -66,7 +66,6 @@
   divti3.c
   divtf3.c
   divxc3.c
-  enable_execute_stack.c
   eprintf.c
   extendsfdf2.c
   extendhfsf2.c
@@ -191,6 +190,16 @@
   "Skip the atomic builtin (this may be needed if system headers are unavailable)"
   Off)
 
+if(COMPILER_RT_BAREMETAL_BUILD)
+  set(GENERIC_SOURCES
+    ${GENERIC_SOURCES}
+    enable_execute_stack_empty.c)
+else()
+  set(GENERIC_SOURCES
+    ${GENERIC_SOURCES}
+    enable_execute_stack.c)
+endif()
+
 if(COMPILER_RT_HAS_ATOMIC_KEYWORD AND NOT COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN)
   set(GENERIC_SOURCES
     ${GENERIC_SOURCES}
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -31,6 +31,9 @@
 option(COMPILER_RT_BUILD_XRAY "Build xray" ON)
 mark_as_advanced(COMPILER_RT_BUILD_XRAY)
 
+set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOLEAN
+  "Build for a bare-metal target.")
+
 if (COMPILER_RT_STANDALONE_BUILD)
   load_llvm_config()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33018.98360.patch
Type: text/x-patch
Size: 2164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170509/61f3974f/attachment.bin>


More information about the llvm-commits mailing list