forked from swojtasiak/jsrdbg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Commons.mk
33 lines (28 loc) · 1.1 KB
/
Commons.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SUFFIXES = .js .js.lo
# Previous versions of ld utility were broken and ignored noexecstack.
# It's why we have to use such an ugly hack in order to fix .note.GNU-stack
# section using objcopy.
.js.js.lo:
$(LD) -r -o "$*.js.o" -z noexecstack --format=binary "$<"
if HAVE_OBJCOPY
$(OBJCOPY) --rename-section .data=.rodata,alloc,load,readonly,data,contents "$*.js.o"
$(OBJCOPY) --add-section ".note.GNU-stack"=`ls -1 $(top_srcdir)/fix/*.o | head -1` $*.js.o 2>/dev/null; true
else
@echo "objcopy not found - data sections cannot be changed to readonly ones and .note.GNU-stack cannot be fixed."
endif
@echo "# $@ - a libtool object file" > "$@"
@echo "# Generated by $(shell $(LIBTOOL) --version | head -n 1)" >>"$@"
@echo "#" >>"$@"
@echo "# Please DO NOT delete this file!" >>"$@"
@echo "# It is necessary for linking the library." >>"$@"
@echo >>"$@"
@echo "# Name of the PIC object." >>"$@"
@echo "pic_object='$*.js.o'" >>"$@"
@echo >>"$@"
@echo "# Name of the non-PIC object" >>"$@"
@echo "non_pic_object='$*.js.o'" >>"$@"
@echo >>"$@"
CLEANFILES = *.js.lo \
*.js.o
EXTRA_DIST = *.js \
package.json