[PATCH] [libcxxabi] [unwinder] Tell the assembler that functions are functions so that the linker knows how to link them.

Jon Roelofs jonathan at codesourcery.com
Fri Aug 1 06:44:00 PDT 2014


Hi danalbert,

This fixes an interworking problem when the unwinder/libcxxabi is built for Thumb. When unw_getcontext is not marked as a function, 'bl' is used for the branch instead of 'bx'.

http://reviews.llvm.org/D4754

Files:
  src/Unwind/assembly.h

Index: src/Unwind/assembly.h
===================================================================
--- src/Unwind/assembly.h
+++ src/Unwind/assembly.h
@@ -34,13 +34,33 @@
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
+#if defined(__APPLE__)
+#define SYMBOL_IS_FUNC(name)
+#elif defined(__ELF__)
+#define LOCAL_LABEL(name) .L_##name
+#define FILE_LEVEL_DIRECTIVE
+#if defined(__arm__)
+#define SYMBOL_IS_FUNC(name) .type name,%function
+#else
+#define SYMBOL_IS_FUNC(name) .type name, at function
+#endif
+#else
+#define SYMBOL_IS_FUNC(name)                                                   \
+  .def name SEPARATOR                                                          \
+    .scl 2 SEPARATOR                                                           \
+    .type 32 SEPARATOR                                                         \
+  .endef
+#endif
+
 #define DEFINE_LIBUNWIND_FUNCTION(name)                   \
   .globl SYMBOL_NAME(name) SEPARATOR                      \
+  SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR             \
   SYMBOL_NAME(name):
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)           \
   .globl SYMBOL_NAME(name) SEPARATOR                      \
   HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR            \
+  SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR             \
   SYMBOL_NAME(name):
 
 #endif /* UNWIND_ASSEMBLY_H */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4754.12103.patch
Type: text/x-patch
Size: 1410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140801/08720b2f/attachment.bin>


More information about the cfe-commits mailing list