xref: /haiku/src/tests/system/runtime_loader/test_suite/load_resolve_weak1 (revision 5b189b0e1e2f51f367bfcb126b2f00a3702f352d)
1#!/bin/sh
2
3# program
4# <- liba.so
5#
6# Expected: Weak symbol in liba.so resolves to symbol in program,
7# not to symbol in liba.so.
8
9
10. ./test_setup
11
12
13# create liba.so
14cat > liba.c << EOI
15int __attribute__((weak)) c() { return 2; }
16int __attribute__((weak)) a() { return c(); }
17int (*a_p)() = &c;
18int b() { return (*a_p)(); }
19EOI
20
21# build
22compile_lib -o liba.so liba.c
23
24# create program
25cat > program.c << EOI
26extern int a();
27extern int b();
28
29int c()
30{
31	return 4;
32}
33
34int
35main()
36{
37	return a() + b();
38}
39EOI
40
41# build
42compile_program -o program program.c ./liba.so
43
44# run
45test_run_ok ./program 8
46
47