Commits

Don Williamson  committed bcc8884

These are all Linux fixes from kmetlov (https://bitbucket.org/kmetlov)
* Correct prototype for memcpy in clReflectUtil (dwilliamson: I've moved it into Serialise.cpp where it's used, instead of polluting the user global namespace).
* Fix linux map file parsing.
* Fix text relocation on POSIX.

  • Participants
  • Parent commits ac9a119

Comments (0)

Files changed (4)

File inc/clutl/Serialise.h

 #include <clcpp/clcpp.h>
 
 
-// Standard C library function, copy bytes
-// http://pubs.opengroup.org/onlinepubs/009695399/functions/memcpy.html
-
-extern "C" void* CLCPP_CDECL memcpy(void* dst, const void* src, clcpp::size_type size);
-
 clcpp_reflect_part(clutl)
 namespace clutl
 {

File src/clReflectCpp/clcpp.cpp

 #elif defined(CLCPP_PLATFORM_POSIX)
 
 	extern "C" void * dlopen(const char * __path, int __mode);
-	
+	extern "C" void * dlsym(void * handle, const char * name);
+
 #endif
 
 
 	#if defined(CLCPP_PLATFORM_WINDOWS)
 		return (clcpp::pointer_type)GetModuleHandleA(0);
 	#elif defined(CLCPP_PLATFORM_POSIX)
-		return (clcpp::pointer_type)dlopen(0, 0);
+		void * global_symbols = dlopen(0, 0);
+		return (clcpp::pointer_type)dlsym(global_symbols, "_start");
 	#endif
 	}
 }

File src/clReflectExport/MapFileParser.cpp

 				if (text_region)
 				{
 					if ((sscanf(line, " 0x%" CLCPP_POINTER_TYPE_HEX_FORMAT " %s", &function_address, signature_buffer) == 2)
-						&& (signature_buffer[0] == '-'))
+						&& (signature_buffer[0] == '_'))
 					{
 						int status;
 						char* demangle_signature = abi::__cxa_demangle(signature_buffer, 0, 0, &status);

File src/clReflectUtil/Serialise.cpp

 #include <clutl/Serialise.h>
 
 
+// Standard C library function, copy bytes
+// http://pubs.opengroup.org/onlinepubs/009695399/functions/memcpy.html
+
+#ifdef __GNUC__
+	#define __THROW	throw ()
+	#define __nonnull(params) __attribute__ ((__nonnull__ params))
+#else
+	#define __THROW
+	#define __nonnull(params)
+#endif
+
+extern "C" void* CLCPP_CDECL memcpy(void* dst, const void* src, clcpp::size_type size) __THROW __nonnull ((1, 2));
+
+
 clutl::WriteBuffer::WriteBuffer()
 	: m_Data(0)
 	, m_DataEnd(0)