1 ; How to make the shared objects from this file: 2 ; 3 ; LDARGS="--unresolved-symbols=ignore-all -soname=libfoo.so --no-as-needed -lc -lm" 4 ; 5 ; X86-32 ELF: 6 ; llc -mtriple=i386-linux-gnu shared.ll -filetype=obj -o tmp32.o -relocation-model=pic 7 ; ld -melf_i386 -shared tmp32.o -o shared-object-test.elf-i386 $LDARGS 8 ; 9 ; X86-64 ELF: 10 ; llc -mtriple=x86_64-linux-gnu shared.ll -filetype=obj -o tmp64.o -relocation-model=pic 11 ; ld -melf_x86_64 -shared tmp64.o -o shared-object-test.elf-x86-64 $LDARGS 12 13 @defined_sym = global i32 1, align 4 14 15 @tls_sym = thread_local global i32 2, align 4 16 17 @undef_sym = external global i32 18 19 @undef_tls_sym = external thread_local global i32 20 21 @common_sym = common global i32 0, align 4 22 23 define i32 @global_func() nounwind uwtable { 24 entry: 25 ret i32 0 26 } 27 28 declare i32 @undef_func(...) 29 30 define internal i32 @local_func() nounwind uwtable { 31 entry: 32 ret i32 0 33 } 34