[PATCH] D108416: [llvm-libgcc] initial commit

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 12:20:02 PST 2022


MaskRay added a comment.

Thanks for the update.

> ${CMAKE_C_COMPILER}" "-E" "-xc" "${CMAKE_CURRENT_SOURCE_DIR}/gcc_s.ver" "-o" "${CMAKE_CURRENT_BINARY_DIR}/gcc_s.ver"

Yeah. This `CC -E` preprocessed version script is what I like to happen in a comment last year (https://reviews.llvm.org/D106703#2940320) and the style favored by jyknight.

You may use `llvm-nm -jUD /lib/x86_64-linux-gnu/libgcc_s.so.1` to get versioned defined symbols. Could you please comparing the symbol set with GCC libgcc_s.so.1 for these architectures you mostly care about?
Knowing which symbols are missing and have mismatched versions will be useful. I spot checked a small set of symbols and found some minor issues.
If 32-bit arm is so different from other architectures, perhaps use a global ifdef like

  #ifdef __arm__
  ....
  #else
  ...
  #endif

instead of special casing `#ifdef __arm__` (or the like) in every version node.

ld.lld has diagnostics if

- an exact pattern occurs in two version nodes
- or an exact pattern does not match any symbol

You may want to check there is no such warning.



================
Comment at: llvm/tools/llvm-libgcc/lib/gcc_s.ver:49
+  #if defined(__aarch64__)
+    __addtf3;     __divtf3;     __eqtf2;     __extenddftf2; __extendsftf2;
+    __fixtfdi;    __fixtfsi;    __fixtfti;   __fixunstfdi;  __fixunstfsi;
----------------
Looks like `__addtf3` for x86-64 is in GCC_4.3.0. You may need a comment documenting which architecture is the outlier here.


================
Comment at: llvm/tools/llvm-libgcc/lib/gcc_s.ver:64
+  #elif defined(__x86_64__)
+    __register_frame_info; __register_frame_info_table; __register_frame_table;
+    __deregister_frame;    __deregister_frame_info;     __register_frame;
----------------
`__register_frame_info` and its friends are generic. See `llvm-nm -jDU /usr/aarch64-linux-gnu/lib/libgcc_s.so.1` if you have installed aarch64 GCC cross compiler on a Debian/Ubuntu like distro.


================
Comment at: llvm/tools/llvm-libgcc/lib/gcc_s.ver:179
+  #elif defined(__x86_64__)
+    __divtc3; __multc3;
+  #endif
----------------
`__addtf3` and its friends are missing here.

```
% llvm-nm -jDU /lib/x86_64-linux-gnu/libgcc_s.so.1 | grep addtf3     
__addtf3@@GCC_4.3.0
```


================
Comment at: llvm/tools/llvm-libgcc/lib/gcc_s.ver:197
+  #if defined(__x86_64__) || defined(__aarch64__)
+    __divmodti4;
+  #elif defined(__i386__) || defined(LLVM_LIBGCC_ARM_GNUEABIHF)
----------------
This symbol is also in `/usr/powerpc64le-linux-gnu/lib/libgcc_s.so.1`.

If just arm is weird, exclude it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108416/new/

https://reviews.llvm.org/D108416



More information about the llvm-commits mailing list