fix lib
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 13 Feb 2008 15:56:04 +0000 (15:56 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 13 Feb 2008 15:56:04 +0000 (15:56 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2814 04897980-b3bd-0310-b5e0-8ef037075253

markers-userspace/Makefile
markers-userspace/elf_i386.xmark
markers-userspace/marker-lib.c
markers-userspace/testprog.c

index e770d7377ab9fcec8c1f7a4013a3482b0f3b78e0..9c5135d020c100b3ba914d7ac5a1db5e9a61c03d 100644 (file)
@@ -1,18 +1,21 @@
 
 CC=gcc
 
-all: testprog testprog.S
+all: libtestlib.so testprog testprog.S
 
 marker-lib.o: marker-lib.c marker.h
        $(CC) -O2 -DCONFIG_MARKERS -c -o $@ marker-lib.c
 
 testprog: testprog.c marker.h marker-lib.o
-       $(CC) -Wl,-Telf_i386.xmark -O2 -DCONFIG_MARKERS -o $@ testprog.c marker-lib.o
+       $(CC) -Wl,-Telf_i386.xmark -O2 -DCONFIG_MARKERS -L. -ltestlib -o $@ testprog.c marker-lib.o
 
 testprog.S: testprog.c marker.h
        $(CC) -O2 -DCONFIG_MARKERS -S -o $@ testprog.c
 
+libtestlib.so: testlib.c marker.h marker-lib.o
+       $(CC) -Wl,-Telf_i386.xmark -O2 -DCONFIG_MARKERS -shared -o $@ testlib.c marker-lib.o
+
 .PHONY: clean
 
 clean:
-       rm -f testprog testprog.S marker-lib.o
+       rm -f testprog testprog.S marker-lib.o libtestlib.so
index 9ea3ead81659fe73737a8532cd9eb132718d4b24..c3ca3d9728105af8e084900585b95c93015d0ac9 100644 (file)
@@ -135,9 +135,9 @@ SECTIONS
   {
     *(.data .data.* .gnu.linkonce.d.*)
     . = ALIGN(8);
-    PROVIDE_HIDDEN (__start___markers = .);
+    PROVIDE (__start___markers = .);
     *(__markers)
-    PROVIDE_HIDDEN (__stop___markers = .);
+    PROVIDE (__stop___markers = .);
     KEEP (*(.gnu.linkonce.d.*personality*))
     SORT(CONSTRUCTORS)
   }
index e5ae4fb8baa174bdbd4832b72a9068b6337dcea2..2c42d4c8394ce9a86cefa05cd7e6b2e80f929212 100644 (file)
@@ -3,8 +3,8 @@
 #include <stdio.h>
 #include <errno.h>
 
-extern struct marker __start___markers[];
-extern struct marker __stop___markers[];
+__attribute__ ((visibility ("protected"))) extern struct marker __start___markers[];
+__attribute__ ((visibility ("protected"))) extern struct marker __stop___markers[];
 
 /**
  * __mark_empty_function - Empty probe callback
@@ -18,6 +18,7 @@ extern struct marker __stop___markers[];
  * though the function pointer change and the marker enabling are two distinct
  * operations that modifies the execution flow of preemptible code.
  */
+__attribute__ ((visibility ("protected")))
 void __mark_empty_function(void *probe_private, void *call_private,
        const char *fmt, va_list *args)
 {
@@ -31,6 +32,7 @@ void __mark_empty_function(void *probe_private, void *call_private,
  * @...:  Variable argument list.
  *
  */
+__attribute__ ((visibility ("protected")))
 void marker_probe_cb(const struct marker *mdata, void *call_private,
        const char *fmt, ...)
 {
@@ -41,14 +43,20 @@ void marker_probe_cb(const struct marker *mdata, void *call_private,
 
 //FIXME : imv_read won't work with optimized immediate values.
 //will need to issue one sys_marker call for each immediate value.
+__attribute__ ((visibility ("protected")))
+void testip(void)
+{
+       printf("addr : %p\n", __builtin_return_address(0));
+}
 
-__attribute__((constructor)) void marker_init(void)
+__attribute__((constructor, visibility ("protected"))) void marker_init(void)
 {
        struct marker *iter;
        int ret;
 
        printf("Marker section : from %p to %p (init)\n",
                __start___markers, __stop___markers);
+       testip();
        for (iter = __start___markers; iter < __stop___markers; iter++) {
                printf("Marker : %s\n", iter->name);
                ret = sys_marker(iter->name, iter->format,
@@ -58,7 +66,7 @@ __attribute__((constructor)) void marker_init(void)
        }
 }
 
-__attribute__((destructor)) void marker_fini(void)
+static __attribute__((destructor, visibility ("protected"))) void marker_fini(void)
 {
        struct marker *iter;
        int ret;
index 5f25e83076ef7529e7da689c4476e2147d3d18d5..5c3010a88c849fe1abc763447d5270eaa13943b3 100644 (file)
@@ -2,6 +2,8 @@
 #include <unistd.h>
 #include "marker.h"
 
+extern void testfct(void);
+
 int main(int argc, char **argv)
 {
        void *ptr;
@@ -9,6 +11,7 @@ int main(int argc, char **argv)
 
        while (1) {
                trace_mark(test_marker, "ptr %p val %lu", ptr, val);
+               testfct();
                sleep(2);
        }
        return 0;
This page took 0.026669 seconds and 4 git commands to generate.