aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/thumb_flags.go
blob: 0edaf4ffc3a44f38e69369f9316753ba76117274 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package main

import (
	"strings"
)

func processThumbCodeFlags(builder *commandBuilder) {
	arch := builder.target.arch
	if builder.target.abi != "eabi" && (strings.HasPrefix(arch, "armv7") || strings.HasPrefix(arch, "armv8")) {
		// ARM32 specfic:
		// 1. Generate thumb codes by default.  GCC is configured with
		//    --with-mode=thumb and defaults to thumb mode already.  This
		//    changes the default behavior of clang and doesn't affect GCC.
		// 2. Do not force frame pointers on ARM32 (https://crbug.com/693137).
		builder.addPreUserArgs("-mthumb")
		builder.transformArgs(func(arg builderArg) string {
			if !arg.fromUser && arg.value == "-fno-omit-frame-pointer" {
				return ""
			}
			return arg.value
		})
	}
}