hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit acb8670892098f6c444bb09cdc2f82d1abaf6a7f
parent d54e80465e6d384c917e6c4581c3ca16c356064c
Author: Ember Sawady <ecs@d2evs.net>
Date:   Tue, 15 Aug 2023 22:11:38 +0000

pass -z noexecstack to ld

Signed-off-by: Ember Sawady <ecs@d2evs.net>

Diffstat:
MMakefile | 2+-
Mcmd/hare/schedule.ha | 5+++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -62,7 +62,7 @@ $(TESTCACHE)/hare.ssa: $(hare_srcs) $(testlib_deps_any) $(testlib_deps_$(PLATFOR $(BINOUT)/hare: $(HARECACHE)/hare.o @mkdir -p $(BINOUT) @printf 'LD\t%s\n' "$@" - @$(LD) $(LDLINKFLAGS) --gc-sections -T $(rtscript) -o $@ \ + @$(LD) $(LDLINKFLAGS) --gc-sections -z noexecstack -T $(rtscript) -o $@ \ $(HARECACHE)/hare.o $(stdlib_deps_any) $(stdlib_deps_$(PLATFORM)) $(BINOUT)/hare-tests: $(TESTCACHE)/hare.o diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha @@ -125,9 +125,10 @@ fn sched_ld(plan: *plan, output: str, depend: *task...) *task = { }; }; - // Using --gc-sections will not work when using cc as the linker + // Using --gc-sections and -z noexecstack will not work when using cc as + // the linker if (len(plan.libs) == 0 && task.cmd[0] == plan.target.ld_cmd) { - append(task.cmd, "--gc-sections"); + append(task.cmd, ["--gc-sections", "-z", "noexecstack"]...); }; let archives: []str = [];