[lld] r232448 - Make it compile with MSVC 2013.

Rui Ueyama ruiu at google.com
Tue Mar 17 11:23:34 PDT 2015


I'm using x86_64 MSVC compiler but I didn't see that error. I don't know
why I didn't hit that yet.

Anyway, the error says that we have too many sections in one compilation
unit -- probably COMDAT sections. Regular COFF file format doesn't support
more than 65535 sections. In order to use the extended format, we need to
pass /bigobj command line option to the compiler. We could do that.

But I think we should instead reduce the number of inline functions from
the file. I believe it simply inlines too many functions.

On Tue, Mar 17, 2015 at 11:10 AM, Rafael Auler <rafaelauler at gmail.com>
wrote:

> I was compiling with the x86 MSVC compiler. If I use the x86_64 MSVC
> compiler, it looks like we are hitting another issue:
>
> MipsLinkingContext.cpp: fatal error C1128: number of sections exceeded
> object file format limit: compile with /bigobj
>
> On Tue, Mar 17, 2015 at 2:35 PM, Rafael Auler <rafaelauler at gmail.com>
> wrote:
>
>> Oh, I see. Mine is  18.00.31101. This must've been fixed.
>>
>> On Tue, Mar 17, 2015 at 2:26 PM, Rui Ueyama <ruiu at google.com> wrote:
>>
>>> I'm using this version of MSVC.
>>>
>>>   Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
>>>
>>> And the error I got is below.
>>>
>>> c:\cygwin\home\ruiu\llvm\tools\lld\lib\readerwriter\elf\DefaultLayout.h(440)
>>> : fatal error C1001: An internal error has occurred in the compiler.
>>> (compiler file 'msc1.cpp', line 1325)
>>>  To work around this problem, try simplifying or changing the program
>>> near the locations listed above.
>>> Please choose the Technical Support command on the Visual C++
>>>  Help menu, or open the Technical Support help file for more information
>>>
>>> c:\cygwin\home\ruiu\llvm\tools\lld\lib\readerwriter\elf\DefaultLayout.h(436)
>>> : while compiling class template member function 'llvm::StringRef
>>> lld::elf::DefaultLayout<ELFT>::getOutputSectionName(llvm::StringRef,llvm::StringRef,llvm::StringRef)
>>> const'
>>>         with
>>>         [
>>>             ELFT=lld::elf::X86ELFType
>>>         ]
>>>
>>> c:\cygwin\home\ruiu\llvm\tools\lld\lib\readerwriter\elf\TargetLayout.h(21)
>>> : see reference to class template instantiation
>>> 'lld::elf::DefaultLayout<ELFT>' being compiled
>>>         with
>>>         [
>>>             ELFT=lld::elf::X86ELFType
>>>         ]
>>>
>>> c:\cygwin\home\ruiu\llvm\tools\lld\lib\readerwriter\elf\x86\X86TargetHandler.h(59)
>>> : see reference to class template instantiation
>>> 'lld::elf::TargetLayout<ELFT>' being compiled
>>>         with
>>>         [
>>>             ELFT=lld::elf::X86ELFType
>>>         ]
>>> Internal Compiler Error in C:\PROGRA~2\MICROS~2.0\VC\bin\amd64\cl.exe.
>>> You will be prompted to send an error report to Microsoft later.
>>>
>>>
>>> On Tue, Mar 17, 2015 at 5:38 AM, Rafael Auler <rafaelauler at gmail.com>
>>> wrote:
>>>
>>>> Thanks for fixing this, Rui. I find it odd because I test my patches in
>>>> a MSVC 2013 box and I didn't get an error and I didn't receive any
>>>> complaints from buildbots.
>>>>
>>>> On Mon, Mar 16, 2015 at 10:10 PM, Rui Ueyama <ruiu at google.com> wrote:
>>>>
>>>>> Author: ruiu
>>>>> Date: Mon Mar 16 20:10:12 2015
>>>>> New Revision: 232448
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=232448&view=rev
>>>>> Log:
>>>>> Make it compile with MSVC 2013.
>>>>>
>>>>> MSVC 2013 cannot compile this code because of C1001 "internal error".
>>>>> Stop using initializer list without type name.
>>>>>
>>>>> Modified:
>>>>>     lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>>>>>
>>>>> Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=232448&r1=232447&r2=232448&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
>>>>> +++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Mon Mar 16 20:10:12
>>>>> 2015
>>>>> @@ -435,11 +435,12 @@ DefaultLayout<ELFT>::getOutputSectionNam
>>>>>                                            StringRef memberPath,
>>>>>                                            StringRef inputSectionName)
>>>>> const {
>>>>>    StringRef outputSectionName;
>>>>> -  if (_linkerScriptSema.hasLayoutCommands() &&
>>>>> -      !(outputSectionName = _linkerScriptSema.getOutputSection(
>>>>> -           {archivePath, memberPath, inputSectionName})).empty())
>>>>> -    return outputSectionName;
>>>>> -
>>>>> +  if (_linkerScriptSema.hasLayoutCommands()) {
>>>>> +    script::Sema::SectionKey key = {archivePath, memberPath,
>>>>> inputSectionName};
>>>>> +    outputSectionName = _linkerScriptSema.getOutputSection(key);
>>>>> +    if (!outputSectionName.empty())
>>>>> +      return outputSectionName;
>>>>> +  }
>>>>>    return llvm::StringSwitch<StringRef>(inputSectionName)
>>>>>        .StartsWith(".text", ".text")
>>>>>        .StartsWith(".ctors", ".ctors")
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150317/3a0b01bc/attachment.html>


More information about the llvm-commits mailing list