aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-01-06 22:45:29 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-01-06 22:45:29 +0100
commit6be0d03ae89ffef23a0da0d759fbe36e90ae220a (patch)
treead92c0f14ade3948fc23a0af1a2ca1718acc6df1
parentebf8d357bd09e6eef9bbe74250fea06641090998 (diff)
downloaddynld-6be0d03ae89ffef23a0da0d759fbe36e90ae220a.tar.gz
dynld-6be0d03ae89ffef23a0da0d759fbe36e90ae220a.zip
disable stack protector for simplicity of these linker studies
-rw-r--r--02_process_init/Makefile13
-rw-r--r--03_hello_dynld/Makefile1
-rw-r--r--04_dynld_nostd/Makefile3
-rw-r--r--lib/Makefile1
4 files changed, 11 insertions, 7 deletions
diff --git a/02_process_init/Makefile b/02_process_init/Makefile
index 0b51903..4f3d98c 100644
--- a/02_process_init/Makefile
+++ b/02_process_init/Makefile
@@ -4,12 +4,13 @@ show: entry
./entry 1 2 3 4
entry: entry.S entry.c ../lib/libcommon.a
- gcc -o $@ \
- -g -O0 \
- -Wall -Wextra \
- -I../lib/include \
- -nostdlib \
- -static \
+ gcc -o $@ \
+ -g -O0 \
+ -Wall -Wextra \
+ -I../lib/include \
+ -nostdlib \
+ -static \
+ -fno-stack-protector \
$^
../lib/libcommon.a:
diff --git a/03_hello_dynld/Makefile b/03_hello_dynld/Makefile
index 0db8281..76c4f2e 100644
--- a/03_hello_dynld/Makefile
+++ b/03_hello_dynld/Makefile
@@ -23,6 +23,7 @@ dynld.so: dynld.S dynld.c ../lib/libcommon.a
-fvisibility=hidden \
-Wl,--entry=dl_start \
-Wl,--no-undefined \
+ -fno-stack-protector \
$^
@if ! readelf -r $@ | grep 'There are no relocations in this file' >& /dev/null; then \
diff --git a/04_dynld_nostd/Makefile b/04_dynld_nostd/Makefile
index f953e94..e3260d4 100644
--- a/04_dynld_nostd/Makefile
+++ b/04_dynld_nostd/Makefile
@@ -2,7 +2,7 @@
COMMON_CFLAGS := -g -O0 -Wall -Wextra \
-I../lib/include \
- -nostartfiles -nodefaultlibs
+ -nostartfiles -nodefaultlibs -fno-stack-protector
run: main
./$<
@@ -61,3 +61,4 @@ dynld.so: dynld.S dynld.c ../lib/libcommon.a
clean:
rm -f main libgreet.so
rm -f dynld.so
+ make -C ../lib clean
diff --git a/lib/Makefile b/lib/Makefile
index 5f8a1a9..6006be5 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -23,6 +23,7 @@ src/%.o: src/%.c
-Wall -Wextra \
-I$(CURDIR)/include \
-nostdlib \
+ -fno-stack-protector \
$<
clean: