libsanitizer/mips: always build with largefile support
Commit Message
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 is always used for mips
when build libsanitizer in LLVM. Thus
FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 176 : 160, 216);
instead of
FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 160 : 144, 216);
in sanitizer_platform_limits_posix.h.
To keep sync with LLVM and to make the code simple, we use the
largefile options always.
libsanitizer/
* configure.ac: set -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
always for mips*.
* configure: Regenerate.
---
libsanitizer/configure | 13 ++++++++++---
libsanitizer/configure.ac | 12 ++++++++++--
2 files changed, 20 insertions(+), 5 deletions(-)
Comments
On Fri, 6 Jan 2023, YunQiang Su wrote:
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 is always used for mips
> when build libsanitizer in LLVM. Thus
> FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 176 : 160, 216);
> instead of
> FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 160 : 144, 216);
> in sanitizer_platform_limits_posix.h.
>
> To keep sync with LLVM and to make the code simple, we use the
> largefile options always.
>
> libsanitizer/
> * configure.ac: set -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> always for mips*.
> * configure: Regenerate.
Hm, yes, that might be the most pragmatic way to solve the mips
stat-size issue... But shouldn't then largefile-options also be
forced when libsanitizer is *used*? IOW, mips*-linux
gcc-options be tweaked to include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 conditional on sanitizer-options?
brgds, H-P
Hans-Peter Nilsson <hp@bitrange.com> 于2023年1月11日周三 08:53写道:
>
> On Fri, 6 Jan 2023, YunQiang Su wrote:
>
> > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 is always used for mips
> > when build libsanitizer in LLVM. Thus
> > FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 176 : 160, 216);
> > instead of
> > FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 160 : 144, 216);
> > in sanitizer_platform_limits_posix.h.
> >
> > To keep sync with LLVM and to make the code simple, we use the
> > largefile options always.
> >
> > libsanitizer/
> > * configure.ac: set -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> > always for mips*.
> > * configure: Regenerate.
>
> Hm, yes, that might be the most pragmatic way to solve the mips
> stat-size issue... But shouldn't then largefile-options also be
> forced when libsanitizer is *used*? IOW, mips*-linux
> gcc-options be tweaked to include -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64 conditional on sanitizer-options?
>
Sound a good idea...
While I am worrying about some application may fail to build or
trigger some other problems.
> brgds, H-P
@@ -17045,9 +17045,16 @@ else
$as_echo "no" >&6; }
fi
-EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"
-EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $CET_FLAGS"
-EXTRA_ASFLAGS=$CET_FLAGS
+# Always set -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to sync with LLVM,
+# and keep struct *stat* have the same size.
+case "${host}" in
+ mips*-*) FILE64_FLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ;;
+ *) FILE64_FLAGS="" ;;
+esac
+
+EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS $FILE64_FLAGS"
+EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $CET_FLAGS $FILE64_FLAGS"
+EXTRA_ASFLAGS="$CET_FLAGS $FILE64_FLAGS"
@@ -416,8 +416,16 @@ GCC_BASE_VER
# Add CET specific flags if Intel CET is enabled.
GCC_CET_FLAGS(CET_FLAGS)
-EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"
-EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $CET_FLAGS"
+
+# Always set -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to sync with LLVM,
+# and keep struct *stat* have the same size.
+case "${host}" in
+ mips*-*) FILE64_FLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ;;
+ *) FILE64_FLAGS="" ;;
+esac
+
+EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS $FILE64_FLAGS"
+EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $CET_FLAGS $FILE64_FLAGS"
EXTRA_ASFLAGS=$CET_FLAGS
AC_SUBST(EXTRA_ASFLAGS)
AC_SUBST(EXTRA_CFLAGS)