Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created December 6, 2013 22:45
Show Gist options
  • Save alexcrichton/7833435 to your computer and use it in GitHub Desktop.
Save alexcrichton/7833435 to your computer and use it in GitHub Desktop.
@foo = thread_local global i32 3
define i32 @main() {
%1 = load i32* @foo
ret i32 %1
}
// ./x86_64-apple-darwin/llvm/Release+Asserts/bin/llc foo.ll -filetype=obj
// gcc -o foo foo.o
// ./foo
@agrif
Copy link

agrif commented Dec 6, 2013

Output:

agrif@anduril:~/local/rust$ ./x86_64-apple-darwin/llvm/Release+Asserts/bin/llc foo.ll -filetype=obj
agrif@anduril:~/local/rust$ gcc -o foo foo.o
Undefined symbols for architecture x86_64:
  "__tlv_bootstrap", referenced from:
      _foo in foo.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
agrif@anduril:~/local/rust$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment