forked from flang-compiler/f18-llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply: [WebAssembly] Implement build-id feature
Implement the --build-id flag similarly to ELF, and generate a build_id section according to the WebAssembly tool convention specified in WebAssembly/tool-conventions#183 The default style ("fast" aka "tree") hashes the contents of the output and (unlike ELF) generates a v5 UUID based on the hash (using a random namespace). It also supports generating a random v4 UUID, a sha1 hash, and a user-specified string (as ELF does). Differential Revision: https://reviews.llvm.org/D107662 Fix MSVC build by std::copy on the underying buffer rather than directly from std::array to llvm::MutableArrayRef
- Loading branch information
Showing
7 changed files
with
257 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# RUN: llvm-mc -filetype=obj -triple=wasm32 %p/Inputs/start.s -o %t | ||
|
||
# RUN: wasm-ld --build-id %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s | ||
# RUN: wasm-ld --build-id=fast %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s | ||
# RUN: wasm-ld --build-id %t -o %t2 --threads=1 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s | ||
|
||
# RUN: wasm-ld --build-id=sha1 %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s | ||
# RUN: wasm-ld --build-id=sha1 %t -o %t2 --threads=1 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s | ||
|
||
# RUN: wasm-ld --build-id=tree %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s | ||
# RUN: wasm-ld --build-id=tree %t -o %t2 --threads=1 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s | ||
|
||
# RUN: wasm-ld --build-id=uuid %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=UUID %s | ||
|
||
# RUN: wasm-ld --build-id=0x12345678 %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=HEX %s | ||
|
||
# RUN: wasm-ld %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=NONE %s | ||
|
||
# RUN: wasm-ld --build-id=sha1 --build-id=none %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=NONE %s | ||
# RUN: wasm-ld --build-id --build-id=none %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=NONE %s | ||
# RUN: wasm-ld --build-id=none --build-id %t -o %t2 | ||
# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s | ||
|
||
.section .data.foo,"",@ | ||
.globl foo | ||
.hidden foo | ||
.p2align 2 | ||
foo: | ||
.int32 1 | ||
.size foo, 4 | ||
|
||
|
||
# DEFAULT: Contents of section build_id: | ||
# DEFAULT-NEXT: 0000 10cdbf99 f76b1f5e ebb2f36a 1bde1d6c .....k.^...j...l | ||
# DEFAULT-NEXT: 0010 01 | ||
|
||
# SHA1: Contents of section build_id: | ||
# SHA1-NEXT: 0000 14ad22e8 54d72438 94af85de 3c5592bd ..".T.$8....<U.. | ||
# SHA1-NEXT: 0010 1b5ec96f 6b .^.ok | ||
|
||
# UUID: Contents of section build_id: | ||
# UUID-NEXT: 0000 10 | ||
|
||
# HEX: Contents of section build_id: | ||
# HEX-NEXT: 0000 04123456 78 ..4Vx | ||
|
||
|
||
# NONE-NOT: Contents of section build_id: |
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