[libc-commits] [PATCH] D119002: [libc] Fix compilation with gcc

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Feb 4 08:00:31 PST 2022


gchatelet created this revision.
gchatelet added reviewers: lntue, sivachandra, michaelrj, abrachet.
Herald added subscribers: libc-commits, ecnelises, tschuett, pengfei, mgorny.
Herald added a project: libc-project.
gchatelet requested review of this revision.

We may want to break this patch into smaller independent pieces but it's easier to have the full perspective first.

1. Type punning is used throughout llvmlibc but this is undefined behavior in C++ (e.g. FPUtils using FP/Integral union)
2. Clang is happy with vector type conversions in `elements_x86.h` but vector types are slightly different in GCC and so bit casting is necessary.
3. Some compilation options were only available in Clang, preventing compilation with GCC.

I still have compilation issues with an asm statement and link errors so I'll iterate a bit more on the patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119002

Files:
  libc/src/__support/CMakeLists.txt
  libc/src/__support/FPUtil/FPBits.h
  libc/src/__support/FPUtil/Hypot.h
  libc/src/__support/FPUtil/ManipulationFunctions.h
  libc/src/__support/FPUtil/generic/sqrt.h
  libc/src/__support/FPUtil/x86_64/LongDoubleBits.h
  libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h
  libc/src/__support/builtin_bit_cast.h
  libc/src/__support/builtin_memcpy.h
  libc/src/fenv/fesetexceptflag.cpp
  libc/src/math/generic/log10f.cpp
  libc/src/math/generic/log2f.cpp
  libc/src/math/generic/logf.cpp
  libc/src/math/generic/math_utils.h
  libc/src/string/CMakeLists.txt
  libc/src/string/memory_utils/elements_x86.h
  libc/test/src/math/NextAfterTest.h
  libc/test/src/math/SqrtTest.h
  libc/utils/MPFRWrapper/MPFRUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119002.405972.patch
Type: text/x-patch
Size: 27748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220204/e0be8dc2/attachment-0001.bin>


More information about the libc-commits mailing list