VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/compiler/vcc/loadcfg-vcc.c@ 95845

最後變更 在這個檔案從95845是 95834,由 vboxsync 提交於 3 年 前

IPRT/nocrt: Call C & C++ initializers and terminators. TLS directory (not used by VBoxControl). bugref:10261

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 8.2 KB
 
1/* $Id: loadcfg-vcc.c 95834 2022-07-26 14:46:59Z vboxsync $ */
2/** @file
3 * IPRT - Visual C++ Compiler - PE/Windows Load Configuration.
4 *
5 * @note This is a C file and not C++ because the compiler generates fixups
6 * that upsets the linker (ADDR32 + ADDR32_4 instead of ADDR64).
7 */
8
9/*
10 * Copyright (C) 2022 Oracle Corporation
11 *
12 * This file is part of VirtualBox Open Source Edition (OSE), as
13 * available from http://www.alldomusa.eu.org. This file is free software;
14 * you can redistribute it and/or modify it under the terms of the GNU
15 * General Public License (GPL) as published by the Free Software
16 * Foundation, in version 2 as it comes in the "COPYING" file of the
17 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19 *
20 * The contents of this file may alternatively be used under the terms
21 * of the Common Development and Distribution License Version 1.0
22 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
23 * VirtualBox OSE distribution, in which case the provisions of the
24 * CDDL are applicable instead of those of the GPL.
25 *
26 * You may elect to license modified versions of this file under the
27 * terms and conditions of either the GPL or the CDDL or both.
28 */
29
30
31/*********************************************************************************************************************************
32* Header Files *
33*********************************************************************************************************************************/
34#include "internal/iprt.h"
35#include <iprt/formats/pecoff.h>
36
37#include "internal/compiler-vcc.h"
38
39
40/*********************************************************************************************************************************
41* Global Variables *
42*********************************************************************************************************************************/
43extern uintptr_t __security_cookie; /**< nocrt-stack-win.asm */
44#ifdef RT_ARCH_X86
45extern uintptr_t __safe_se_handler_table[]; /**< Linker generated. */
46extern uint8_t __safe_se_handler_count; /**< Absolute "address" defined by the linker representing the table size. */
47#endif
48extern uintptr_t __guard_check_icall_fptr; /**< nocrt-guard-win.asm */
49#ifdef RT_ARCH_AMD64
50extern uintptr_t __guard_dispatch_icall_fptr;/**< nocrt-guard-win.asm */
51#endif
52extern uintptr_t __guard_fids_table[]; /**< Linker generated. */
53extern uint8_t __guard_fids_count; /** Another absolute "address" generated by the linker for a table size. */
54extern uint8_t __guard_flags; /** Another absolute "address" generated by the linker, flags value this time. */
55extern uintptr_t __guard_iat_table[]; /**< Linker generated. */
56extern uint8_t __guard_iat_count; /** Another absolute "address" generated by the linker for a table size. */
57extern uintptr_t __guard_longjmp_table[]; /**< Linker generated. */
58extern uint8_t __guard_longjmp_count; /** Another absolute "address" generated by the linker for a table size. */
59extern uint8_t __enclave_config; /** Another absolute "address" generated by the linker, flags value this time. */
60extern uintptr_t __guard_eh_cont_table[]; /**< Linker generated. */
61extern uint8_t __guard_eh_cont_count; /** Another absolute "address" generated by the linker for a table size. */
62#ifdef RT_ARCH_AMD64
63extern uintptr_t __guard_xfg_check_icall_fptr; /**< nocrt-guard-win.asm */
64extern uintptr_t __guard_xfg_dispatch_icall_fptr; /**< nocrt-guard-win.asm */
65extern uintptr_t __guard_xfg_table_dispatch_icall_fptr; /**< nocrt-guard-win.asm */
66#endif
67
68
69/**
70 * The load configuration for the PE image.
71 *
72 * The name of this is dictated by the linker, as it looks for a
73 * _load_config_used symbol and puts it's address and (somehow) size in the load
74 * config data dir entry.
75 *
76 * @todo use _MSC_VER to reduce this for older linkers which doesn't support all
77 * the machinactions we include here for the 2019 (14.29.30139.0) linker.
78 */
79RT_CONCAT(IMAGE_LOAD_CONFIG_DIRECTORY, ARCH_BITS) const _load_config_used =
80{
81 /* .Size = */ sizeof(_load_config_used),
82 /* .TimeDateStamp = */ 0,
83 /* .MajorVersion = */ 0,
84 /* .MinorVersion = */ 0,
85 /* .GlobalFlagsClear = */ 0,
86 /* .GlobalFlagsSet = */ 0,
87 /* .CriticalSectionDefaultTimeout = */ 0,
88 /* .DeCommitFreeBlockThreshold = */ 0,
89 /* .DeCommitTotalFreeThreshold = */ 0,
90 /* .LockPrefixTable = */ 0,
91 /* .MaximumAllocationSize = */ 0,
92 /* .VirtualMemoryThreshold = */ 0,
93 /* .ProcessHeapFlags = */ 0,
94 /* .ProcessAffinityMask = */ 0,
95 /* .CSDVersion = */ 0,
96 /* .DependentLoadFlags = */ 0,
97 /* .EditList = */ 0,
98 /* .SecurityCookie = */ (uintptr_t)&__security_cookie,
99#ifdef RT_ARCH_X86
100 /* .SEHandlerTable = */ (uintptr_t)&__safe_se_handler_table[0],
101 /* .SEHandlerCount = */ (uintptr_t)&__safe_se_handler_count, /* Absolute "address", remember. */
102#else
103 /* .SEHandlerTable = */ 0,
104 /* .SEHandlerCount = */ 0,
105#endif
106 /* .GuardCFCCheckFunctionPointer = */ (uintptr_t)&__guard_check_icall_fptr,
107#ifdef RT_ARCH_AMD64
108 /* .GuardCFDispatchFunctionPointer = */ (uintptr_t)&__guard_dispatch_icall_fptr,
109#else
110 /* .GuardCFDispatchFunctionPointer = */ 0,
111#endif
112 /* .GuardCFFunctionTable = */ (uintptr_t)&__guard_fids_table[0],
113 /* .GuardCFFunctionCount = */ (uintptr_t)&__guard_fids_count, /* Absolute "address", remember. */
114 /* .GuardFlags = */ (uint32_t)(uintptr_t)&__guard_flags, /* Ditto. */
115 /* .CodeIntegrity = */ { 0, 0, 0, 0 },
116 /* .GuardAddressTakenIatEntryTable = */ (uintptr_t)__guard_iat_table,
117 /* .GuardAddressTakenIatEntryCount = */ (uintptr_t)&__guard_iat_count, /* The same. */
118 /* .GuardLongJumpTargetTable = */ (uintptr_t)&__guard_longjmp_table[0],
119 /* .GuardLongJumpTargetCount = */ (uintptr_t)&__guard_longjmp_count, /* Another one. */
120 /* .DynamicValueRelocTable = */ 0,
121 /* .CHPEMetadataPointer = */ 0, /** @todo ARM */
122 /* .GuardRFFailureRoutine = */ 0,
123 /* .GuardRFFailureRoutineFunctionPointer= */ 0,
124 /* .DynamicValueRelocTableOffset = */ 0,
125 /* .DynamicValueRelocTableSection = */ 0,
126 /* .Reserved2 = */ 0,
127 /* .GuardRFVerifyStackPointerFunctionPointer=*/ 0,
128 /* .HotPatchTableOffset = */ 0,
129 /* .Reserved3 = */ 0,
130 /* .EnclaveConfigurationPointer = */ (uintptr_t)&__enclave_config, /* And another one. */
131 /* .VolatileMetadataPointer = */ 0,
132 /* .GuardEHContinuationTable = */ (uintptr_t)&__guard_eh_cont_table[0],
133 /* .GuardEHContinuationCount = */ (uintptr_t)&__guard_eh_cont_count, /* Yet another one. */
134#ifdef RT_ARCH_AMD64
135 /* .GuardXFGCheckFunctionPointer = */ (uintptr_t)&__guard_xfg_check_icall_fptr,
136 /* .GuardXFGDispatchFunctionPointer = */ (uintptr_t)&__guard_xfg_dispatch_icall_fptr,
137 /* .GuardXFGTableDispatchFunctionPointer= */ (uintptr_t)&__guard_xfg_table_dispatch_icall_fptr,
138#else
139 /* .GuardXFGCheckFunctionPointer = */ 0,
140 /* .GuardXFGDispatchFunctionPointer = */ 0,
141 /* .GuardXFGTableDispatchFunctionPointer= */ 0,
142#endif
143 /* .CastGuardOsDeterminedFailureMode = */ 0,
144};
145
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette