Skip to content

Commit d74b08c

Browse files
committed
Set NX_COMPAT flag
As the generated binary doesn't contain any code, it is trivially compatible with NX. Unconditionally set the NX_COMPAT flag using the post-process-pe program from Shim. Signed-off-by: Ross Lagerwall <[email protected]>
1 parent c443a5f commit d74b08c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# Executables
1313
*.efi
14+
post-process-pe
1415

1516
# EFI Security Database files
1617
*.esl

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,18 @@ certwrapper.efi : OBJFLAGS = --strip-unneeded $(call VENDOR_DB, $<)
9494
certwrapper.efi : SECTIONS=.text .reloc .db .sbat
9595
certwrapper.efi : VENDOR_DB_FILE?=db.esl
9696

97-
%.efi : %.so
97+
%.efi : %.so post-process-pe
9898
ifneq ($(OBJCOPY_GTE224),1)
9999
$(error objcopy >= 2.24 is required)
100100
endif
101101
$(OBJCOPY) $(foreach section,$(SECTIONS),-j $(section) ) \
102102
--file-alignment 512 --section-alignment 4096 -D \
103103
$(OBJFLAGS) \
104-
$(FORMAT) $^ $@
104+
$(FORMAT) $< $@
105+
./post-process-pe -vv -n -x $@
106+
107+
post-process-pe: post-process-pe.c
108+
$(CC) -std=gnu11 -Og -g3 -Wall -Wextra -Wno-missing-field-initializers -Werror -o $@ $<
105109

106110
sbat_data.o : | $(SBATPATH) $(VENDOR_SBATS)
107111
sbat_data.o : /dev/null
@@ -120,7 +124,7 @@ sbat_data.o : /dev/null
120124
$(CC) $(BUILDFLAGS) -c -o $@ $^
121125

122126
clean :
123-
@rm -vf *.o *.so *.efi
127+
@rm -vf *.o *.so *.efi post-process-pe
124128

125129
update :
126130
git submodule update --init --recursive

0 commit comments

Comments
 (0)