Skip to content

Commit a1bf60d

Browse files
Merge pull request #4886 from MicrosoftDocs/main638405078604376628sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 2bde099 + 7e3e7cb commit a1bf60d

File tree

5 files changed

+121
-34
lines changed

5 files changed

+121
-34
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
description: "Learn more about: /ARM64XFUNCTIONPADMINX64 (Minimum padding between x64 functions in an ARM64X image)"
3+
title: "/ARM64XFUNCTIONPADMINX64 (Minimum x64 function padding)"
4+
ms.date: 01/08/2024
5+
helpviewer_keywords: ["/ARM64XFUNCTIONPADMINX64 linker option", "-ARM64XFUNCTIONPADMINX64 linker option", "ARM64XFUNCTIONPADMINX64 linker option"]
6+
---
7+
# /ARM64XFUNCTIONPADMINX64 (Minimum x64 function padding)
8+
9+
Specifies the minimum number of bytes of padding between x64 functions in ARM64X images.
10+
11+
## Syntax
12+
13+
```
14+
/ARM64XFUNCTIONPADMINX64:[number]
15+
```
16+
17+
## Arguments
18+
19+
*number*\
20+
The minimum number of bytes of padding between x64 functions.
21+
22+
## Remarks
23+
24+
This switch ensures that there is at least as much padding between X64 functions in an ARM64X image as specified. There may be more padding to meet architecture alignment requirements.
25+
26+
This flag is available in Visual Studio 17.8 and later.
27+
28+
### To set this linker option in the Visual Studio development environment
29+
30+
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).
31+
1. Select the **Configuration Properties** > **Linker** > **Command Line** property page.
32+
1. Modify the **Additional Options** property to include **/ARM64XFUNCTIONPADMINX64:**`number`, where `number` is the minimum number of bytes of padding to put between x64 functions, and then choose **OK**.
33+
34+
### To set this linker option programmatically
35+
36+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.
37+
38+
## See also
39+
40+
[`/FUNCTIONPADMIN` (Create hotpatchable image)](../reference/functionpadmin-create-hotpatchable-image.md)\
41+
[`/NOFUNCTIONPADSECTION`](no-function-pad-section.md)\
42+
[MSVC Linker Options](linker-options.md)\
43+
[MSVC linker reference](linking.md)

docs/build/reference/linker-options.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MSVC Linker options"
33
description: "A list of the options supported by the Microsoft LINK linker."
4-
ms.date: 08/25/2023
4+
ms.date: 01/08/2024
55
f1_keywords: ["link"]
66
helpviewer_keywords: ["linker [C++]", "linker [C++], options listed", "libraries [C++], linking to COFF", "LINK tool [C++], linker options"]
77
---
@@ -29,6 +29,7 @@ You can use the [`comment`](../../preprocessor/comment-c-cpp.md) pragma to speci
2929
| [`/ALLOWBIND`](allowbind-prevent-dll-binding.md) | Specifies that a DLL can't be bound. |
3030
| [`/ALLOWISOLATION`](allowisolation-manifest-lookup.md) | Specifies behavior for manifest lookup. |
3131
| [`/APPCONTAINER`](appcontainer-windows-store-app.md) | Specifies whether the app must run within an appcontainer process environment. |
32+
| [`/ARM64XFUNCTIONPADMINX64`](arm64-function-pad-min-x64.md) | Specifies the minimum number of bytes of padding between x64 functions in ARM64X images.<sup>17.8</sup> |
3233
| [`/ASSEMBLYDEBUG`](assemblydebug-add-debuggableattribute.md) | Adds the <xref:System.Diagnostics.DebuggableAttribute> to a managed image. |
3334
| [`/ASSEMBLYLINKRESOURCE`](assemblylinkresource-link-to-dotnet-framework-resource.md) | Creates a link to a managed resource. |
3435
| [`/ASSEMBLYMODULE`](assemblymodule-add-a-msil-module-to-the-assembly.md) | Specifies that a Microsoft intermediate language (MSIL) module should be imported into the assembly. |
@@ -93,6 +94,7 @@ You can use the [`comment`](../../preprocessor/comment-c-cpp.md) pragma to speci
9394
| [`/NOASSEMBLY`](noassembly-create-a-msil-module.md) | Suppresses the creation of a .NET Framework assembly. |
9495
| [`/NODEFAULTLIB`](nodefaultlib-ignore-libraries.md) | Ignores all (or the specified) default libraries when external references are resolved. |
9596
| [`/NOENTRY`](noentry-no-entry-point.md) | Creates a resource-only DLL. |
97+
| [`/NOFUNCTIONPADSECTION`](no-function-pad-section.md) | Disables function padding for functions in the specified section.<sup>17.8</sup> |
9698
| [`/NOLOGO`](nologo-suppress-startup-banner-linker.md) | Suppresses the startup banner. |
9799
| [`/NXCOMPAT`](nxcompat-compatible-with-data-execution-prevention.md) | Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. |
98100
| [`/OPT`](opt-optimizations.md) | Controls LINK optimizations. |
@@ -127,7 +129,8 @@ You can use the [`comment`](../../preprocessor/comment-c-cpp.md) pragma to speci
127129
| [`/WINMDDELAYSIGN`](winmddelaysign-partially-sign-a-winmd.md) | Partially signs a Windows Runtime Metadata (*`.winmd`*) file by placing the public key in the winmd file. |
128130
| [`/WX`](wx-treat-linker-warnings-as-errors.md) | Treats linker warnings as errors. |
129131

130-
<sup>16.1</sup> This option is available starting in Visual Studio 2019 version 16.1.
132+
<sup>16.1</sup> This option is available starting in Visual Studio 2019 version 16.1.\
133+
<sup>17.8</sup> This option is available starting in Visual Studio 2022 version 17.8.
131134

132135
## See also
133136

docs/build/reference/linking.md

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,76 @@
22
description: "Learn more about: Linking"
33
title: "MSVC linker reference"
44
ms.date: "12/10/2018"
5-
ms.assetid: bb736587-d13b-4f3c-8982-3cc2c015c59c
65
---
76
# Linking
87

9-
In a C++ project, the *linking* step is performed after the compiler has compiled the source code into object files (*.obj). The linker (link.exe) combines the object files into a single executable file.
8+
In a C++ project, the *linking* step is performed after the compiler compiles the source code into object files (*.obj). The linker (`link.exe`) combines the object files into a single executable file.
109

1110
Linker options can be set inside or outside of Visual Studio. Within Visual Studio, you access linker options by right-clicking on a project node in **Solution Explorer** and choosing **Properties** to display the property pages. Choose **Linker** in the left pane to expand the node and see all the options.
1211

1312
## Linker command-line syntax
1413

15-
When you run LINK outside of Visual Studio, you can specify input in one or more ways:
14+
When you run the linker outside of Visual Studio, you can specify input in one or more ways:
1615

1716
- On the command line
18-
1917
- Using command files
20-
2118
- In environment variables
2219

23-
LINK first processes options specified in the LINK environment variable, followed by options in the order they are specified on the command line and in command files. If an option is repeated with different arguments, the last one processed takes precedence.
20+
The linker first processes options specified in the `LINK` environment variable, followed by options in the order they're specified on the command line and in command files. If an option is repeated with different arguments, the last one processed takes precedence.
2421

2522
Options apply to the entire build; no options can be applied to specific input files.
2623

27-
To run LINK.EXE, use the following command syntax:
24+
To run `link.exe`, use the following command syntax:
2825

29-
```
30-
LINK arguments
26+
```cmd
27+
link arguments
3128
```
3229

3330
The `arguments` include options and filenames and can be specified in any order. Options are processed first, then files. Use one or more spaces or tabs to separate arguments.
3431

3532
> [!NOTE]
36-
> You can start this tool only from the Visual Studio command prompt. You cannot start it from a system command prompt or from File Explorer.
33+
> You can start this tool only from the Visual Studio command prompt. You can't start it from a system command prompt or from File Explorer.
3734
3835
## Command line
3936

40-
On the command line, an option consists of an option specifier, either a dash (-) or a forward slash (/), followed by the name of the option. Option names cannot be abbreviated. Some options take an argument, specified after a colon (:). No spaces or tabs are allowed within an option specification, except within a quoted string in the /COMMENT option. Specify numeric arguments in decimal or C-language notation. Option names and their keyword or filename arguments are not case sensitive, but identifiers as arguments are case sensitive.
37+
On the command line, an option consists of an option specifier, either a dash (`-`) or a forward slash (`/`), followed by the name of the option. Option names can't be abbreviated. Some options take an argument, specified after a colon (`:`). No spaces or tabs are allowed within an option specification, except within a quoted string in the `/COMMENT` option. Specify numeric arguments in decimal or C-language notation. Option names and their keyword or filename arguments aren't case sensitive, but identifiers as arguments are case sensitive.
4138

42-
To pass a file to the linker, specify the filename on the command line after the LINK command. You can specify an absolute or relative path with the filename, and you can use wildcards in the filename. If you omit the dot (.) and filename extension, LINK assumes .obj for the purpose of finding the file. LINK does not use filename extensions or the lack of them to make assumptions about the contents of files; it determines the type of file by examining it, and processes it accordingly.
39+
To pass a file to the linker, specify the filename on the command line after the `link.exe` command. You can specify an absolute or relative path with the filename, and you can use wildcards in the filename. If you omit the dot (`.`) and filename extension, the linker assumes an extension of `.obj` to find the file. The linker doesn't use filename extensions or the lack of them to make assumptions about the contents of files. It determines the type of file by examining it, and processes it accordingly.
4340

44-
link.exe returns zero for success (no errors). Otherwise, the linker returns the error number that stopped the link. For example, if the linker generates LNK1104, the linker returns 1104. Accordingly, the lowest error number returned on an error by the linker is 1000. A return value of 128 represents a configuration problem with either the operating system or a .config file; the loader didn't load either link.exe or c2.dll.
41+
The linker returns zero for success (no errors). Otherwise, it returns the error number that stopped the link. For example, if the linker generates `LNK1104`, the linker returns 1104. Accordingly, the lowest error number returned on an error by the linker is 1000. A return value of 128 represents a configuration problem with either the operating system or a .config file; the loader didn't load either `link.exe` or `c2.dll`.
4542

46-
## LINK Command Files
43+
## Linker command files
4744

48-
You can pass command-line arguments to LINK in the form of a command file. To specify a command file to the linker, use the following syntax:
45+
You can pass command-line arguments to `link.exe` in the form of a command file. To specify a command file to the linker, use the following syntax:
4946

50-
> **LINK \@**<em>commandfile</em>
47+
> `link @commandfile`
5148
52-
The *commandfile* is the name of a text file. No space or tab is allowed between the at sign (**\@**) and the filename. There is no default extension; you must specify the full filename, including any extension. Wildcards cannot be used. You can specify an absolute or relative path with the filename. LINK does not use an environment variable to search for the file.
49+
The *`commandfile`* is the name of a text file. No space or tab is allowed between the at sign (**\@**) and the filename. There's no default extension; you must specify the full filename, including any extension. Wildcards can't be used. You can specify an absolute or relative path with the filename. The linker doesn't use an environment variable to search for the file.
5350

54-
In the command file, arguments can be separated by spaces or tabs (as on the command line) and by newline characters.
51+
In the command file, arguments are separated by spaces or tabs (as on the command line) and by newline characters.
5552

56-
You can specify all or part of the command line in a command file. You can use more than one command file in a LINK command. LINK accepts the command-file input as if it were specified in that location on the command line. Command files cannot be nested. LINK echoes the contents of command files, unless the [/NOLOGO](nologo-suppress-startup-banner-linker.md) option is specified.
53+
You can specify all or part of the command line in a command file. You can use more than one command file in a `link.exe` command. The linker accepts the command-file input as if it was specified in that location on the command line. Command files can't be nested. The linker echoes the contents of command files, unless [`/NOLOGO`](nologo-suppress-startup-banner-linker.md) is specified.
5754

5855
## Example
5956

60-
The following command to build a DLL passes the names of object files and libraries in separate command files and uses a third command file for specification of the /EXPORTS option:
57+
The following command builds a DLL. It passes the names of object files and libraries in separate command files and uses a third command file for specification of the `/EXPORTS` option:
6158

6259
```cmd
6360
link /dll @objlist.txt @liblist.txt @exports.txt
6461
```
6562

66-
## LINK Environment Variables
67-
68-
The LINK tool uses the following environment variables:
69-
70-
- LINK and \_LINK\_, if defined. The LINK tool prepends the options and arguments defined in the LINK environment variable and appends the options and arguments defined in the \_LINK\_ environment variable to the command line arguments before processing.
71-
72-
- LIB, if defined. The LINK tools uses the LIB path when searching for an object, library, or other file specified on the command line or by the [/BASE](base-base-address.md) option. It also uses the LIB path to find a .pdb file named in an object. The LIB variable can contain one or more path specifications, separated by semicolons. One path must point to the \lib subdirectory of your Visual C++ installation.
63+
## LINK environment variables
7364

74-
- PATH, if the tool needs to run CVTRES and cannot find the file in the same directory as LINK itself. (LINK requires CVTRES to link a .res file.) PATH must point to the \bin subdirectory of your Visual C++ installation.
65+
The linker recognizes the following environment variables:
7566

76-
- TMP, to specify a directory when linking OMF or .res files.
67+
- `LINK` and `_LINK_`, if defined. The linker prepends the options and arguments defined in the `LINK` environment variable and appends the options and arguments defined in the `_LINK_` environment variable to the command line arguments before processing.
68+
- `LIB`, if defined. The linker uses the `LIB` path when it searches for an object, library, or other file specified on the command line or by the [`/BASE`](base-base-address.md) option. It also uses the `LIB` path to find a `.pdb` file named in an object. The `LIB` variable can contain one or more path specifications, separated by semicolons. One path must point to the `\lib` subdirectory of your Visual C++ installation.
69+
- `PATH`, if the tool needs to run `CVTRES` and can't find the file in the same directory as `link.exe` itself. (`link.exe` requires `CVTRES` to link a `.res` file.) `PATH` must point to the `\bin` subdirectory of your Visual C++ installation.
70+
- `TMP`, to specify a directory when linking OMF or `.res` files.
7771

7872
## See also
7973

80-
[C/C++ Building Reference](c-cpp-building-reference.md)
81-
[MSVC Linker Options](linker-options.md)
82-
[Module-Definition (.def) Files](module-definition-dot-def-files.md)
74+
[C/C++ Building Reference](c-cpp-building-reference.md)\
75+
[MSVC Linker Options](linker-options.md)\
76+
[Module-Definition (.def) Files](module-definition-dot-def-files.md)\
8377
[Linker Support for Delay-Loaded DLLs](linker-support-for-delay-loaded-dlls.md)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
description: "Learn more about: /NOFUNCTIONPADSECTION (Disable function padding)"
3+
title: "/NOFUNCTIONPADSECTION (Disable function padding)"
4+
ms.date: 01/09/2024
5+
helpviewer_keywords: ["/NOFUNCTIONPADSECTION linker option", "-NOFUNCTIONPADSECTION linker option", "NOFUNCTIONPADSECTION linker option"]
6+
---
7+
# /NOFUNCTIONPADSECTION (Disable function padding)
8+
9+
Disables function padding for functions in the specified section.
10+
11+
## Syntax
12+
13+
```
14+
/NOFUNCTIONPADSECTION:[name]
15+
```
16+
17+
## Arguments
18+
19+
*name*\
20+
The name of the section to disable x64 function padding in.
21+
22+
## Remarks
23+
24+
You can instruct the linker to put a specified minimum number of bytes between functions with [`/FUNCTIONPADMIN` (Create hotpatchable image)](../reference/functionpadmin-create-hotpatchable-image.md) and [`/ARM64XFUNCTIONPADMINX64`](arm64-function-pad-min-x64.md). This flag disables adding that padding for the specified sections.
25+
26+
To exclude multiple sections, specify the switch multiple times.
27+
28+
This flag is available starting with in Visual Studio 17.8 and later.
29+
30+
### To set this linker option in the Visual Studio development environment
31+
32+
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).
33+
1. Select the **Configuration Properties** > **Linker** > **Command Line** property page.
34+
1. Modify the **Additional Options** property to include **/NOFUNCTIONPADSECTION:**`name`, where `name` is the name of the section to disable x64 function padding in, and then choose **OK**.
35+
36+
### To set this linker option programmatically
37+
38+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.
39+
40+
## See also
41+
42+
[MSVC Linker Options](linker-options.md)\
43+
[MSVC linker reference](linking.md)

docs/build/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,8 @@ items:
923923
href: ../build/reference/allowisolation-manifest-lookup.md
924924
- name: /APPCONTAINER (UWP/Microsoft Store app)
925925
href: ../build/reference/appcontainer-windows-store-app.md
926+
- name: /ARM64XFUNCTIONPADMINX64 (Minimum x64 function padding)
927+
href: ../build/reference/arm64-function-pad-min-x64.md
926928
- name: /ASSEMBLYDEBUG (Add DebuggableAttribute)
927929
href: ../build/reference/assemblydebug-add-debuggableattribute.md
928930
- name: /ASSEMBLYLINKRESOURCE (Link to .NET Framework resource)
@@ -1053,6 +1055,8 @@ items:
10531055
href: ../build/reference/nodefaultlib-ignore-libraries.md
10541056
- name: /NOENTRY (No entry point)
10551057
href: ../build/reference/noentry-no-entry-point.md
1058+
- name: /NOFUNCTIONPADSECTION (Disable function padding)
1059+
href: ../build/reference/no-function-pad-section.md
10561060
- name: /NOLOGO (Suppress startup banner) (Linker)
10571061
href: ../build/reference/nologo-suppress-startup-banner-linker.md
10581062
- name: /NXCOMPAT (Compatible with Data Execution Prevention)

0 commit comments

Comments
 (0)