Skip to content

Commit 88f6269

Browse files
author
Colin Robertson
committed
Initial draft of /LINKREPRO and related options
1 parent cfba666 commit 88f6269

3 files changed

Lines changed: 99 additions & 1 deletion

File tree

docs/build/reference/linkrepro.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: "/LINKREPRO (Link repro directory name)"
3+
description: Linker option to set the directory for a link repro file.
4+
ms.date: "09/24/2019"
5+
f1_keywords: ["/LINKREPRO"]
6+
helpviewer_keywords: ["LINKREPRO linker option", "/LINKREPRO linker option", "-LINKREPRO linker option", "linker repro reporting"]
7+
---
8+
# /LINKREPRO (Link repro directory name)
9+
10+
Tells the linker to generate a link repro in a specified directory.
11+
12+
## Syntax
13+
14+
> **/LINKREPRO:**_directory-name_
15+
16+
### Arguments
17+
18+
**/LINKREPRO:**_directory-name_\
19+
The user-specified directory to store the link repro in. Directory names that include spaces must be enclosed in double quotes.
20+
21+
## Remarks
22+
23+
The **/LINKREPRO** linker option is used to create a *link repro*. It's a set of build artifacts that allow Microsoft to reproduce a problem that occurs at link time. It's useful for problems such as a backend crash involving Link-Time Code Generation (LTCG), an LNK1000 linker error, or a linker crash. The linker produces a link repro when you specify the **/LINKREPRO** linker option, or when you set the `link_repro` environment variable in your command-line build environment.
24+
25+
Create a link repro to get support for an LTCG crash, a linker crash, or an internal error that happens at link time. For more information, see the [Link repros](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md#link-repros) section of [How to report a problem with the Microsoft C++ toolset](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md).
26+
27+
Both the **/LINKREPRO** linker option and the `link_repro` environment variable require you to specify an output directory for the link repro. On the command line or in the IDE, specify the directory by using a **/LINKREPRO:**_directory-name_ option. The _directory-name_ you specify may be an absolute or relative path, but the directory must exist. The command-line option overrides any directory value set in the `link_repro` environment variable. You must also specify the [/OUT](out-output-file-name.md) linker option when you use the **/LINKREPRO** option.
28+
29+
For information on how to set a link repro file name, see the [/LINKREPROTARGET](linkreprotarget.md) linker option. This option can be used to specify different names for different link repros. It's useful in complex builds that invoke the linker more than once.
30+
31+
### To set this linker option in the Visual Studio development environment
32+
33+
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
34+
35+
1. Select the **Configuration Properties** > **Linker** > **Command Line** property page.
36+
37+
1. Enter the **/LINKREPRO:**_directory-name_ option in the **Additional Options** box. The _directory-name_ value you specify must exist. Choose **OK** to apply the change.
38+
39+
### To set this linker option programmatically
40+
41+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.
42+
43+
## See also
44+
45+
[MSVC linker reference](linking.md)\
46+
[MSVC Linker Options](linker-options.md)\
47+
[/LINKREPROTARGET](linkreprotarget.md)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "/LINKREPROTARGET (Link repro file name)"
3+
description: Linker option to set the directory for a link repro file.
4+
ms.date: "09/24/2019"
5+
f1_keywords: ["/LINKREPROTARGET"]
6+
helpviewer_keywords: ["LINKREPROTARGET linker option", "/LINKREPROTARGET linker option", "-LINKREPROTARGET linker option", "linker repro reporting"]
7+
---
8+
# /LINKREPROTARGET (Link repro file name)
9+
10+
Tells the linker to generate a link repro that has a specified file name.
11+
12+
## Syntax
13+
14+
> **/LINKREPROTARGET:**_file-name_
15+
16+
### Arguments
17+
18+
**/LINKREPROTARGET:**_file-name_\
19+
The user-specified file name to store the link repro in. File names that include spaces must be enclosed in double quotes.
20+
21+
## Remarks
22+
23+
The **/LINKREPROTARGET** linker option is used to specify a file name for a *link repro*. A link repro is a set of build artifacts that allow Microsoft to reproduce a problem that occurs at link time. The linker produces a link repro when you specify the [/LINKREPRO](linkrepro.md) linker option, or when you set the `link_repro` environment variable in your command-line build environment. The **/LINKREPROTARGET** linker option is useful in complex builds that invoke the linker more than once. It lets you specify a different name for each link repro.
24+
25+
For more information about how and when to create a link repro, see the [Link repros](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md#link-repros) section of [How to report a problem with the Microsoft C++ toolset](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md).
26+
27+
To specify a **/LINKREPROTARGET** linker option, the **/LINKREPRO** and [/OUT](out-output-file-name.md) linker options must also be set.
28+
29+
### To set this linker option in the Visual Studio development environment
30+
31+
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
32+
33+
1. Select the **Configuration Properties** > **Linker** > **Command Line** property page.
34+
35+
1. Enter the **/LINKREPROTARGET:**_file-name_ option in the **Additional Options** box. Choose **OK** to apply the change.
36+
37+
### To set this linker option programmatically
38+
39+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.
40+
41+
## See also
42+
43+
[MSVC linker reference](linking.md)\
44+
[MSVC Linker Options](linker-options.md)\
45+
[/LINKREPRO](linkrepro.md)

docs/overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ Finally, attach the preprocessed repro files (*filename*.i and *modulename*.i) a
313313

314314
A *Link repro* is the linker-generated contents of a directory specified by the **link\_repro** environment variable. It contains build artifacts that collectively demonstrate a problem that occurs at link time. Examples include a backend crash involving Link-Time Code Generation (LTCG), or a linker crash. These build artifacts are the ones needed as linker input so that the problem can be reproduced. A Link repro can be created easily by using this environment variable. It enables the linker's built-in repro generation capability.
315315

316-
#### To generate a Link repro
316+
#### To generate a Link repro using the link_repro environment variable
317317

318318
1. Capture the command-line arguments used to build your repro, as described in [To report the contents of the command line](#to-report-the-contents-of-the-command-line).
319319

@@ -333,6 +333,12 @@ A *Link repro* is the linker-generated contents of a directory specified by the
333333

334334
1. In the developer command prompt console window, enter the command **set link\_repro=** to clear the **link\_repro** environment variable.
335335

336+
#### To generate a Link repro using the /LINKREPRO linker option
337+
338+
The /LINKREPRO linker option has the same effect as the **link\_repro** environment variable. You can also use the /LINKREPROTARGET option to specify the name to use for the generated link repro. To use /LINKREPROTARGET, you must specify the /OUT option.
339+
340+
<!-- TODO TODO -->
341+
336342
Finally, package the repro by compressing the entire linkrepro directory into a .zip file or similar and attach it to your report.
337343

338344
### Other repros

0 commit comments

Comments
 (0)