• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package main
6
7import (
8	"strings"
9)
10
11func processThumbCodeFlags(builder *commandBuilder) {
12	arch := builder.target.arch
13	if builder.target.abi != "eabi" && (strings.HasPrefix(arch, "armv7") || strings.HasPrefix(arch, "armv8")) {
14		// ARM32 specfic:
15		// 1. Generate thumb codes by default.  GCC is configured with
16		//    --with-mode=thumb and defaults to thumb mode already.  This
17		//    changes the default behavior of clang and doesn't affect GCC.
18		// 2. Do not force frame pointers on ARM32 (https://crbug.com/693137).
19		builder.addPreUserArgs("-mthumb")
20		builder.transformArgs(func(arg builderArg) string {
21			if !arg.fromUser && arg.value == "-fno-omit-frame-pointer" {
22				return ""
23			}
24			return arg.value
25		})
26	}
27}
28