1# -*- coding: utf-8 -*- 2# Copyright 2018 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6"""Check whether the compile unit is not built by gcc.""" 7 8from __future__ import print_function 9 10from allowlist import is_allowlisted 11 12 13def not_by_gcc(dso_path, producer, comp_path): 14 """Check whether the compile unit is not built by gcc. 15 16 Args: 17 dso_path: path to the elf/dso. 18 producer: DW_AT_producer contains the compiler command line. 19 comp_path: DW_AT_comp_dir + DW_AT_name. 20 21 Returns: 22 False if compiled by gcc otherwise True. 23 """ 24 if is_allowlisted('ngcc_comp_path', comp_path): 25 return True 26 27 if is_allowlisted('ngcc_dso_path', dso_path): 28 return True 29 30 return 'GNU C' not in producer 31