[cfe-commits] [libcxxabi] r149633 - in /libcxxabi/trunk: include/cxa_demangle.h src/abort_message.cpp src/abort_message.h src/cxa_demangle.cpp src/cxa_exception.cpp src/cxa_exception.hpp src/private_typeinfo.cpp src/private_typeinfo.h src/typeinfo.cpp
Howard Hinnant
hhinnant at apple.com
Thu Feb 2 12:47:28 PST 2012
Author: hhinnant
Date: Thu Feb 2 14:47:28 2012
New Revision: 149633
URL: http://llvm.org/viewvc/llvm-project?rev=149633&view=rev
Log:
Work on restricting symbol visibility.
Modified:
libcxxabi/trunk/include/cxa_demangle.h
libcxxabi/trunk/src/abort_message.cpp
libcxxabi/trunk/src/abort_message.h
libcxxabi/trunk/src/cxa_demangle.cpp
libcxxabi/trunk/src/cxa_exception.cpp
libcxxabi/trunk/src/cxa_exception.hpp
libcxxabi/trunk/src/private_typeinfo.cpp
libcxxabi/trunk/src/private_typeinfo.h
libcxxabi/trunk/src/typeinfo.cpp
Modified: libcxxabi/trunk/include/cxa_demangle.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/cxa_demangle.h?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/include/cxa_demangle.h (original)
+++ libcxxabi/trunk/include/cxa_demangle.h Thu Feb 2 14:47:28 2012
@@ -12,6 +12,8 @@
#include <cxxabi.h>
+#pragma GCC visibility push(hidden)
+
namespace __cxxabiv1
{
@@ -159,4 +161,7 @@
} // __libcxxabi
} // __cxxabiv1
+#pragma GCC visibility pop
+
+
#endif // _CXA_DEMANGLE_H
Modified: libcxxabi/trunk/src/abort_message.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/abort_message.cpp?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/abort_message.cpp (original)
+++ libcxxabi/trunk/src/abort_message.cpp Thu Feb 2 14:47:28 2012
@@ -12,6 +12,8 @@
#include <stdarg.h>
#include "abort_message.h"
+#pragma GCC visibility push(hidden)
+
#if __APPLE__
# if defined(__has_include) && __has_include(<CrashReporterClient.h>)
# define HAVE_CRASHREPORTERCLIENT_H 1
@@ -54,3 +56,5 @@
abort();
}
+
+#pragma GCC visibility pop
Modified: libcxxabi/trunk/src/abort_message.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/abort_message.h?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/abort_message.h (original)
+++ libcxxabi/trunk/src/abort_message.h Thu Feb 2 14:47:28 2012
@@ -12,6 +12,8 @@
#include <stdio.h>
+#pragma GCC visibility push(hidden)
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -25,6 +27,7 @@
}
#endif
+#pragma GCC visibility pop
#endif
Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Thu Feb 2 14:47:28 2012
@@ -10692,9 +10692,6 @@
}
}
-#pragma GCC visibility pop
-#pragma GCC visibility push(default)
-
__demangle_tree
__demangle(const char* mangled_name, char* buf, size_t bs)
{
@@ -10772,6 +10769,9 @@
} // __libcxxabi
+#pragma GCC visibility pop
+#pragma GCC visibility push(default)
+
extern "C"
{
Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Thu Feb 2 14:47:28 2012
@@ -34,6 +34,8 @@
namespace __cxxabiv1 {
+#pragma GCC visibility push(default)
+
// Utility routines
static
inline
@@ -615,4 +617,6 @@
} // extern "C"
+#pragma GCC visibility pop
+
} // abi
Modified: libcxxabi/trunk/src/cxa_exception.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.hpp?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.hpp (original)
+++ libcxxabi/trunk/src/cxa_exception.hpp Thu Feb 2 14:47:28 2012
@@ -17,6 +17,8 @@
namespace __cxxabiv1 {
+#pragma GCC visibility push(hidden)
+
static const uint64_t kOurExceptionClass = 0x434C4E47432B2B00; // CLNGC++\0
static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1
static const uint64_t get_vendor_and_language = 0xFFFFFFFFFFFFFF00; // mask for CLNGC++
@@ -103,10 +105,14 @@
#endif
};
+#pragma GCC visibility pop
+#pragma GCC visibility push(default)
+
extern "C" __cxa_eh_globals * __cxa_get_globals ();
extern "C" __cxa_eh_globals * __cxa_get_globals_fast ();
extern "C" void * __cxa_allocate_dependent_exception ();
extern "C" void __cxa_free_dependent_exception (void * dependent_exception);
+#pragma GCC visibility pop
}
\ No newline at end of file
Modified: libcxxabi/trunk/src/private_typeinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/private_typeinfo.cpp (original)
+++ libcxxabi/trunk/src/private_typeinfo.cpp Thu Feb 2 14:47:28 2012
@@ -12,7 +12,7 @@
namespace __cxxabiv1
{
-//#pragma GCC visibility push(hidden)
+#pragma GCC visibility push(hidden)
// __shim_type_info
@@ -84,8 +84,6 @@
{
}
-#pragma GCC visibility push(hidden)
-
// can_catch
// A handler is a match for an exception object of type E if
@@ -318,7 +316,7 @@
return false;
}
-//#pragma GCC visibility pop
+#pragma GCC visibility pop
#pragma GCC visibility push(default)
// __dynamic_cast
@@ -398,9 +396,9 @@
extern "C"
void*
__dynamic_cast(const void* static_ptr,
- const __class_type_info* static_type,
- const __class_type_info* dst_type,
- std::ptrdiff_t src2dst_offset)
+ const __class_type_info* static_type,
+ const __class_type_info* dst_type,
+ std::ptrdiff_t src2dst_offset)
{
// Possible future optimization: Take advantage of src2dst_offset
// Currently clang always sets src2dst_offset to -1 (no hint).
Modified: libcxxabi/trunk/src/private_typeinfo.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.h?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/private_typeinfo.h (original)
+++ libcxxabi/trunk/src/private_typeinfo.h Thu Feb 2 14:47:28 2012
@@ -16,9 +16,9 @@
namespace __cxxabiv1
{
-//#pragma GCC visibility push(hidden)
+#pragma GCC visibility push(hidden)
-class __shim_type_info
+class __attribute__ ((__visibility__("hidden"))) __shim_type_info
: public std::type_info
{
public:
@@ -27,36 +27,36 @@
virtual bool can_catch(const __shim_type_info* thrown_type, void*& adjustedPtr) const = 0;
};
-class __fundamental_type_info
+class __attribute__ ((__visibility__("default"))) __fundamental_type_info
: public __shim_type_info
{
public:
- virtual ~__fundamental_type_info();
- virtual bool can_catch(const __shim_type_info*, void*&) const;
+ __attribute__ ((__visibility__("hidden"))) virtual ~__fundamental_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
};
-class __array_type_info
+class __attribute__ ((__visibility__("default"))) __array_type_info
: public __shim_type_info
{
public:
- virtual ~__array_type_info();
- virtual bool can_catch(const __shim_type_info*, void*&) const;
+ __attribute__ ((__visibility__("hidden"))) virtual ~__array_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
};
-class __function_type_info
+class __attribute__ ((__visibility__("default"))) __function_type_info
: public __shim_type_info
{
public:
- virtual ~__function_type_info();
- virtual bool can_catch(const __shim_type_info*, void*&) const;
+ __attribute__ ((__visibility__("hidden"))) virtual ~__function_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
};
-class __enum_type_info
+class __attribute__ ((__visibility__("default"))) __enum_type_info
: public __shim_type_info
{
public:
- virtual ~__enum_type_info();
- virtual bool can_catch(const __shim_type_info*, void*&) const;
+ __attribute__ ((__visibility__("hidden"))) virtual ~__enum_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
};
enum
@@ -118,33 +118,43 @@
};
// Has no base class
-class __class_type_info
+class __attribute__ ((__visibility__("default"))) __class_type_info
: public __shim_type_info
{
public:
- virtual ~__class_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual ~__class_type_info();
- void process_static_type_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
- void process_static_type_below_dst(__dynamic_cast_info*, const void*, int) const;
- void process_found_base_class(__dynamic_cast_info*, void*, int) const;
- virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
- virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
- virtual bool can_catch(const __shim_type_info*, void*&) const;
- virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ void process_static_type_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ void process_static_type_below_dst(__dynamic_cast_info*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ void process_found_base_class(__dynamic_cast_info*, void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual bool can_catch(const __shim_type_info*, void*&) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
};
// Has one non-virtual public base class at offset zero
-class __si_class_type_info
+class __attribute__ ((__visibility__("default"))) __si_class_type_info
: public __class_type_info
{
public:
const __class_type_info* __base_type;
- virtual ~__si_class_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual ~__si_class_type_info();
- virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
- virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
- virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
};
struct __base_class_type_info
@@ -166,7 +176,7 @@
};
// Has one or more base classes
-class __vmi_class_type_info
+class __attribute__ ((__visibility__("default"))) __vmi_class_type_info
: public __class_type_info
{
public:
@@ -182,14 +192,17 @@
// more derived objects
};
- virtual ~__vmi_class_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual ~__vmi_class_type_info();
- virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
- virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
- virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void search_below_dst(__dynamic_cast_info*, const void*, int) const;
+ __attribute__ ((__visibility__("hidden")))
+ virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
};
-class __pbase_type_info
+class __attribute__ ((__visibility__("default"))) __pbase_type_info
: public __shim_type_info
{
public:
@@ -205,28 +218,28 @@
__incomplete_class_mask = 0x10
};
- virtual ~__pbase_type_info();
- virtual bool can_catch(const __shim_type_info*, void*&) const;
+ __attribute__ ((__visibility__("hidden"))) virtual ~__pbase_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
};
-class __pointer_type_info
+class __attribute__ ((__visibility__("default"))) __pointer_type_info
: public __pbase_type_info
{
public:
- virtual ~__pointer_type_info();
- virtual bool can_catch(const __shim_type_info*, void*&) const;
+ __attribute__ ((__visibility__("hidden"))) virtual ~__pointer_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
};
-class __pointer_to_member_type_info
+class __attribute__ ((__visibility__("default"))) __pointer_to_member_type_info
: public __pbase_type_info
{
public:
const __class_type_info* __context;
- virtual ~__pointer_to_member_type_info();
+ __attribute__ ((__visibility__("hidden"))) virtual ~__pointer_to_member_type_info();
};
-//#pragma GCC visibility pop
+#pragma GCC visibility pop
} // __cxxabiv1
Modified: libcxxabi/trunk/src/typeinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/typeinfo.cpp?rev=149633&r1=149632&r2=149633&view=diff
==============================================================================
--- libcxxabi/trunk/src/typeinfo.cpp (original)
+++ libcxxabi/trunk/src/typeinfo.cpp Thu Feb 2 14:47:28 2012
@@ -9,8 +9,6 @@
#include <typeinfo>
-#pragma GCC visibility push(default)
-
namespace std
{
@@ -53,5 +51,3 @@
}
} // std
-
-#pragma GCC visibility pop
More information about the cfe-commits
mailing list