Created
January 9, 2013 23:55
-
-
Save goodell/4498137 to your computer and use it in GitHub Desktop.
my (failed) attempt at creating a small reproducer for macports bug #36654 (https://trac.macports.org/ticket/36654)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__thread int t = 0xdeadbeef; | |
int foo(void) | |
{ | |
return t; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clang -g -Wall -dynamiclib -o libbar.dylib bar.c | |
clang -g -Wall -Wl,-no_pie foo.c -L. -lbar | |
(the above command was expected to segfault the linker) | |
./a.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <sys/wait.h> | |
extern int foo(void); | |
extern __thread int t; | |
int main(int argc, char *argv[]) | |
{ | |
printf("before change %#x\n", foo()); | |
t = 0xcafebabe; | |
printf("after change %#x\n", foo()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment