Last active
November 3, 2015 19:30
-
-
Save o11c/05775e1af61ee8936257 to your computer and use it in GitHub Desktop.
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
| # Make sure the indentation is tabs | |
| override CC += -fPIE | |
| override LDFLAGS += -pie | |
| all: foo | |
| file $< | |
| nm *.o | |
| foo: foo.o | |
| foo.o: foo.c | |
| foo.c: FORCE | |
| echo '#include <stdio.h>' > $@ | |
| echo 'int main() { puts("Hello, World!"); }' >> $@ | |
| FORCE: |
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
| echo '#include <stdio.h>' > foo.c | |
| echo 'int main() { puts("Hello, World!"); }' >> foo.c | |
| cc -fPIE -c -o foo.o foo.c | |
| cc -fPIE -pie foo.o -o foo | |
| file foo | |
| foo: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=70891543e59184ab2045c33e3f2ff5bc96dc292f, not stripped | |
| nm *.o | |
| U _GLOBAL_OFFSET_TABLE_ | |
| 0000000000000000 T main | |
| U puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment