aboutsummaryrefslogtreecommitdiff
path: root/build-gcc/opts.sh
blob: d1e6fadbb4d6b1cae168a3e9e3ab0892d344b4a8 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
get_gcc_configure_options()
{
  local CTARGET=$1; shift
  local confgcc=$(get_gcc_common_options)
  case ${CTARGET} in
    arm*)	#264534
      local arm_arch="${CTARGET%%-*}"
      # Only do this if arm_arch is armv*
      if [[ ${arm_arch} == armv* ]] ; then
        # Convert armv7{a,r,m} to armv7-{a,r,m}
        [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
        # Remove endian ('l' / 'eb')
        [[ ${arm_arch} == *l  ]] && arm_arch=${arm_arch%l}
        [[ ${arm_arch} == *eb ]] && arm_arch=${arm_arch%eb}
        confgcc="${confgcc} --with-arch=${arm_arch}"
        confgcc="${confgcc} --disable-esp"
      fi
      ;;
    i?86*)
      # Hardened is enabled for x86, but disabled for ARM.
      confgcc="${confgcc} --with-arch=atom"
      confgcc="${confgcc} --enable-esp"
      ;;
  esac
  echo ${confgcc}
}

get_gcc_common_options()
{
  local confgcc
  # TODO(asharif): Build without these options.
  confgcc="${confgcc} --disable-libmudflap"
  confgcc="${confgcc} --disable-libssp"
  confgcc="${confgcc} --disable-libgomp"
  confgcc="${confgcc} --enable-__cxa_atexit"
  confgcc="${confgcc} --enable-checking=release"
  confgcc="${confgcc} --disable-libquadmath"
  echo ${confgcc}
}