-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34997 from janvorli/implement-native-getmoduleindex
Implement native GetModuleIndex
- Loading branch information
Showing
13 changed files
with
86 additions
and
170 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@echo off | ||
REM Generate module index header | ||
|
||
if [%1]==[] goto :Usage | ||
if [%2]==[] goto :Usage | ||
|
||
setlocal | ||
for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"size of image"') do set imagesize=%%i | ||
REM Pad the extracted size to 8 hex digits | ||
set imagesize=00000000%imagesize% | ||
set imagesize=%imagesize:~-8% | ||
|
||
for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"time date"') do set timestamp=%%i | ||
REM Pad the extracted time stamp to 8 hex digits | ||
set timestamp=00000000%timestamp% | ||
set timestamp=%timestamp:~-8% | ||
|
||
echo 0x08, 0x%timestamp:~6,2%, 0x%timestamp:~4,2%, 0x%timestamp:~2,2%, 0x%timestamp:~0,2%, 0x%imagesize:~6,2%, 0x%imagesize:~4,2%, 0x%imagesize:~2,2%, 0x%imagesize:~0,2%, > %2 | ||
|
||
endlocal | ||
exit /b 0 | ||
|
||
:Usage | ||
echo Usage: genmoduleindex.cmd ModuleBinaryFile IndexHeaderFile | ||
exit /b 1 |
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 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Generate module index header | ||
# | ||
set -euo pipefail | ||
|
||
if [[ "$#" -lt 2 ]]; then | ||
echo "Usage: genmoduleindex.sh ModuleBinaryFile IndexHeaderFile" | ||
exit 1 | ||
fi | ||
|
||
OSName=$(uname -s) | ||
|
||
case "$OSName" in | ||
Darwin) | ||
# Extract the build id and prefix it with its length in bytes | ||
dwarfdump -u $1 | | ||
awk '/UUID:/ { gsub(/\-/,"", $2); printf("%02x", length($2)/2); print $2}' | | ||
# Convert each byte of the id to 0x prefixed constant followed by comma | ||
sed -E s/\(\.\.\)/0x\\1,\ /g > $2 | ||
;; | ||
*) | ||
# Extract the build id and prefix it with its length in bytes | ||
readelf -n $1 | | ||
awk '/Build ID:/ { printf("%02x", length($3)/2); print $3 }' | | ||
# Convert each byte of the id to 0x prefixed constant followed by comma | ||
sed -E s/\(\.\.\)/0x\\1,\ /g > $2 | ||
;; | ||
esac |
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 was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
src/coreclr/src/tools/GetModuleIndex/GetModuleIndex.csproj
This file was deleted.
Oops, something went wrong.