--- Makefile.rules.orig 2023-01-12 11:42:40 UTC +++ Makefile.rules @@ -107,6 +107,11 @@ ifeq ($(C_COMPILER_FAMILY),clang) # Clang -Werror warning suppressions ifeq ($(C_COMPILER_FAMILY),clang) CC_CFLAGS+=-Wno-unused-value -Wno-parentheses-equality + BINARY_LLD_FLAGS= -z noexecstack + LLD_EMULATION=%%LLD_EMULATION%% +else + BINARY_LLD_FLAGS= + LLD_EMULATION= endif ifeq ($(GNU_LD),1) @@ -213,10 +218,10 @@ endif # extern const size_t _binary_abc_def_xml_size; %.o: %.xml $(ECHO_PREFIX) echo " [LD] $^ -> $@" - $(CMD_PREFIX) $(CC) -g -Wl,-znoexecstack -nostartfiles -nodefaultlibs -nostdlib -r -Wl,-b,binary -o $@ $^ + $(CMD_PREFIX) $(CC) -g -Wl,-znoexecstack -nostartfiles -nodefaultlibs -nostdlib $(BINARY_LLD_FLAGS) -r -Wl,-b,binary,-m,$(LLD_EMULATION) -o $@ $^ %.o: %.xslt $(ECHO_PREFIX) echo " [LD] $^ -> $@" - $(CMD_PREFIX) $(CC) -g -Wl,-znoexecstack -nostartfiles -nodefaultlibs -nostdlib -r -Wl,-b,binary -o $@ $^ + $(CMD_PREFIX) $(CC) -g -Wl,-znoexecstack -nostartfiles -nodefaultlibs -nostdlib $(BINARY_LLD_FLAGS) -r -Wl,-b,binary,-m,$(LLD_EMULATION) -o $@ $^ dist-clean:: clean