Mercurial > pub > dyncall > dyncall
annotate configure @ 267:f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
* braindead defaults (e.g. ASFLAGS on pretty much everything GNU, used in default suffix rules with *both* cc for .S and as for .s)
* often took decisions on bogus private STACK headers in ELF files, set on platforms that lack any implementation, so pointless
* tests have shown that only some GNU/* platforms and FreeBSD actually make use of this, if at all, that is... and for those, will switch back to .section .note.GNU-stack (next commit)
author | Tassilo Philipp |
---|---|
date | Sat, 27 May 2017 19:18:23 +0200 |
parents | 91fd7be165f1 |
children | 1032015f77ee |
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 |
267
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
203 # removed, b/c platform support not consistent and ELF flags checked often not having any result |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
204 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
205 ## Assure objects not asking for an execstack (or binary that links dyncall might end |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
206 ## up with one, for no reason). |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
207 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
208 ## .s.o/.S.o rules often use ${CC} which then invokes the tools needed. GCC and |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
209 ## others might (annoyingly) assume that an executable stack may be required for |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
210 ## those sources, if not told explicitly that it isn't. |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
211 ## Neither specifying this per source (e.g. via .section .note.GNU-stack,"",...), nor |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
212 ## per toolchain flags (e.g. as' --noexecstack) turned out to be portable across our |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
213 ## supported platforms, toolchains, and different versions of the latter (some even |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
214 ## producing the opposite result). |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
215 ## Find needed build flags by running a few tests; use default if none result in "rw-". |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
216 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
217 #RWXTESTPREFIX="rwxtest" # @@@ put this maybe all in Makefile.generic? out of source builds? |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
218 #for s in S s ; do ( |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
219 # cd "$BLDTOP" |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
220 # # asm test file, with main and _main for portability. |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
221 # (echo '.text';(echo '.globl main';echo 'main:') | sed 'p;s/m/_m/') > $RWXTESTPREFIX.$s |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
222 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
223 # # Check var to be used, which depends on inference rules of this platform. E.g. ASFLAGS is only common on GNU, and |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
224 # # on some other platforms only CFLAGS is the only one used, others use AFLAGS with cc and thus need -Wa,... Check |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
225 # # makes use of the config written so far, so use '+=' to not overwrite vars. |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
226 # for f in "" "ASFLAGS+=-Wa,--noexecstack" "ACFLAGS+=-Wa,--noexecstack" "AFLAGS+=--noexecstack" "AFLAGS+=-Wa,--noexecstack" "CFLAGS+=-Wa,--noexecstack"; do |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
227 # # dummy makefile triggering inference rules, reflecting dyncall's build |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
228 # make -f - <<MAKEFILE |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
229 #include $C |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
230 #$f |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
231 ## Force dependency via .o, to avoid .[sS].out rules that might be set - also set command as not all platforms set .o.out |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
232 #$RWXTESTPREFIX.out: $RWXTESTPREFIX.o |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
233 # \${CC} \${CFLAGS} \${LDFLAGS} $RWXTESTPREFIX.o \${LDLIBS} -o $RWXTESTPREFIX.out |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
234 #MAKEFILE |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
235 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
236 # # Check what stack of a built test binary would result in. |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
237 ## @@@ add xxd hexdump based versions for when objdump is not available; also check for those if we deal with ELF files |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
238 ## @@@ maybe also limit to ELF files |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
239 # STACKFLAGS=`(which objdump && objdump -p $RWXTESTPREFIX.out) | sed -e '/STACK/bx' -e 'd' -e ':x' -e 'N' -e 's/^.*flags[ \t]\([^ \t]*\).*/\1/'` |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
240 # rm $RWXTESTPREFIX.out $RWXTESTPREFIX.o |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
241 # if [ "$STACKFLAGS" = "rw-" ]; then |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
242 # printf "$f\n" |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
243 # break |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
244 # fi |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
245 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
246 # done |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
247 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
248 # rm $RWXTESTPREFIX.$s |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
249 # |
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
250 #) done 2>&1 | grep '^[ASC]\+FLAGS.*noexecstack$' | uniq >>$C |
258
943c182692e2
- configure: noexecstack flag check/search now reflecting what dyncall build needs/does
Tassilo Philipp
parents:
257
diff
changeset
|
251 |
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
|
252 |
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
|
253 |
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
|
254 # Generate all makefiles needed |
0 | 255 |
256 FILES=`( cd $SRCTOP ; find . -name "Makefile.generic" )` | |
257 for FILE in $FILES ; do | |
258 SRCFILE="$SRCTOP/$FILE" | |
259 BLDFILE="$BLDTOP/$FILE" | |
260 SRCDIR=`dirname $SRCFILE` | |
261 BLDDIR=`dirname $BLDFILE` | |
262 mkdir -p "$BLDDIR" | |
263 cat <<EOF >$BLDDIR/Makefile | |
264 VPATH = $SRCDIR | |
265 include $BLDTOP/Makefile.config | |
266 include \${VPATH}/Makefile.generic | |
267 EOF | |
268 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
|
269 |
267
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
270 echo "Configuration written to $C" |
258
943c182692e2
- configure: noexecstack flag check/search now reflecting what dyncall build needs/does
Tassilo Philipp
parents:
257
diff
changeset
|
271 |