Mercurial > pub > dyncall > dyncall
annotate configure @ 256:7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
- since no-execstack handling is now in build, remove .note.GNU-stack section markers (were of limites use, anyways, b/c unportable or implemented inconsistently across platforms)
- some ToDo, etc. updates
author | Tassilo Philipp |
---|---|
date | Sat, 20 May 2017 00:02:59 +0200 |
parents | 5cfe4322c500 |
children | 8bb4618c18d8 |
rev | line source |
---|---|
0 | 1 #!/bin/sh |
2 | |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
3 usage() { |
0 | 4 cat <<EOF |
5 usage: $0 --<option>=<value> <var>=<value> .. | |
6 | |
7 --prefix=<dir> | |
8 --target=<platform> uname/special targets: MacOSX,iOS,iPhoneSimulator | |
30
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
9 use "?" to get a list of explicitly specifiable |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
10 targets |
0 | 11 --sdk=<version> Mac OS X/iOS SDK version (e.g. '6.1' or '10.9.3') |
12 Tested iOS SDK versions: 4.3, 6.1, 8.1 | |
13 --sdkroot=<dir> | |
14 | |
15 Useful variables CC, CXX, CFLAGS, CXXFLAGS, etc.. | |
16 | |
17 EOF | |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
18 } |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
19 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
20 C=Makefile.config |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
21 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
22 # get full path to this file (portable way), and set where to build |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
23 SRCTOP="`cd \`dirname "$0"\` && pwd`" |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
24 BLDTOP="$PWD" |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
25 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
26 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
27 printf "# auto-generated by $0\n" >$C |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
28 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
29 while [ $# -gt 0 ]; do |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
30 X=$1 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
31 shift 1 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
32 case $X in |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
33 # Shell common: |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
34 --help|-h|-?) |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
35 usage |
0 | 36 exit 1 |
37 ;; | |
38 # GNU Compatibility: | |
39 --prefix=*) | |
40 PREFIX=`printf -- "${X}" | cut -c 10-` | |
41 ;; | |
42 --target=*) | |
43 TARGET=`printf -- "${X}" | cut -c 10-` | |
44 ;; | |
45 --sdk=*) | |
46 SDK=`printf -- "${X}" | cut -c 7-` | |
47 ;; | |
48 --sdkroot=*) | |
49 SDKROOT=`printf -- "${X}" | cut -c 11-` | |
50 ;; | |
51 # Environment variables: | |
52 [A-Za-z_]*=*) | |
53 printf "${X}\n" >>$C | |
54 k=`printf "${X}" | cut -d = -f 1` | |
55 v=`printf "${X}" | cut -d = -f 2` | |
56 export $k="$v" | |
57 ;; | |
58 # Others fail: | |
59 *) | |
60 printf "error: invalid option ${X}\n" >&2 | |
61 exit 1 | |
62 ;; | |
63 esac | |
64 done | |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
65 |
0 | 66 printf "PREFIX=${PREFIX:=/usr/local}\n" >>$C |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
67 |
0 | 68 case ${TARGET:=`uname`} in |
253
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
69 Linux|GNU/kFreeBSD) |
0 | 70 if [ -z "${CFLAGS}" ]; then |
71 printf "CFLAGS=-fPIC\n" >>$C | |
72 fi | |
73 printf "LDLIBS=-lm -ldl\n" >>$C | |
74 ;; | |
75 OpenBSD) | |
253
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
76 if [ -z "${CFLAGS}" ]; then |
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
77 # dl_iterate_phdr() got introduced in 3.7, so for older versions force DL_DLADDR_TO_LIBPATH |
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
78 if (uname -r | grep '^\([0-2]\.\|3\.[0-6]\)' > /dev/null); then |
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
79 printf "CFLAGS=-fPIC -DDL_DLADDR_TO_LIBPATH\n" >>$C |
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
80 else |
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
81 printf "CFLAGS=-fPIC\n" >>$C |
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
82 fi |
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
83 fi |
0 | 84 printf "LDLIBS=-lm\n" >>$C |
85 ;; | |
253
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
86 NetBSD|DragonFly) |
0 | 87 if [ -z "${CFLAGS}" ]; then |
88 printf "CFLAGS=-fPIC\n" >>$C | |
89 fi | |
90 printf "LDLIBS=-lm\n" >>$C | |
91 ;; | |
92 FreeBSD) | |
93 if [ -z "${CFLAGS}" ]; then | |
94 printf "CFLAGS=-fPIC\n" >>$C | |
95 fi | |
96 printf "LDLIBS=-lm\n" >>$C | |
97 printf "RM=rm -f\n" >>$C | |
98 ;; | |
99 MacOSX|Darwin) | |
100 # if Apple's libtool (not to be confused with GNU's) is available, which is according to libtool(1) "with -static [...] intended | |
101 # to replace ar(5) and ranlib", use it - if it is shadowed by some install of GNU's libtool assume that a foreign environment is | |
102 # intentionally used, and fall back to using 'ar rs' (the equivalent to 'libtool -static'), for compatibility: | |
103 if libtool -V >/dev/null 2>/dev/null; then # Apple's libtool has -V for version, which GNU does not. | |
104 printf "AR=libtool\n" >>$C | |
105 printf "ARFLAGS=-static -o\n" >>$C | |
106 else | |
107 printf "AR=ar\n" >>$C | |
108 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives | |
109 fi | |
110 if [ `uname -n` = 'iPhone' ]; then # building on iPhone itself, uname yields Darwin (gcc setup for current/correct arch) | |
111 printf "CC=gcc\n" >>$C | |
112 elif [ -z ${SDK} ]; then | |
113 case `sw_vers -productVersion` in | |
114 10.4.*) | |
115 ARCHS="-arch ppc -arch i386 -arch x86_64" | |
116 ;; | |
5
52deacbdd2b1
- fix from MoarVM team and Tobi Leich for osx configure
cslag
parents:
0
diff
changeset
|
117 10.5.*) |
0 | 118 ARCHS="-arch i386 -arch x86_64 -arch ppc" |
119 ;; | |
120 10.6.*) | |
121 ARCHS="-arch i386 -arch x86_64" | |
122 ;; | |
222
700c67984c08
- fix to configure for universal binary support for >= macos el capitan
Tassilo Philipp
parents:
170
diff
changeset
|
123 10.[789].*|10.1?.*|10.1?) |
0 | 124 ARCHS="-arch x86_64 -arch i386" |
125 ;; | |
126 esac | |
127 printf "ASFLAGS=${ARCHS}\n" >>$C | |
128 printf "CFLAGS=${ARCHS}\n" >>$C | |
129 printf "CXXFLAGS=${ARCHS}\n" >>$C | |
130 else | |
131 if [ -z ${SDKROOT} ]; then | |
132 SDKROOT="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SDK}.sdk" | |
133 fi | |
134 printf "CFLAGS=-isysroot ${SDKROOT}\n" >>$C | |
135 printf "CXXFLAGS=-isysroot ${SDKROOT}\n" >>$C | |
136 fi | |
137 ;; | |
138 iPhoneOS|iOS) | |
139 if [ -z ${SDKROOT} ]; then | |
140 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK}.sdk" | |
141 fi | |
142 if [ -z "${ARCHS}" ]; then | |
143 case "${SDK}" in | |
144 [45].*) | |
145 ARCHS="-arch armv6" | |
146 ;; | |
147 [67].*) | |
148 ARCHS="-arch armv7" | |
149 ;; | |
53 | 150 [89].*) |
0 | 151 ARCHS="-arch armv7 -arch arm64" |
152 ;; | |
153 esac | |
154 fi | |
155 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives | |
156 printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
157 printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
158 printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
159 printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C | |
160 ;; | |
161 iPhoneSimulator) | |
162 if [ -z ${SDKROOT} ]; then | |
163 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK}.sdk" | |
164 fi | |
165 ARCHS="-arch i386" | |
166 printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
167 printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
168 printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
169 printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C | |
170 ;; | |
171 SunOS) | |
172 # open distributions often don't come with default cc and CC, check for common alternatives. | |
170 | 173 printf "CC=` (which cc gcc clang ) | grep -v '^no ' | head -1`\n" >>$C |
174 printf "CXX=`(which CC g++ clang++) | grep -v '^no ' | head -1`\n" >>$C # C++ compiler traditionally named CC | |
175 printf "CCC=\${CXX}\n" >>$C # Sun make's rules use CCC for c++ compiler | |
253
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
176 printf "LDLIBS=-lm -ldl\n" >>$C |
0 | 177 ;; |
178 Minix) | |
179 printf "CC=gcc\n" >>$C | |
180 printf "CXX=g++\n">>$C | |
181 printf "AR=ar\n" >>$C | |
182 ;; | |
183 PSP) | |
184 SDKROOT="`psp-config --pspsdk-path`" | |
185 printf "CC=psp-gcc\n" >>$C | |
186 printf "CXX=psp-gcc\n">>$C # don't use psp-g++, buggy | |
187 printf "AR=psp-ar\n" >>$C | |
188 printf "CFLAGS=-I${SDKROOT}/include/\n" >>$C | |
189 printf "CXXFLAGS=-I${SDKROOT}/include/\n" >>$C | |
190 # Pulling in dyncall libs below is a hack, for some reason psp-ld is super-picky about order. | |
191 # Use your C lib of choice, from the PSPSDK, or... | |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
192 #printf "LDLIBS=-L${SDKROOT}/lib/ -L${SRCTOP}/dyncall -L${SRCTOP}/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lpsplibc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C |
0 | 193 # ... newlib. |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
194 printf "LDLIBS=-L${SDKROOT}/lib/ -L${SRCTOP}/dyncall -L${SRCTOP}/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C |
0 | 195 ;; |
30
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
196 ?) |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
197 cat $0 | awk '/^esac$/{b=0}/^ [A-Za-z0-9|]+\)/{if(b==1) print substr($1,1,length($1)-1)}BEGIN{b=0}/^case.*TARGET.*uname.*in$/{b=1}' | tr '|' '\n' |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
198 exit 0 |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
199 ;; |
0 | 200 esac |
201 | |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
202 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
203 # Assure objects not asking for an execstack (or binary that links dyncall might end |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
204 # up with one, for no reason). |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
205 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
206 # We run our .s and .S files through $CC. GCC and others (annoyingly) assume without |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
207 # being told explicitly that an executable stack may be required for those. |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
208 # Trying to specify this per source via .section .note.GNU-stack,"",... turned out to |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
209 # be not consistently implemented across our supported platforms and toolchains, and |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
210 # thus not being portable (on some platforms even resulting in the opposite, the mere |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
211 # presence of this section, no matter the flags, creating an rwx stack). |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
212 # So, let's set the needed build flags by running a few tests, if we find any that |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
213 # work. |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
214 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
215 #determine_asflags() { |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
216 # AS_PROG=".global main\nmain:\n" |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
217 # echo "${AS_PROG}" | cc -xassembler -o rwxtest.d.out - |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
218 # echo "${AS_PROG}.section .note.GNU-stack,\"\"" | cc -xassembler -o rwxtest.s.out - |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
219 # echo "${AS_PROG}" | cc -xassembler -o rwxtest.f.out -Wa,--noexecstack - |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
220 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
221 # @@@ find solution for platforms without objdump |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
222 RWXTESTBIN="$BLDTOP/rwxtest.out" # @@@ put this maybe all in Makefile.generic? out of source builds? |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
223 STACKFLAGS=`make -f - <<MAKEFILE |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
224 include $C |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
225 t: |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
226 @(echo .global main;echo main:) | \\\${CC} -xassembler -o "$RWXTESTBIN" -Wa,--noexecstack - |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
227 @(which objdump && objdump -p "$RWXTESTBIN") | grep -A1 STACK | sed '1d;s/^.*flags //' | awk '{print \\\$1}' |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
228 MAKEFILE |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
229 ` |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
230 rm "$RWXTESTBIN" 2>/dev/null |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
231 if [ "$STACKFLAGS" = "rw-" ]; then |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
232 # platforms differe here, so set them all |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
233 printf "ASFLAGS=-Wa,--noexecstack\n" >>$C # common on GNU |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
234 printf "ACFLAGS=-Wa,--noexecstack\n" >>$C # specifically for .S.o |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
235 printf "AFLAGS=--noexecstack\n" >>$C # for direct assembler invocation |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
236 fi |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
237 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
238 #if echo ".global main\nmain:\n" | cc -xassembler -o rwxtest.f.out -Wa,--noexecstack - |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
239 #(which objdump && objdump -p rwxtest.f.out || echo stack flags lookup_err) | grep -i -A1 stack | grep 'flags.*' | sed 's/^.*flags //' |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
240 #} |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
241 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
242 #printf "ACFLAGS=-Wa,--noexecstack\n" >>$C |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
243 #printf "AFLAGS=--noexecstack\n" >>$C |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
244 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
245 |
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
246 # Generate all makefiles needed |
0 | 247 |
248 FILES=`( cd $SRCTOP ; find . -name "Makefile.generic" )` | |
249 for FILE in $FILES ; do | |
250 SRCFILE="$SRCTOP/$FILE" | |
251 BLDFILE="$BLDTOP/$FILE" | |
252 SRCDIR=`dirname $SRCFILE` | |
253 BLDDIR=`dirname $BLDFILE` | |
254 mkdir -p "$BLDDIR" | |
255 cat <<EOF >$BLDDIR/Makefile | |
256 VPATH = $SRCDIR | |
257 include $BLDTOP/Makefile.config | |
258 include \${VPATH}/Makefile.generic | |
259 EOF | |
260 done | |
256
7520e2260097
- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents:
253
diff
changeset
|
261 |