Skip to content

Commit

Permalink
Update gcc compile flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrack committed Jan 26, 2022
1 parent e905fd4 commit 80edca3
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions tools/toolchain/scripts/stage0/install_gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ case "${with_gcc}" in
#
# TODO: Unfortunately, we can not simply use --disable-shared, because
# it would break OpenBLAS build and probably others too.
COMMON_FLAGS="-O2 -fPIC -fno-omit-frame-pointer -fopenmp -g"
CFLAGS="${COMMON_FLAGS} -std=gnu99"
CXXFLAGS="${CFLAGS}"
FCFLAGS="${COMMON_FLAGS} -fbacktrace"
${GCCROOT}/configure --prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--enable-languages=c,c++,fortran \
Expand All @@ -70,8 +74,9 @@ case "${with_gcc}" in
--enable-plugins \
> configure.log 2>&1 || tail -n ${LOG_LINES} configure.log
make -j $(get_nprocs) \
CFLAGS="-fPIC ${CFLAGS}" \
CXXFLAGS="-fPIC ${CXXFLAGS}" \
CFLAGS="${CFLAGS}" \
CXXFLAGS="${CXXFLAGS}" \
FCFLAGS="${FCFLAGS}" \
> make.log 2>&1 || tail -n ${LOG_LINES} make.log
make -j $(get_nprocs) install > install.log 2>&1 || tail -n ${LOG_LINES} install.log
# thread sanitizer
Expand All @@ -85,19 +90,22 @@ case "${with_gcc}" in
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55374#c10
cd x86_64*/libgfortran
make clean > clean.log 2>&1 || tail -n ${LOG_LINES} clean.log
CFLAGS="${CFLAGS} -fsanitize=thread"
CXXFLAGS="${CXXFLAGS} -fsanitize=thread"
FCFLAGS="${FCFLAGS} -fsanitize=thread"
make -j $(get_nprocs) \
CFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
FCFLAGS="-g -O2 -fsanitize=thread" \
CXXFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
CFLAGS="${CFLAGS}" \
CXXFLAGS="${CXXFLAGS}" \
FCFLAGS="${FCFLAGS}" \
LDFLAGS="-B$(pwd)/../libsanitizer/tsan/.libs/ -Wl,-rpath,$(pwd)/../libsanitizer/tsan/.libs/ -fsanitize=thread" \
> make.log 2>&1 || tail -n ${LOG_LINES} make.log
make install > install.log 2>&1 || tail -n ${LOG_LINES} install.log
cd ../libgomp
make clean > clean.log 2>&1 || tail -n ${LOG_LINES} clean.log
make -j $(get_nprocs) \
CFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
FCFLAGS="-g -O2 -fsanitize=thread" \
CXXFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
CFLAGS="${CFLAGS}" \
CXXFLAGS="${CXXFLAGS}" \
FCFLAGS="${FCFLAGS}" \
LDFLAGS="-B$(pwd)/../libsanitizer/tsan/.libs/ -Wl,-rpath,$(pwd)/../libsanitizer/tsan/.libs/ -fsanitize=thread" \
> make.log 2>&1 || tail -n ${LOG_LINES} make.log
make install > install.log 2>&1 || tail -n ${LOG_LINES} install.log
Expand Down

0 comments on commit 80edca3

Please sign in to comment.