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

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

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

source "$LIBRARY/util/option.sh"

build_options+=('relocs' 'relocs-gcc')
buildenv_functions+=('buildenv_relocs')

buildenv_relocs() {
  if check_buildoption "relocs" "y" || check_buildoption "relocs-gcc" "y"; then
	CFLAGS+=" -fno-reorder-blocks-and-partition"
	CXXFLAGS+=" -fno-reorder-blocks-and-partition"
	LDFLAGS+=" -Wl,--emit-relocs"
	check_buildoption "relocs" "y" && \
	LDFLAGS+=" -Wl,--emit-relocs"
  fi
}