瀏覽代碼

Add a simple test for shared lib ctor/dtors
-Erik

Eric Andersen 23 年之前
父節點
當前提交
183799fd6e
共有 2 個文件被更改,包括 13 次插入0 次删除
  1. 1 0
      test/ldso/Makefile
  2. 12 0
      test/ldso/howdy.c

+ 1 - 0
test/ldso/Makefile

@@ -19,6 +19,7 @@
 TESTDIR=../
 include $(TESTDIR)/Rules.mak
 
+CFLAGS+=--uclibc-ctors
 all: dltest libhowdy.so run
 
 dltest.o: dltest.c

+ 12 - 0
test/ldso/howdy.c

@@ -5,3 +5,15 @@ int howdy(const char *s)
 	return printf("howdy: %s\n", s);
 }
 
+void __attribute__((constructor)) howdy_ctor(void)
+{
+	printf("I am the libhowdy constructor!\n");
+}
+
+void __attribute__((destructor)) howdy_dtor(void)
+{
+	printf("I am the libhowdy destructor!\n");
+}
+
+
+