-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LLD][COFF] Support /DEPENDENTLOADFLAG[:flags] (#71537)
This should fix #43935
- Loading branch information
1 parent
fd389f4
commit 76947e0
Showing
8 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// ---- precomp-a.obj - x86_64, hotpatch | ||
RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj %S/Inputs/loadconfig-cfg-x64.s -o %t.ldcfg.obj | ||
|
||
RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force | ||
RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix BASE | ||
|
||
RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0x800 | ||
RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix FLAGS-800 | ||
|
||
// ---- Many arguments | ||
RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0x400 /dependentloadflag:0x800 | ||
RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix FLAGS-800 | ||
|
||
RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0x800 /dependentloadflag:0x400 | ||
RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix FLAGS-400 | ||
|
||
RUN: not lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag 2>&1 | FileCheck %s --check-prefix FAIL-NOARG | ||
RUN: not lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:zz 2>&1 | FileCheck %s --check-prefix FAIL | ||
RUN: not lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0xf0000 2>&1 | FileCheck %s --check-prefix FAIL-RANGE | ||
|
||
|
||
BASE: DependentLoadFlags: 0x0 | ||
FLAGS-800: DependentLoadFlags: 0x800 | ||
FLAGS-400: DependentLoadFlags: 0x400 | ||
|
||
FAIL: lld-link: error: /dependentloadflag: invalid argument: zz | ||
FAIL-RANGE: lld-link: error: /dependentloadflag: invalid argument: 0xf0000 | ||
FAIL-NOARG: lld-link: error: /dependentloadflag: no argument specified | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj %s -o %t.ldcfg.obj | ||
|
||
# RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force | ||
# RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix FLAGS-400 | ||
|
||
# RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0x800 | ||
# RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix FLAGS-800 | ||
|
||
# MSVC linker does not rewrite non-zero value of dependentloadflag in _load_config_used with zero | ||
# RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0x0 | ||
# RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix FLAGS-400 | ||
|
||
# RUN: lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0x800 /dependentloadflag:0x0 | ||
# RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix FLAGS-400 | ||
|
||
# FLAGS-800: DependentLoadFlags: 0x800 | ||
# FLAGS-400: DependentLoadFlags: 0x400 | ||
|
||
.section .rdata,"dr" | ||
.globl _load_config_used | ||
_load_config_used: | ||
.long 256 | ||
.fill 74, 1, 0 | ||
.byte 0x00 | ||
.byte 0x40 | ||
.fill 48, 1, 0 | ||
.quad __guard_fids_table | ||
.quad __guard_fids_count | ||
.long __guard_flags | ||
.fill 128, 1, 0 | ||
|