Last active
January 15, 2023 15:15
-
-
Save depressed-pho/2d379beb39759d810c93d19dda42eede to your computer and use it in GitHub Desktop.
Binutils 2.39 on NetBSD-current
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
.text | |
.globl main | |
.type main, @function | |
main: | |
ret |
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
gnu-stack: merged.o | |
cc -o $@ merged.o | |
@{ readelf -e $@ | grep -A1 GNU_STACK; } || echo " $@ has no .note.GNU-stack" | |
merged.o: main.o sub.o sub2.o | |
ld -r -o $@ main.o sub.o sub2.o | |
@{ readelf -e $@ | grep -A1 GNU-stack; } || echo " $@ has no .note.GNU-stack" | |
.s.o: | |
cc -o $@ -c $< | |
@{ readelf -e $@ | grep -A1 GNU-stack; } || echo " $@ has no .note.GNU-stack" | |
.c.o: | |
cc -o $@ -c $< | |
@{ readelf -e $@ | grep -A1 GNU-stack; } || echo " $@ has no .note.GNU-stack" | |
.PHONY: clean | |
clean: | |
rm -f *.o gnu-stack |
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 | |
cc -o main.o -c main.s | |
main.o has no .note.GNU-stack | |
cc -o sub.o -c sub.s | |
[ 4] .note.GNU-stack PROGBITS 0000000000000000 00000041 | |
0000000000000000 0000000000000000 0 0 1 | |
cc -o sub2.o -c sub2.c | |
sub2.o has no .note.GNU-stack | |
ld -r -o merged.o main.o sub.o sub2.o | |
ld: warning: sub2.o: missing .note.GNU-stack section implies executable stack | |
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker | |
[ 7] .note.GNU-stack PROGBITS 0000000000000000 000000a4 | |
0000000000000000 0000000000000000 X 0 0 1 | |
cc -o gnu-stack merged.o | |
ld: warning: merged.o: requires executable stack (because the .note.GNU-stack section is executable) | |
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 | |
0x0000000000000000 0x0000000000000000 RWE 0x10 |
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
.text | |
.globl sub | |
.type sub, @function | |
sub: | |
ret | |
.section .note.GNU-stack,"",@progbits |
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
void sub2() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment