[clang] [llvm] [LLVM][Clang][Cygwin] Fix building Clang for Cygwin (PR #134494)

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 5 19:01:06 PDT 2025


Mateusz =?utf-8?q?Mikuła?= <oss at mateuszmikula.dev>,
Mateusz =?utf-8?q?Mikuła?= <oss at mateuszmikula.dev>,
Mateusz =?utf-8?q?Mikuła?= <oss at mateuszmikula.dev>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/134494 at github.com>


================
@@ -847,7 +847,11 @@ void llvm::sys::PrintStackTrace(raw_ostream &OS, int Depth) {
 
     const char *name = strrchr(dlinfo.dli_fname, '/');
     if (!name)
+#ifdef __CYGWIN__
+      OS << format(" %-*s", width, &dlinfo.dli_fname);
----------------
jeremyd2019 wrote:

> Can we even trust Cygwin's `dli_fname` to always be null terminated?

Yes.  It calls cygwin_conv_path to fill it, and cygwin_conv_path will set `ENOSPC` and not touch the buffer if it's not big enough.  If cygwin_conv_path fails dladdr will return 0.

https://github.com/llvm/llvm-project/pull/134494


More information about the cfe-commits mailing list