Repository navigation
[ELD] Diagnose tar archives given as input files #2061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ricardo Alves de Souza (ricardoasouz)
wants to merge
1
commit into
qualcomm:main
Choose a base branch
from
ricardoasouz:fix/2042-tar-archive-input
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+112
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
| #!/usr/bin/env python3 | ||
| # Usage: make_tar.py FILE OUTPUT | ||
| # Writes OUTPUT as a tar archive holding FILE, like `tar cf OUTPUT FILE`. | ||
| import os | ||
| import sys | ||
| import tarfile | ||
|
|
||
| src, out = sys.argv[1:] | ||
| with tarfile.open(out, "w", format=tarfile.GNU_FORMAT) as tar: | ||
| tar.add(src, arcname=os.path.basename(src)) |
This file contains hidden or 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 @@ | ||
| #---TarArchiveInput.test-------------------------- Executable -----------------# | ||
| #BEGIN_COMMENT | ||
| # Inputs that are not ELF, bitcode or ar archive files are parsed as linker | ||
| # scripts. This tests that the linker recognizes a tar archive given as an | ||
| # input file, on the command line or through INPUT() or GROUP(), and errors | ||
| # out instead of lexing it. With -b binary, the archive is still raw data. | ||
| #END_COMMENT | ||
| #START_TEST | ||
| RUN: %clang %clangopts -c %p/Inputs/1.c -o %t1.1.o | ||
| RUN: %python %p/Inputs/make_tar.py %t1.1.o %t1.a.tar | ||
| RUN: %not %link %linkopts %t1.a.tar -o %t2.out 2>&1 | %filecheck %s | ||
| RUN: %not %link %linkopts %t1.1.o %t1.a.tar -o %t2.out 2>&1 | %filecheck %s | ||
| RUN: echo "INPUT(%t1.a.tar)" > %t1.input.t | ||
| RUN: %not %link %linkopts %t1.1.o %t1.input.t -o %t2.out 2>&1 | %filecheck %s | ||
| RUN: echo "GROUP(%t1.a.tar)" > %t1.group.t | ||
| RUN: %not %link %linkopts %t1.1.o %t1.group.t -o %t2.out 2>&1 | %filecheck %s | ||
| RUN: %link %linkopts %t1.1.o -b binary %t1.a.tar -o %t2.out | ||
| RUN: %readelf -s %t2.out | %filecheck %s --check-prefix=BINARY | ||
| #END_TEST | ||
|
|
||
| CHECK-NOT: Ignoring invalid ASCII character | ||
| CHECK: Error: {{.*}}a.tar: tar archives cannot be used as input files | ||
| CHECK-NOT: has errors | ||
|
|
||
| BINARY: _binary_{{.*}}_a_tar_start |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.