File: test-rpathlink.sh

package info (click to toggle)
scratchbox2 2.2.4-1debian1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 5,392 kB
  • ctags: 5,239
  • sloc: ansic: 21,734; sh: 4,360; perl: 2,170; cpp: 1,913; makefile: 610; python: 184
file content (25 lines) | stat: -rw-r--r-- 578 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# LD_LIBRARY_PATH is readed by the normal linker
# Especially the recursive library lookup is tested
set -e


cat > liblo.c <<EOF
int alowcall(int a,int b) {return a+b;}
EOF

cat > libhi.c <<EOF
int alowcall(int a,int b);
int ahicall(int a) {return alowcall(a,-a);}
EOF

cat > hiuser.c <<EOF
int ahicall(int a);
int main(void) {return ahicall(27);}
EOF

mkdir lo hi
gcc -fPIC liblo.c -shared -o lo/liblo.so
gcc -fPIC libhi.c -shared -o hi/libhi.so -Llo -llo
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:lo gcc hiuser.c -Lhi -lhi -o foouser
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:hi:lo ./foouser