[lld] r244929 - Set the file offset of zero sized sections.
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 18:50:51 PDT 2015
Ah :-)
Thanks!
On 13 August 2015 at 21:47, Rui Ueyama <ruiu at google.com> wrote:
> This was yet another trace of COFF-ism. For some unknown reason, Windows
> loader doesn't like empty sections, so we had this code.
>
> On Fri, Aug 14, 2015 at 3:23 AM, Rafael Espindola via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: rafael
>> Date: Thu Aug 13 13:23:43 2015
>> New Revision: 244929
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=244929&view=rev
>> Log:
>> Set the file offset of zero sized sections.
>>
>> There is no reason not to do it and this matches what gold and bfd ld do.
>>
>> Modified:
>> lld/trunk/ELF/Writer.cpp
>> lld/trunk/test/elf2/basic.s
>> lld/trunk/test/elf2/basic32.s
>> lld/trunk/test/elf2/basic32be.s
>> lld/trunk/test/elf2/basic64be.s
>>
>> Modified: lld/trunk/ELF/Writer.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=244929&r1=244928&r2=244929&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Writer.cpp (original)
>> +++ lld/trunk/ELF/Writer.cpp Thu Aug 13 13:23:43 2015
>> @@ -123,8 +123,6 @@ template <class ELFT> void OutputSection
>> }
>>
>> template <class ELFT> void OutputSection<ELFT>::setFileOffset(uintX_t
>> Off) {
>> - if (Header.sh_size == 0)
>> - return;
>> Header.sh_offset = Off;
>> }
>>
>>
>> Modified: lld/trunk/test/elf2/basic.s
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=244929&r1=244928&r2=244929&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/test/elf2/basic.s (original)
>> +++ lld/trunk/test/elf2/basic.s Thu Aug 13 13:23:43 2015
>> @@ -75,7 +75,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>> @@ -91,7 +91,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>>
>> Modified: lld/trunk/test/elf2/basic32.s
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=244929&r1=244928&r2=244929&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/test/elf2/basic32.s (original)
>> +++ lld/trunk/test/elf2/basic32.s Thu Aug 13 13:23:43 2015
>> @@ -75,7 +75,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>> @@ -91,7 +91,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>>
>> Modified: lld/trunk/test/elf2/basic32be.s
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32be.s?rev=244929&r1=244928&r2=244929&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/test/elf2/basic32be.s (original)
>> +++ lld/trunk/test/elf2/basic32be.s Thu Aug 13 13:23:43 2015
>> @@ -75,7 +75,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>> @@ -91,7 +91,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>>
>> Modified: lld/trunk/test/elf2/basic64be.s
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic64be.s?rev=244929&r1=244928&r2=244929&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/test/elf2/basic64be.s (original)
>> +++ lld/trunk/test/elf2/basic64be.s Thu Aug 13 13:23:43 2015
>> @@ -80,7 +80,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>> @@ -96,7 +96,7 @@ _start:
>> # CHECK-NEXT: SHF_WRITE (0x1)
>> # CHECK-NEXT: ]
>> # CHECK-NEXT: Address: 0x2000
>> -# CHECK-NEXT: Offset: 0x0
>> +# CHECK-NEXT: Offset: 0x1010
>> # CHECK-NEXT: Size: 0
>> # CHECK-NEXT: Link: 0
>> # CHECK-NEXT: Info: 0
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
More information about the llvm-commits
mailing list