Browse Source

Change build tool to only specify no-pie for clang >= 6.0.0

master
cancel 6 years ago
parent
commit
8514233eae
  1. 15
      tool

15
tool

@ -111,6 +111,10 @@ timed_stats() {
fi fi
} }
version_string_normalized() {
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';
}
if [[ ($os == bsd) || ($os == unknown) ]]; then if [[ ($os == bsd) || ($os == unknown) ]]; then
warn "Build script not tested on this platform" warn "Build script not tested on this platform"
fi fi
@ -143,6 +147,14 @@ if [[ -z $cc_vers ]]; then
warn "Failed to detect compiler version" warn "Failed to detect compiler version"
fi fi
cc_vers_is_gte() {
if [[ $(version_string_normalized "$cc_vers") -ge $(version_string_normalized "$1") ]]; then
return 0
else
return 1
fi
}
add() { add() {
if [[ -z "${1:-}" ]]; then if [[ -z "${1:-}" ]]; then
script_error "At least one argument required for array add" script_error "At least one argument required for array add"
@ -179,8 +191,11 @@ build_target() {
if [[ $pie_enabled = 1 ]]; then if [[ $pie_enabled = 1 ]]; then
add cc_flags -pie -fpie -Wl,-pie add cc_flags -pie -fpie -Wl,-pie
elif [[ $os != mac ]]; then elif [[ $os != mac ]]; then
# Only explicitly specify no-pie for clang if version >= 6.0.0
if [[ $cc_id == gcc ]] || cc_vers_is_gte "6.0.0"; then
add cc_flags -no-pie -fno-pie add cc_flags -no-pie -fno-pie
fi fi
fi
if [[ $static_enabled = 1 ]]; then if [[ $static_enabled = 1 ]]; then
add cc_flags -static add cc_flags -static
fi fi

Loading…
Cancel
Save