ro created this revision.
ro added reviewers: fedor.sergeev, rsmith.
ro added a project: clang.
`make check-all` currently fails on `x86_64-pc-solaris2.11` when building with
GCC 9:
Undefined first referenced
symbol in file
_ZN11__sanitizer14internal_lseekEimi
SANITIZER_TEST_OBJECTS.sanitizer_libc_test.cc.i386.o
_ZN11__sanitizer23MapWritableFileToMemoryEPvmim
SANITIZER_TEST_OBJECTS.sanitizer_libc_test.cc.i386.o
ld: fatal: symbol referencing errors
clang-9: error: linker command failed with exit code 1 (use -v to see
invocation)
make[3]: ***
[projects/compiler-rt/lib/sanitizer_common/tests/CMakeFiles/TSanitizer-i386-Test.dir/build.make:92:
projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-i386-Test] Error 1
While e.g. `__sanitizer::internal_lseek` is defined in `sanitizer_solaris.cc`,
g++ 9
predefines `_FILE_OFFSET_BITS=64` while clang++ currently does not.
This patch resolves this inconsistency by following the gcc lead, which allows
`make check-all` to finish successfully.
There's one caveat: gcc defines `_LARGEFILE_SOURCE` and `_LARGEFILE64_SOURCE`
for C++ only, while clang has long been doing it for
all languages. I'd like to keep it this way because those macros do is to make
declarations of `fseek`/`ftello` (`_LARGEFILE_SOURCE`) resp. the 64-bit versions
of largefile functions (`*64` with `_LARGEFILE64_SOURCE`) visible additionally.
However, `_FILE_OFFSET_BITS=64` changes all affected functions to be
largefile-aware.
I'd like to restrict this to C++, just like gcc does.
To avoid a similar inconsistence with host compilers that don't predefine
`_FILE_OFFSET_BITS=64`
(e.g. clang < 9, gcc < 9), this needs a compantion patch to be submitted
shortly.
Tested on `x86_64-pc-solaris2.11`. Ok for trunk?
Repository:
rC Clang
https://reviews.llvm.org/D64482
Files:
lib/Basic/Targets/OSTargets.h
Index: lib/Basic/Targets/OSTargets.h
===================================================================
--- lib/Basic/Targets/OSTargets.h
+++ lib/Basic/Targets/OSTargets.h
@@ -618,8 +618,11 @@
Builder.defineMacro("_XOPEN_SOURCE", "600");
else
Builder.defineMacro("_XOPEN_SOURCE", "500");
- if (Opts.CPlusPlus)
+ if (Opts.CPlusPlus) {
Builder.defineMacro("__C99FEATURES__");
+ Builder.defineMacro("_FILE_OFFSET_BITS", "64");
+ }
+ // GCC restricts the next two to C++.
Builder.defineMacro("_LARGEFILE_SOURCE");
Builder.defineMacro("_LARGEFILE64_SOURCE");
Builder.defineMacro("__EXTENSIONS__");
Index: lib/Basic/Targets/OSTargets.h
===================================================================
--- lib/Basic/Targets/OSTargets.h
+++ lib/Basic/Targets/OSTargets.h
@@ -618,8 +618,11 @@
Builder.defineMacro("_XOPEN_SOURCE", "600");
else
Builder.defineMacro("_XOPEN_SOURCE", "500");
- if (Opts.CPlusPlus)
+ if (Opts.CPlusPlus) {
Builder.defineMacro("__C99FEATURES__");
+ Builder.defineMacro("_FILE_OFFSET_BITS", "64");
+ }
+ // GCC restricts the next two to C++.
Builder.defineMacro("_LARGEFILE_SOURCE");
Builder.defineMacro("_LARGEFILE64_SOURCE");
Builder.defineMacro("__EXTENSIONS__");
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits