Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 26bcc658 in mainline


Ignore:
Timestamp:
2013-03-11T13:54:47Z (7 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
master
Children:
dd870b1
Parents:
1570759b
Message:

Run clang with -target in autotool

This ensures that sizes of long/int/short are determined correctly
(based on target architecture, not a host one).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/autotool.py

    r1570759b r26bcc658  
    182182                             "Please contact the developers of HelenOS."])
    183183
    184 def get_target(config):
     184def get_target(config, needs_clang = False):
    185185        target = None
    186186        gnu_target = None
     187        clang_target = None
    187188       
    188189        if (config['PLATFORM'] == "abs32le"):
     
    203204                target = config['PLATFORM']
    204205                gnu_target = "amd64-linux-gnu"
     206                clang_target = "x86_64-uknown-linux"
    205207       
    206208        if (config['PLATFORM'] == "arm32"):
     
    211213                target = config['PLATFORM']
    212214                gnu_target = "i686-pc-linux-gnu"
     215                clang_target = "i386-uknown-linux"
    213216       
    214217        if (config['PLATFORM'] == "ia64"):
     
    244247                gnu_target = "sparc64-linux-gnu"
    245248       
    246         if (target is None) or (gnu_target is None):
     249        if (target is None) or (gnu_target is None) or (clang_target is None and needs_clang):
    247250                print_error(["Failed to determine target for compiler.",
    248251                             "Please contact the developers of HelenOS."])
    249252       
    250         return (target, gnu_target)
     253        return (target, gnu_target, clang_target)
    251254
    252255def check_app(args, name, details):
     
    710713                common['CC_ARGS'] = []
    711714                if (config['COMPILER'] == "gcc_cross"):
    712                         target, gnu_target = get_target(config)
     715                        target, gnu_target, clang_target_unused = get_target(config)
    713716                               
    714717                        path = "%s/%s/bin" % (cross_prefix, target)
     
    735738               
    736739                if (config['COMPILER'] == "clang"):
    737                         target, gnu_target = get_target(config)
     740                        target, gnu_target, clang_target = get_target(config, True)
    738741                        path = "%s/%s/bin" % (cross_prefix, target)
    739742                        prefix = "%s-" % gnu_target
    740743                       
    741744                        common['CC'] = "clang"
     745                        common['CC_ARGS'].append("-target")
     746                        common['CC_ARGS'].append(clang_target)
    742747                        check_app([common['CC'], "--version"], "Clang compiler", "preferably version 1.0 or newer")
    743748                        check_gcc(path, prefix, common, PACKAGE_GCC)
Note: See TracChangeset for help on using the changeset viewer.