2
0

shared.ll 883 B

123456789101112131415161718192021222324252627282930313233
  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. @defined_sym = global i32 1, align 4
  13. @tls_sym = thread_local global i32 2, align 4
  14. @undef_sym = external global i32
  15. @undef_tls_sym = external thread_local global i32
  16. @common_sym = common global i32 0, align 4
  17. define i32 @global_func() nounwind uwtable {
  18. entry:
  19. ret i32 0
  20. }
  21. declare i32 @undef_func(...)
  22. define internal i32 @local_func() nounwind uwtable {
  23. entry:
  24. ret i32 0
  25. }