mirror of
				https://sourceware.org/git/glibc.git
				synced 2025-10-30 10:45:40 +03:00 
			
		
		
		
	* elf/Makefile: Add rules to build and run initfirst test. * elf/initfirst.c: New file. * elf/firstobj.c: New file.
		
			
				
	
	
		
			23 lines
		
	
	
		
			378 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			378 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <dlfcn.h>
 | |
| #include <stdio.h>
 | |
| 
 | |
| int
 | |
| main (void)
 | |
| {
 | |
|   void *h = dlopen ("firstobj.so", RTLD_LAZY);
 | |
|   void *f;
 | |
|   if (! h)
 | |
|     {
 | |
|       printf ("cannot find firstobj.so: %s\n", dlerror ());
 | |
|       return 1;
 | |
|     }
 | |
|   f = dlsym (h, "foo");
 | |
|   if (! f)
 | |
|     {
 | |
|       printf ("cannot find symbol foo: %s\n", dlerror ());
 | |
|       return 2;
 | |
|     }
 | |
|   ((void (*) (void)) f) ();
 | |
|   return 0;
 | |
| }
 |