Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,12 @@
-->
<_NativeVersionFileContents>
<![CDATA[
#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS)
#define RETAIN __attribute__((used))
#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS) && defined(TARGET_AMD64)
char sccsid[] __attribute__((used, weak)) = "@(#)Version $(FileVersion)$(_SourceBuildInfo)";
__asm__(".pushsection .init_array; .reloc ., R_X86_64_NONE, sccsid; .popsection");
#else
#define RETAIN __attribute__((used, retain))
static char sccsid[] __attribute__((used, retain)) = "@(#)Version $(FileVersion)$(_SourceBuildInfo)";
#endif

static char sccsid[] RETAIN = "@(#)Version $(FileVersion)$(_SourceBuildInfo)";
]]>
</_NativeVersionFileContents>
</PropertyGroup>
Expand Down
8 changes: 3 additions & 5 deletions 8 src/deployment-tools/eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,12 @@ build_native()
else
# Generate the dummy version.c and runtime_version.h, but only if they didn't exist to make sure we don't trigger unnecessary rebuild
__versionSourceContent=$(cat <<'EOF'
#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS)
#define RETAIN __attribute__((used))
#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS) && defined(TARGET_AMD64)
char sccsid[] __attribute__((used, weak)) = "@(#)No version information produced";
__asm__(".pushsection .init_array; .reloc ., R_X86_64_NONE, sccsid; .popsection");
#else
#define RETAIN __attribute__((used, retain))
static char sccsid[] __attribute__((used, retain)) = "@(#)No version information produced";
#endif

static char sccsid[] RETAIN = "@(#)No version information produced";
EOF
)
if [[ -e "$__versionSourceFile" ]]; then
Expand Down
8 changes: 3 additions & 5 deletions 8 src/diagnostics/eng/native/version/_version.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS)
#define RETAIN __attribute__((used))
#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS) && defined(TARGET_AMD64)
char sccsid[] __attribute__((used, weak)) = "@(#)No version information produced";
__asm__(".pushsection .init_array; .reloc ., R_X86_64_NONE, sccsid; .popsection");
#else
#define RETAIN __attribute__((used, retain))
static char sccsid[] __attribute__((used, retain)) = "@(#)No version information produced";
#endif

static char sccsid[] RETAIN = "@(#)No version information produced";
5 changes: 3 additions & 2 deletions 5 src/diagnostics/eng/native/version/copy_version_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ for path in "${__VersionFolder}/"*{.h,.c}; do
# update commit
commit="$(git rev-parse HEAD 2>/dev/null)"
commit="${commit:-N/A}"
substitute="$(printf 'static char sccsid[] RETAIN = "@(#)Version N/A @Commit: %s";\n' "$commit")"
version_file_contents="$(cat "$path" | sed "s|^static.*|$substitute|")"
weak_substitute="$(printf 'char sccsid[] __attribute__((used, weak)) = "@(#)Version N/A @Commit: %s";\n' "$commit")"
retain_substitute="$(printf 'static char sccsid[] __attribute__((used, retain)) = "@(#)Version N/A @Commit: %s";\n' "$commit")"
version_file_contents="$(cat "$path" | sed -e "s|^char sccsid\[\].*|$weak_substitute|" -e "s|^static char sccsid\[\].*|$retain_substitute|")"
version_file_destination="$__RepoRoot/artifacts/obj/_version.c"
current_contents=
is_placeholder_file=
Expand Down
8 changes: 3 additions & 5 deletions 8 src/runtime/eng/native/version/_version.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS)
#define RETAIN __attribute__((used))
#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS) && defined(TARGET_AMD64)
char sccsid[] __attribute__((used, weak)) = "@(#)No version information produced";
__asm__(".pushsection .init_array; .reloc ., R_X86_64_NONE, sccsid; .popsection");
#else
#define RETAIN __attribute__((used, retain))
static char sccsid[] __attribute__((used, retain)) = "@(#)No version information produced";
#endif

static char sccsid[] RETAIN = "@(#)No version information produced";
5 changes: 3 additions & 2 deletions 5 src/runtime/eng/native/version/copy_version_files.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ Get-ChildItem -Path "$VersionFolder" -Filter "_version.*" | ForEach-Object {
# For _version.c, update the commit ID if it has changed from the last build.
$commit = (git rev-parse HEAD 2>$null)
if (-not $commit) { $commit = "N/A" }
$substitute = "static char sccsid[] RETAIN = `"@(#)Version N/A @Commit: $commit`";"
$version_file_contents = Get-Content -Path $path | ForEach-Object { $_ -replace "^static.*", $substitute }
$weak_substitute = "char sccsid[] __attribute__((used, weak)) = `"@(#)Version N/A @Commit: $commit`";"
$retain_substitute = "static char sccsid[] __attribute__((used, retain)) = `"@(#)Version N/A @Commit: $commit`";"
$version_file_contents = Get-Content -Path $path | ForEach-Object { $_ -replace "^char sccsid\[\].*", $weak_substitute -replace "^static char sccsid\[\].*", $retain_substitute }
$version_file_destination = "$RepoRoot\\artifacts\\obj\\_version.c"
$current_contents = ""
$is_placeholder_file = $false
Expand Down
5 changes: 3 additions & 2 deletions 5 src/runtime/eng/native/version/copy_version_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ for path in "${__VersionFolder}/"*{.h,.c}; do
# update commit
commit="$(git rev-parse HEAD 2>/dev/null)"
commit="${commit:-N/A}"
substitute="$(printf 'static char sccsid[] RETAIN = "@(#)Version N/A @Commit: %s";\n' "$commit")"
version_file_contents="$(cat "$path" | sed "s|^static.*|$substitute|")"
weak_substitute="$(printf 'char sccsid[] __attribute__((used, weak)) = "@(#)Version N/A @Commit: %s";\n' "$commit")"
retain_substitute="$(printf 'static char sccsid[] __attribute__((used, retain)) = "@(#)Version N/A @Commit: %s";\n' "$commit")"
version_file_contents="$(cat "$path" | sed -e "s|^char sccsid\[\].*|$weak_substitute|" -e "s|^static char sccsid\[\].*|$retain_substitute|")"
version_file_destination="$__RepoRoot/artifacts/obj/_version.c"
current_contents=
is_placeholder_file=
Expand Down
10 changes: 4 additions & 6 deletions 10 src/runtime/src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -858,14 +858,12 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
else()
if(NOT EXISTS "${VERSION_FILE_PATH}")
file(WRITE "${VERSION_FILE_PATH}"
"#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS)\n"
"#define RETAIN __attribute__((used))\n"
"#if defined(__GNUC__) && !defined(__clang__) && defined(TARGET_SUNOS) && defined(TARGET_AMD64)\n"
"char sccsid[] __attribute__((used, weak)) = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n"
"__asm__(\".pushsection .init_array; .reloc ., R_X86_64_NONE, sccsid; .popsection\");\n"
"#else\n"
"#define RETAIN __attribute__((used, retain))\n"
"#endif\n"
"\n"
"static char sccsid[] RETAIN = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n")
"static char sccsid[] __attribute__((used, retain)) = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n"
"#endif\n")
endif()
endif()
if (NOT EXISTS "${RUNTIME_VERSION_HEADER_PATH}")
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.