Chilledheart / yass

lightweight and efficient, socks/http forward proxy. privoxy is not required. pure native, written in c++ and rust.
https://letshack.info/2024/01/22/iOS-VPN-Service/
GNU General Public License v2.0
123 stars 11 forks source link

emulate tls on android (below api 29) and cygwin build #1023

Open Chilledheart opened 2 months ago

Chilledheart commented 2 months ago
  /// Tests whether the target uses emulated TLS as default.
  ///
  /// Note: Android API level 29 (10) introduced ELF TLS.
  bool hasDefaultEmulatedTLS() const {
    return (isAndroid() && isAndroidVersionLT(29)) || isOSOpenBSD() ||
           isWindowsCygwinEnvironment() || isOHOSFamily();
  }

https://clang.llvm.org/docs/UsersManual.html#cmdoption-femulated-tls

Clang (and lld) do support native TLS, and mingw-w64 does have the things that are needed. I think binutils also might have what's needed too, but AFAIK the thing that's missing is support for it in GCC. Actually, (upstream) Clang defaults to native TLS instead of emulated TLS. In MSYS2, Clang is overridden to use emulated TLS by deafult to interoperate better with GCC built code and libstdc++ though.

https://news.ycombinator.com/item?id=29618539

Chilledheart commented 2 months ago
(gdb) b __emutls_get_address
Breakpoint 1 at 0x3d999c: file ./lib/builtins/emutls.c, line 393.