Changes in tools/autotool.py [795e2bf:ec07933] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/autotool.py
r795e2bf rec07933 48 48 PROBE_OUTPUT = 'probe.s' 49 49 50 PROBE_INT128_SOURCE = 'probe_int128.c'51 PROBE_INT128_OUTPUT = 'probe_int128.s'52 53 50 PACKAGE_BINUTILS = "usually part of binutils" 54 51 PACKAGE_GCC = "preferably version 4.7.0 or newer" … … 88 85 AUTOTOOL_DECLARE("floatsize", "", tag, #type, "", "", sizeof(type)); 89 86 90 extern int main(int, char *[]);91 92 87 int main(int argc, char *argv[]) 93 88 { … … 106 101 """ 107 102 108 PROBE_INT128_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\109 asm volatile ( \\110 "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\111 : \\112 : [val] "n" (value) \\113 )114 115 #define DECLARE_INTSIZE(tag, type) \\116 AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, "", "", sizeof(unsigned type)); \\117 AUTOTOOL_DECLARE("intsize", "signed", tag, #type, "", "", sizeof(signed type));118 119 extern int main(int, char *[]);120 121 int main(int argc, char *argv[])122 {123 """124 125 PROBE_INT128_TAIL = """}126 """127 128 103 def read_config(fname, config): 129 104 "Read HelenOS build configuration" … … 220 195 if (config['CROSS_TARGET'] == "arm32"): 221 196 gnu_target = "arm-linux-gnueabi" 222 clang_target = "arm-unknown- none"197 clang_target = "arm-unknown-linux" 223 198 helenos_target = "arm-helenos-gnueabi" 224 199 225 200 if (config['CROSS_TARGET'] == "ia32"): 226 201 gnu_target = "i686-pc-linux-gnu" 227 clang_target = "i 686-unknown-none"202 clang_target = "i386-unknown-linux" 228 203 helenos_target = "i686-pc-helenos" 229 204 230 205 if (config['CROSS_TARGET'] == "mips32"): 231 cc_args.append("-mabi=32")232 206 gnu_target = "mipsel-linux-gnu" 233 clang_target = "mipsel-unknown- none"207 clang_target = "mipsel-unknown-linux" 234 208 helenos_target = "mipsel-helenos" 209 common['CC_ARGS'].append("-mabi=32") 235 210 236 211 if (config['PLATFORM'] == "amd64"): 237 212 target = config['PLATFORM'] 238 213 gnu_target = "amd64-linux-gnu" 239 clang_target = "x86_64-unknown- none"214 clang_target = "x86_64-unknown-linux" 240 215 helenos_target = "amd64-helenos" 241 216 … … 243 218 target = config['PLATFORM'] 244 219 gnu_target = "arm-linux-gnueabi" 245 clang_target = "arm-unknown- none-eabi"220 clang_target = "arm-unknown-linux" 246 221 helenos_target = "arm-helenos-gnueabi" 247 222 … … 249 224 target = config['PLATFORM'] 250 225 gnu_target = "i686-pc-linux-gnu" 251 clang_target = "i 686-unknown-none"226 clang_target = "i386-unknown-linux" 252 227 helenos_target = "i686-pc-helenos" 253 228 … … 264 239 target = config['PLATFORM'] 265 240 gnu_target = "mipsel-linux-gnu" 266 clang_target = "mipsel-unknown- none"241 clang_target = "mipsel-unknown-linux" 267 242 helenos_target = "mipsel-helenos" 268 243 … … 270 245 target = "mips32eb" 271 246 gnu_target = "mips-linux-gnu" 272 clang_target = "mips-unknown- none"247 clang_target = "mips-unknown-linux" 273 248 helenos_target = "mips-helenos" 274 249 … … 280 255 target = config['PLATFORM'] 281 256 gnu_target = "mips64el-linux-gnu" 282 clang_target = "mips64el-unknown- none"257 clang_target = "mips64el-unknown-linux" 283 258 helenos_target = "mips64el-helenos" 284 259 … … 286 261 target = config['PLATFORM'] 287 262 gnu_target = "ppc-linux-gnu" 288 clang_target = "p pc-unknown-none"263 clang_target = "powerpc-unknown-linux" 289 264 helenos_target = "ppc-helenos" 290 265 … … 297 272 target = config['PLATFORM'] 298 273 gnu_target = "sparc64-linux-gnu" 299 clang_target = "sparc-unknown- none"274 clang_target = "sparc-unknown-linux" 300 275 helenos_target = "sparc64-helenos" 301 276 … … 421 396 422 397 for typedef in floatsizes: 423 outf.write("\ tDECLARE_FLOATSIZE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))398 outf.write("\nDECLARE_FLOATSIZE(\"%s\", %s);\n" % (typedef['tag'], typedef['type'])) 424 399 425 400 outf.write(PROBE_TAIL) … … 535 510 return {'unsigned_sizes': unsigned_sizes, 'signed_sizes': signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags, 'unsigned_strcs': unsigned_strcs, 'signed_strcs': signed_strcs, 'unsigned_concs': unsigned_concs, 'signed_concs': signed_concs, 'float_tags': float_tags, 'builtin_sizes': builtin_sizes, 'builtin_signs': builtin_signs} 536 511 537 def probe_int128(common):538 "Generate, compile and parse probing source for 128-bit integers"539 540 check_common(common, "CC")541 542 outf = open(PROBE_INT128_SOURCE, 'w')543 outf.write(PROBE_INT128_HEAD)544 outf.write("\tDECLARE_INTSIZE(\"INT128\", int __attribute((mode(TI))));\n")545 outf.write(PROBE_INT128_TAIL)546 outf.close()547 548 args = [common['CC']]549 args.extend(common['CC_ARGS'])550 args.extend(["-S", "-o", PROBE_INT128_OUTPUT, PROBE_INT128_SOURCE])551 552 try:553 sys.stderr.write("Checking whether the compiler has intrinsic support for 128-bit integers ... ")554 output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()555 except:556 sys.stderr.write("no\n")557 return False558 559 if (not os.path.isfile(PROBE_INT128_OUTPUT)):560 sys.stderr.write("no\n")561 return False562 563 inf = open(PROBE_INT128_OUTPUT, 'r')564 lines = inf.readlines()565 inf.close()566 567 for j in range(len(lines)):568 tokens = lines[j].strip().split("\t")569 570 if (len(tokens) > 0):571 if (tokens[0] == "AUTOTOOL_DECLARE"):572 if (len(tokens) < 7):573 print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_INT128_OUTPUT, j), COMPILER_FAIL])574 575 category = tokens[1]576 subcategory = tokens[2]577 tag = tokens[3]578 name = tokens[4]579 strc = tokens[5]580 conc = tokens[6]581 value = tokens[7]582 583 if (category == "intsize"):584 try:585 value_int = decode_value(value)586 except:587 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_INT128_OUTPUT, j), COMPILER_FAIL])588 589 if (subcategory == "unsigned"):590 if (value_int != 16):591 sys.stderr.write("no\n")592 return False593 elif (subcategory == "signed"):594 if (value_int != 16):595 sys.stderr.write("no\n")596 return False597 else:598 print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_INT128_OUTPUT, j), COMPILER_FAIL])599 600 sys.stderr.write("yes\n")601 return True602 603 512 def detect_sizes(probe, bytes, inttags, floattags): 604 513 "Detect correct types for fixed-size types" … … 774 683 outmk.close() 775 684 776 def create_header(hdname, maps , int128):685 def create_header(hdname, maps): 777 686 "Create header output" 778 687 … … 794 703 for typedef in maps['typedefs']: 795 704 outhd.write('typedef %s %s;\n' % (typedef['oldtype'], typedef['newtype'])) 796 797 if (int128):798 outhd.write('typedef unsigned int __attribute((mode(TI))) uint128_t;\n')799 outhd.write('typedef signed int __attribute((mode(TI))) int128_t;\n')800 705 801 706 outhd.write('\n#endif\n') … … 893 798 894 799 if (config['COMPILER'] == "icc"): 800 common['CC'] = "icc" 895 801 check_app([common['CC'], "-V"], "Intel C++ Compiler", "support is experimental") 896 802 check_gcc(None, "", common, PACKAGE_GCC) 897 803 check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS) 898 899 common['CC'] = "icc"900 804 901 805 if (config['COMPILER'] == "clang"): … … 941 845 ) 942 846 943 int128 = probe_int128(common)944 945 847 maps = detect_sizes(probe, [1, 2, 4, 8], ['CHAR', 'SHORT', 'INT', 'LONG', 'LLONG'], ['LONG_DOUBLE', 'DOUBLE', 'FLOAT']) 946 848 … … 949 851 950 852 common['AUTOGEN'] = "%s/autogen.py" % os.path.dirname(os.path.abspath(sys.argv[0])) 951 853 952 854 create_makefile(MAKEFILE, common) 953 create_header(HEADER, maps , int128)855 create_header(HEADER, maps) 954 856 955 857 return 0
Note:
See TracChangeset
for help on using the changeset viewer.