aboutsummarylogtreecommitdiffstats
path: root/relocsgcc.sh.in
blob: 32a6f2fb299eeacad38eb74a053e4df8703a8922 (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
#!/usr/bin/bash
#
#   Enable relocations at the linker for give llvm-bolt the possibility to reorder functions
#

[[ -n "$LIBMAKEPKG_BUILDENV_RELOCSGCC_SH" ]] && return
LIBMAKEPKG_BUILDENV_RELOCSGCC_SH=1

LIBRARY=${LIBRARY:-'/usr/share/makepkg'}

source "$LIBRARY/util/option.sh"

build_options+=('relocsgcc')
buildenv_functions+=('buildenv_relocsgcc')

buildenv_relocsgcc() {
    if check_buildoption "relocsgcc" "y";then
        relocsldflags=" -Wl,--emit-relocs"
        relocsflags=" -fno-reorder-blocks-and-partition"

        CFLAGS+="$relocsflags"
        CXXFLAGS+="$relocsflags"
        LDFLAGS+="$relocsldflags"
    fi
}