]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dladdr-basic.dtest/main-no-syms.c
dyld-851.27.tar.gz
[apple/dyld.git] / testing / test-cases / dladdr-basic.dtest / main-no-syms.c
1
2 // BUILD: $CC main-no-syms.c -o $BUILD_DIR/dladdr-stripped.exe
3 // BUILD: $STRIP $BUILD_DIR/dladdr-stripped.exe
4
5 // RUN: ./dladdr-stripped.exe
6
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <dlfcn.h>
12 #include <mach-o/dyld_priv.h>
13
14 #include "test_support.h"
15
16 ///
17 /// verify dladdr() returns NULL for a symbol name in a fully stripped
18 /// main executable (and not _mh_execute_header+nnn).
19 ///
20
21 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
22 Dl_info info;
23 if ( dladdr(&main, &info) == 0 ) {
24 FAIL("dladdr(&main, xx) failed");
25 }
26
27 if ( info.dli_sname != NULL ){
28 FAIL("%s\" instead of NULL", info.dli_sname);
29 }
30
31 PASS("Succes");
32 }