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