aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/M68k/TLS/tlsle.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/M68k/TLS/tlsle.ll')
0 files changed, 0 insertions, 0 deletions
/span>(compiler, lang): if lang == 'cpp': lang = 'c++' env = os.environ.copy() env["LC_ALL"] = 'C' cmd = compiler + ['-x{}'.format(lang), '-E', '-v', '-'] p = subprocess.Popen( cmd, stdin=subprocess.DEVNULL, stderr=subprocess.PIPE, stdout=subprocess.PIPE, env=env ) stderr = p.stderr.read().decode('utf-8', errors='replace') parse_state = 0 paths = [] for line in stderr.split('\n'): if parse_state == 0: if line == '#include "..." search starts here:': parse_state = 1 elif parse_state == 1: if line == '#include <...> search starts here:': parse_state = 2 else: paths.append(line[1:]) elif parse_state == 2: if line == 'End of search list.': break else: paths.append(line[1:]) if len(paths) == 0: mlog.warning('No include directory found parsing "{cmd}" output'.format(cmd=" ".join(cmd))) return paths class GnuCompiler: # Functionality that is common to all GNU family compilers. def __init__(self, gcc_type, defines): self.id = 'gcc' self.gcc_type = gcc_type self.defines = defines or {} self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', 'b_colorout', 'b_ndebug', 'b_staticpic'] if self.gcc_type == GCC_OSX: self.base_options.append('b_bitcode') else: self.base_options.append('b_lundef') self.base_options.append('b_asneeded') # All GCC backends can do assembly self.can_compile_suffixes.add('s') # TODO: centralise this policy more globally, instead # of fragmenting it into GnuCompiler and ClangCompiler def get_asneeded_args(self): if self.gcc_type == GCC_OSX: return APPLE_LD_AS_NEEDED else: return GNU_LD_AS_NEEDED def get_colorout_args(self, colortype): if mesonlib.version_compare(self.version, '>=4.9.0'): return gnu_color_args[colortype][:] return [] def get_warn_args(self, level): args = super().get_warn_args(level) if mesonlib.version_compare(self.version, '<4.8.0') and '-Wpedantic' in args: # -Wpedantic was added in 4.8.0 # https://gcc.gnu.org/gcc-4.8/changes.html args[args.index('-Wpedantic')] = '-pedantic' return args def has_builtin_define(self, define): return define in self.defines def get_builtin_define(self, define): if define in self.defines: return self.defines[define] def get_pic_args(self): if self.gcc_type in (GCC_CYGWIN, GCC_MINGW, GCC_OSX): return [] # On Window and OS X, pic is always on. return ['-fPIC'] def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): if self.gcc_type == GCC_OSX: return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] def get_pch_suffix(self): return 'gch' def split_shlib_to_parts(self, fname): return os.path.dirname(fname), fname def get_soname_args(self, prefix, shlib_name, suffix, soversion, is_shared_module): return get_gcc_soname_args(self.gcc_type, prefix, shlib_name, suffix, soversion, is_shared_module) def get_std_shared_lib_link_args(self): return ['-shared'] def get_link_whole_for(self, args): return ['-Wl,--whole-archive'] + args + ['-Wl,--no-whole-archive'] def gen_vs_module_defs_args(self, defsfile): if not isinstance(defsfile, str): raise RuntimeError('Module definitions file should be str') # On Windows targets, .def files may be specified on the linker command # line like an object file. if self.gcc_type in (GCC_CYGWIN, GCC_MINGW): return [defsfile] # For other targets, discard the .def file. return [] def get_gui_app_args(self): if self.gcc_type in (GCC_CYGWIN, GCC_MINGW): return ['-mwindows'] return [] def get_instruction_set_args(self, instruction_set): return gnulike_instruction_set_args.get(instruction_set, None) def get_default_include_dirs(self): return gnulike_default_include_dirs(self.exelist, self.language) def openmp_flags(self): return ['-fopenmp'] class ElbrusCompiler(GnuCompiler): # Elbrus compiler is nearly like GCC, but does not support # PCH, LTO, sanitizers and color output as of version 1.21.x. def __init__(self, gcc_type, defines): GnuCompiler.__init__(self, gcc_type, defines) self.id = 'lcc' self.base_options = ['b_pgo', 'b_coverage', 'b_ndebug', 'b_staticpic', 'b_lundef', 'b_asneeded'] def get_library_dirs(self): env = os.environ.copy() env['LC_ALL'] = 'C' stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=env)[1] paths = [] for line in stdo.split('\n'): if line.startswith('libraries:'): # lcc does not include '=' in --print-search-dirs output. libstr = line.split(' ', 1)[1] paths = [os.path.realpath(p) for p in libstr.split(':')] break return paths def get_program_dirs(self): env = os.environ.copy() env['LC_ALL'] = 'C' stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=env)[1] paths = [] for line in stdo.split('\n'): if line.startswith('programs:'): # lcc does not include '=' in --print-search-dirs output. libstr = line.split(' ', 1)[1] paths = [os.path.realpath(p) for p in libstr.split(':')] break return paths class ClangCompiler: def __init__(self, clang_type): self.id = 'clang' self.clang_type = clang_type self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', 'b_ndebug', 'b_staticpic', 'b_colorout'] if self.clang_type == CLANG_OSX: self.base_options.append('b_bitcode') else: self.base_options.append('b_lundef') self.base_options.append('b_asneeded') # All Clang backends can do assembly and LLVM IR self.can_compile_suffixes.update(['ll', 's']) # TODO: centralise this policy more globally, instead # of fragmenting it into GnuCompiler and ClangCompiler def get_asneeded_args(self): if self.clang_type == CLANG_OSX: return APPLE_LD_AS_NEEDED else: return GNU_LD_AS_NEEDED def get_pic_args(self): if self.clang_type in (CLANG_WIN, CLANG_OSX): return [] # On Window and OS X, pic is always on. return ['-fPIC'] def get_colorout_args(self, colortype): return clang_color_args[colortype][:] def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): if self.clang_type == CLANG_OSX: return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] def get_pch_suffix(self): return 'pch' def get_pch_use_args(self, pch_dir, header): # Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136 # This flag is internal to Clang (or at least not documented on the man page) # so it might change semantics at any time. return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))] def get_soname_args(self, prefix, shlib_name, suffix, soversion, is_shared_module): if self.clang_type == CLANG_STANDARD: gcc_type = GCC_STANDARD elif self.clang_type == CLANG_OSX: gcc_type = GCC_OSX elif self.clang_type == CLANG_WIN: gcc_type = GCC_MINGW else: raise MesonException('Unreachable code when converting clang type to gcc type.') return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, soversion, is_shared_module) def has_multi_arguments(self, args, env): myargs = ['-Werror=unknown-warning-option', '-Werror=unused-command-line-argument'] if mesonlib.version_compare(self.version, '>=3.6.0'): myargs.append('-Werror=ignored-optimization-argument') return super().has_multi_arguments( myargs + args, env) def has_function(self, funcname, prefix, env, extra_args=None, dependencies=None): if extra_args is None: extra_args = [] # Starting with XCode 8, we need to pass this to force linker # visibility to obey OS X and iOS minimum version targets with # -mmacosx-version-min, -miphoneos-version-min, etc. # https://github.com/Homebrew/homebrew-core/issues/3727 if self.clang_type == CLANG_OSX and version_compare(self.version, '>=8.0'): extra_args.append('-Wl,-no_weak_imports') return super().has_function(funcname, prefix, env, extra_args, dependencies) def get_std_shared_module_link_args(self, options): if self.clang_type == CLANG_OSX: return ['-bundle', '-Wl,-undefined,dynamic_lookup'] return ['-shared'] def get_link_whole_for(self, args): if self.clang_type == CLANG_OSX: result = [] for a in args: result += ['-Wl,-force_load', a] return result return ['-Wl,--whole-archive'] + args + ['-Wl,--no-whole-archive'] def get_instruction_set_args(self, instruction_set): return gnulike_instruction_set_args.get(instruction_set, None) def get_default_include_dirs(self): return gnulike_default_include_dirs(self.exelist, self.language) def openmp_flags(self): if version_compare(self.version, '>=3.8.0'): return ['-fopenmp'] elif version_compare(self.version, '>=3.7.0'): return ['-fopenmp=libomp'] else: # Shouldn't work, but it'll be checked explicitly in the OpenMP dependency. return [] class ArmclangCompiler: def __init__(self): if not self.is_cross: raise EnvironmentException('armclang supports only cross-compilation.') # Check whether 'armlink.exe' is available in path self.linker_exe = 'armlink.exe' args = '--vsn' try: p, stdo, stderr = Popen_safe(self.linker_exe, args) except OSError as e: err_msg = 'Unknown linker\nRunning "{0}" gave \n"{1}"'.format(' '.join([self.linker_exe] + [args]), e) raise EnvironmentException(err_msg) # Verify the armlink version ver_str = re.search('.*Component.*', stdo) if ver_str: ver_str = ver_str.group(0) else: EnvironmentException('armlink version string not found') # Using the regular expression from environment.search_version, # which is used for searching compiler version version_regex = '(?<!(\d|\.))(\d{1,2}(\.\d+)+(-[a-zA-Z0-9]+)?)' linker_ver = re.search(version_regex, ver_str) if linker_ver: linker_ver = linker_ver.group(0) if not version_compare(self.version, '==' + linker_ver): raise EnvironmentException('armlink version does not match with compiler version') self.id = 'armclang' self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', 'b_ndebug', 'b_staticpic', 'b_colorout'] # Assembly self.can_compile_suffixes.update('s') def can_linker_accept_rsp(self): return False def get_pic_args(self): # PIC support is not enabled by default for ARM, # if users want to use it, they need to add the required arguments explicitly return [] def get_colorout_args(self, colortype): return clang_color_args[colortype][:] def get_buildtype_args(self, buildtype): return armclang_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): return arm_buildtype_linker_args[buildtype] # Override CCompiler.get_std_shared_lib_link_args def get_std_shared_lib_link_args(self): return [] def get_pch_suffix(self): return 'gch' def get_pch_use_args(self, pch_dir, header): # Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136 # This flag is internal to Clang (or at least not documented on the man page) # so it might change semantics at any time. return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))] # Override CCompiler.get_dependency_gen_args def get_dependency_gen_args(self, outtarget, outfile): return [] # Override CCompiler.build_rpath_args def build_rpath_args(self, build_dir, from_dir, rpath_paths, build_rpath, install_rpath): return [] def get_linker_exelist(self): return [self.linker_exe] # Tested on linux for ICC 14.0.3, 15.0.6, 16.0.4, 17.0.1 class IntelCompiler: def __init__(self, icc_type): self.id = 'intel' self.icc_type = icc_type self.lang_header = 'none' self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', 'b_colorout', 'b_ndebug', 'b_staticpic', 'b_lundef', 'b_asneeded'] # Assembly self.can_compile_suffixes.add('s') def get_pic_args(self): return ['-fPIC'] def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): return gnulike_buildtype_linker_args[buildtype] def get_pch_suffix(self): return 'pchi' def get_pch_use_args(self, pch_dir, header): return ['-pch', '-pch_dir', os.path.join(pch_dir), '-x', self.lang_header, '-include', header, '-x', 'none'] def get_pch_name(self, header_name): return os.path.basename(header_name) + '.' + self.get_pch_suffix() def split_shlib_to_parts(self, fname): return os.path.dirname(fname), fname def get_soname_args(self, prefix, shlib_name, suffix, soversion, is_shared_module): if self.icc_type == ICC_STANDARD: gcc_type = GCC_STANDARD elif self.icc_type == ICC_OSX: gcc_type = GCC_OSX elif self.icc_type == ICC_WIN: gcc_type = GCC_MINGW else: raise MesonException('Unreachable code when converting icc type to gcc type.') return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, soversion, is_shared_module) # TODO: centralise this policy more globally, instead # of fragmenting it into GnuCompiler and ClangCompiler def get_asneeded_args(self): if self.icc_type == CLANG_OSX: return APPLE_LD_AS_NEEDED else: return GNU_LD_AS_NEEDED def get_std_shared_lib_link_args(self): # FIXME: Don't know how icc works on OSX # if self.icc_type == ICC_OSX: # return ['-bundle'] return ['-shared'] def get_default_include_dirs(self): return gnulike_default_include_dirs(self.exelist, self.language) def openmp_flags(self): if version_compare(self.version, '>=15.0.0'): return ['-qopenmp'] else: return ['-openmp'] def get_link_whole_for(self, args): return GnuCompiler.get_link_whole_for(self, args) class ArmCompiler: # Functionality that is common to all ARM family compilers. def __init__(self): if not self.is_cross: raise EnvironmentException('armcc supports only cross-compilation.') self.id = 'arm' default_warn_args = [] self.warn_args = {'1': default_warn_args, '2': default_warn_args + [], '3': default_warn_args + []} # Assembly self.can_compile_suffixes.add('s') def can_linker_accept_rsp(self): return False def get_pic_args(self): # FIXME: Add /ropi, /rwpi, /fpic etc. qualifiers to --apcs return [] def get_buildtype_args(self, buildtype): return arm_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): return arm_buildtype_linker_args[buildtype] # Override CCompiler.get_always_args def get_always_args(self): return [] # Override CCompiler.get_dependency_gen_args def get_dependency_gen_args(self, outtarget, outfile): return [] # Override CCompiler.get_std_shared_lib_link_args def get_std_shared_lib_link_args(self): return [] def get_pch_use_args(self, pch_dir, header): # FIXME: Add required arguments # NOTE from armcc user guide: # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05 # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported # PCH files." return [] def get_pch_suffix(self): # NOTE from armcc user guide: # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05 # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported # PCH files." return 'pch' def thread_flags(self, env): return [] def thread_link_flags(self, env): return [] def get_linker_exelist(self): args = ['armlink'] return args def get_coverage_args(self): return [] def get_coverage_link_args(self): return []