[cfe-dev] "File too big/too many sections" when building Registry.cpp in MSYS2 Environment

kyra via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 3 10:57:20 PST 2017


Hi, Reid,

Thanks for being so responsive. I've attached the patch. It happens in a 
different place than MSVC's one, since the MSVC has it's own 
CLCompatOptions.td, which GNU driver doesn't have.

Cheers, Kyra


On 03.01.2017 20:24, Reid Kleckner wrote:
> On Sun, Jan 1, 2017 at 11:35 PM, kyra via cfe-dev 
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>
>     3. I believe, we should pay more attention to support self-hosted
>     mingw-w64 clang, I maintain a couple of patches which allow me to
>     build it, but I never tried to publish them, because I saw no
>     interest. Btw, that recent LLVM patch introducing big-obj switch
>     (https://github.com/llvm-mirror/llvm/commit/e1c9f504c6810be782714b8b39f11579e50fa5c7
>     <https://github.com/llvm-mirror/llvm/commit/e1c9f504c6810be782714b8b39f11579e50fa5c7>)
>     also breaks self-hosted clang because gnu clang driver doesn't
>     understand -Wa,-mbig-obj option. AFAIUI, LLVM handles COFF format
>     automatically, selecting bigobj format if necessary, and msvc
>     clang driver simply ignores '/bigobj' flag. I have a patch fixing
>     gnu driver too.
>
>
> I'm happy to review these kinds of patches if you want to CC me on 
> them. I don't have a lot of time to dedicate to mingw support in 
> clang, so I mostly apply other people's patches and confirm that 
> things seem to work.
>
> Accepting and ignoring the -mbig-obj flag in clang seems totally 
> reasonable to me. Our assembler should implicitly do the right thing, 
> as you described.


-------------- next part --------------
diff -urN a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
--- a/tools/clang/lib/Driver/Tools.cpp	2016-12-24 10:35:01.987577100 +0300
+++ b/tools/clang/lib/Driver/Tools.cpp	2016-12-24 13:58:05.946156800 +0300
@@ -3058,6 +3058,9 @@
         continue;
       }
 
+      if (C.getDefaultToolChain().getTriple().getOS() == llvm::Triple::Win32 && Value == "-mbig-obj")
+        continue; // LLVM handles bigobj automatically
+      
       switch (C.getDefaultToolChain().getArch()) {
       default:
         break;


More information about the cfe-dev mailing list