This file contains hidden or 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
| package rs_test | |
| import ( | |
| "fmt" | |
| "reflect" | |
| "testing" | |
| ) | |
| type X interface { | |
| Set(string) |
This file contains hidden or 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
| package main | |
| import ( | |
| "bytes" | |
| "flag" | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "os" | |
| "path/filepath" |
This file contains hidden or 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
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "io" | |
| "log" | |
| "os" | |
| "time" | |
| ) |
This file contains hidden or 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 <stdio.h> | |
| #include <sys/mman.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <err.h> | |
| int | |
| main(int argc, char **argv) | |
| { | |
| void *v = sbrk(4096); |
This file contains hidden or 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
| To show why compiling without -fPIC still matters and why compilers don't default to -fPIC unless | |
| it's strictly necessary: | |
| $ cat > foo.c | |
| int foo(void) { return 1; } | |
| $ cat > bar.c | |
| int foo(void); | |
| int bar(void) { return foo(); } | |
| $ cc -fPIC -c foo.c && cc -fPIC -c bar.c && cc -rdynamic -fPIC -shared -L . -o foobar.so foo.o bar.o | |
| $ objdump -S foobar.so |