Selaa lähdekoodia

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

Eric Andersen 23 vuotta sitten
vanhempi
commit
183799fd6e
2 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  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");
+}
+
+
+