[PATCH] D11673: [lld] COFF: When resolving _load_config_used, add it as a GC root.
Rui Ueyama
ruiu at google.com
Thu Jul 30 22:18:54 PDT 2015
LGTM
On Thu, Jul 30, 2015 at 9:27 PM, Peter Collingbourne <peter at pcc.me.uk>
wrote:
> pcc created this revision.
> pcc added a reviewer: ruiu.
> pcc added a subscriber: llvm-commits.
>
> This fixes the cases where the symbol is defined in a comdat or by bitcode.
>
> http://reviews.llvm.org/D11673
>
> Files:
> COFF/Driver.cpp
> test/COFF/loadcfg.ll
> test/COFF/loadcfg.test
>
> Index: test/COFF/loadcfg.test
> ===================================================================
> --- test/COFF/loadcfg.test
> +++ test/COFF/loadcfg.test
> @@ -2,7 +2,7 @@
> # RUN: lld -flavor link2 /out:%t.exe %t.obj /entry:main /subsystem:console
> # RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
>
> -# CHECK: LoadConfigTableRVA: 0x1000
> +# CHECK: LoadConfigTableRVA: 0x1008
> # CHECK: LoadConfigTableSize: 0x70
>
> ---
> @@ -14,6 +14,10 @@
> Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE,
> IMAGE_SCN_MEM_READ ]
> Alignment: 4
> SectionData: B82A000000C3
> + - Name: .text
> + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT,
> IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
> + Alignment: 4
> + SectionData: B82A000000C3
> symbols:
> - Name: .text
> Value: 0
> @@ -27,15 +31,28 @@
> NumberOfLinenumbers: 0
> CheckSum: 0
> Number: 0
> + - Name: .text
> + Value: 0
> + SectionNumber: 2
> + SimpleType: IMAGE_SYM_TYPE_NULL
> + ComplexType: IMAGE_SYM_DTYPE_NULL
> + StorageClass: IMAGE_SYM_CLASS_STATIC
> + SectionDefinition:
> + Length: 6
> + NumberOfRelocations: 0
> + NumberOfLinenumbers: 0
> + CheckSum: 0
> + Number: 0
> + Selection: IMAGE_COMDAT_SELECT_ANY
> - Name: main
> Value: 0
> SectionNumber: 1
> SimpleType: IMAGE_SYM_TYPE_NULL
> ComplexType: IMAGE_SYM_DTYPE_NULL
> StorageClass: IMAGE_SYM_CLASS_EXTERNAL
> - Name: _load_config_used
> Value: 0
> - SectionNumber: 1
> + SectionNumber: 2
> SimpleType: IMAGE_SYM_TYPE_NULL
> ComplexType: IMAGE_SYM_DTYPE_NULL
> StorageClass: IMAGE_SYM_CLASS_EXTERNAL
> Index: test/COFF/loadcfg.ll
> ===================================================================
> --- /dev/null
> +++ test/COFF/loadcfg.ll
> @@ -0,0 +1,15 @@
> +; RUN: llvm-as -o %t.obj %s
> +; RUN: lld -flavor link2 /out:%t.exe %t.obj /entry:main /subsystem:console
> +; RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
> +
> +; CHECK: LoadConfigTableRVA: 0x1000
> +; CHECK: LoadConfigTableSize: 0x70
> +
> +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-pc-windows-msvc"
> +
> + at _load_config_used = constant i32 1
> +
> +define void @main() {
> + ret void
> +}
> Index: COFF/Driver.cpp
> ===================================================================
> --- COFF/Driver.cpp
> +++ COFF/Driver.cpp
> @@ -662,9 +662,8 @@
> }
>
> // Windows specific -- if __load_config_used can be resolved, resolve
> it.
> - if (Symbol *Sym = Symtab.find(Config->LoadConfigUsed))
> - if (isa<Lazy>(Sym->Body))
> - Symtab.addUndefined(Config->LoadConfigUsed);
> + if (Symtab.find(Config->LoadConfigUsed))
> + addUndefined(Config->LoadConfigUsed);
>
> if (Symtab.queueEmpty())
> break;
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150730/bce3cb60/attachment.html>
More information about the llvm-commits
mailing list