[pypy-commit] pypy default: A sprinke of RPY_EXTERN here and there avoids some of the remaining

arigo noreply at buildbot.pypy.org
Wed Feb 11 19:28:00 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r75831:af205bb7dad4
Date: 2015-02-11 19:27 +0100
http://bitbucket.org/pypy/pypy/changeset/af205bb7dad4/

Log:	A sprinke of RPY_EXTERN here and there avoids some of the remaining
	unexpectedly-exported symbols.

diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -164,7 +164,7 @@
         # we need an indirection via c functions to get macro calls working on llvm XXX still?
         if hasattr(os, 'WCOREDUMP'):
             decl_snippet = """
-            %(ret_type)s pypy_macro_wrapper_%(name)s (int status);
+            RPY_EXTERN %(ret_type)s pypy_macro_wrapper_%(name)s (int status);
             """
             def_snippet = """
             %(ret_type)s pypy_macro_wrapper_%(name)s (int status) {
diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c
--- a/rpython/translator/c/src/debug_print.c
+++ b/rpython/translator/c/src/debug_print.c
@@ -116,7 +116,7 @@
 
 #ifndef _WIN32
 
-     long long pypy_read_timestamp(void)
+     RPY_EXTERN long long pypy_read_timestamp(void)
      {
 #  ifdef CLOCK_THREAD_CPUTIME_ID
        struct timespec tspec;
diff --git a/rpython/translator/c/src/entrypoint.c b/rpython/translator/c/src/entrypoint.c
--- a/rpython/translator/c/src/entrypoint.c
+++ b/rpython/translator/c/src/entrypoint.c
@@ -18,6 +18,7 @@
 #ifdef __GNUC__
 /* Hack to prevent this function from being inlined.  Helps asmgcc
    because the main() function has often a different prologue/epilogue. */
+RPY_EXTERN
 int pypy_main_function(int argc, char *argv[]) __attribute__((__noinline__));
 #endif
 
@@ -26,6 +27,7 @@
 #  include "forwarddecl.h"
 # endif
 
+RPY_EXTERN
 int pypy_main_function(int argc, char *argv[])
 {
     char *errmsg;
diff --git a/rpython/translator/c/src/mem.c b/rpython/translator/c/src/mem.c
--- a/rpython/translator/c/src/mem.c
+++ b/rpython/translator/c/src/mem.c
@@ -15,6 +15,7 @@
 
 static struct pypy_debug_alloc_s *pypy_debug_alloc_list = NULL;
 
+RPY_EXTERN
 void pypy_debug_alloc_start(void *addr, const char *funcname)
 {
   struct pypy_debug_alloc_s *p = malloc(sizeof(struct pypy_debug_alloc_s));
@@ -25,6 +26,7 @@
   pypy_debug_alloc_list = p;
 }
 
+RPY_EXTERN
 void pypy_debug_alloc_stop(void *addr)
 {
   struct pypy_debug_alloc_s **p;
@@ -40,6 +42,7 @@
   RPyAssert(0, "free() of a never-malloc()ed object");
 }
 
+RPY_EXTERN
 void pypy_debug_alloc_results(void)
 {
   long count = 0;
diff --git a/rpython/translator/c/src/rtyper.c b/rpython/translator/c/src/rtyper.c
--- a/rpython/translator/c/src/rtyper.c
+++ b/rpython/translator/c/src/rtyper.c
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-struct _RPyString_dump_t {
+static struct _RPyString_dump_t {
 	struct _RPyString_dump_t *next;
 	char data[1];
 } *_RPyString_dump = NULL;
diff --git a/rpython/translator/c/src/support.c b/rpython/translator/c/src/support.c
--- a/rpython/translator/c/src/support.c
+++ b/rpython/translator/c/src/support.c
@@ -10,6 +10,7 @@
 
 /*** misc ***/
 
+RPY_EXTERN
 void RPyAssertFailed(const char* filename, long lineno,
                      const char* function, const char *msg) {
   fprintf(stderr,
@@ -19,8 +20,8 @@
   abort();
 }
 
+RPY_EXTERN
 void RPyAbort(void) {
   fprintf(stderr, "Invalid RPython operation (NULL ptr or bad array index)\n");
   abort();
 }
-
diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -75,7 +75,7 @@
         t, builder = StandaloneTests.compile(self, *args, **kwds)
         #
         # verify that the executable re-export symbols, but not too many
-        if sys.platform.startswith('linux'):
+        if sys.platform.startswith('linux') and not kwds.get('shared', False):
             seen_main = False
             g = os.popen("objdump -T '%s'" % builder.executable_name, 'r')
             for line in g:
@@ -89,9 +89,13 @@
                 if name == 'main':
                     seen_main = True
                     continue
+                if name == 'pypy_debug_file':     # ok to export this one
+                    continue
                 if 'pypy' in name.lower() or 'rpy' in name.lower():
-                    raise Exception("seeing unexpected exported name %r"
-                                    % (name,))
+                    raise Exception("Unexpected exported name %r.  "
+                        "What is likely missing is RPY_EXTERN before the "
+                        "declaration of this C function or global variable"
+                        % (name,))
             g.close()
             assert seen_main, "did not see 'main' exported"
         #


More information about the pypy-commit mailing list