Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 2 additions & 6 deletions llvm/lib/ObjCopy/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ Expected<const XCOFFConfig &> ConfigManager::getXCOFFConfig() const {

Expected<const DXContainerConfig &>
ConfigManager::getDXContainerConfig() const {
// If a flag is listed below, then it may be implemented in the future. All
// other flags are not applicable and will be silently ignored for the
// DXContainer object file
// All other flags are either supported or not applicable for DXContainer
// object files and will be silently ignored.
if (!Common.AddGnuDebugLink.empty() || !Common.SplitDWO.empty() ||
!Common.AllocSectionsPrefix.empty() ||
Common.DiscardMode != DiscardType::None || !Common.AddSection.empty() ||
Expand All @@ -130,8 +129,5 @@ ConfigManager::getDXContainerConfig() const {
llvm::errc::invalid_argument,
"no flags are supported yet, only basic copying is allowed");
}

// If a flag is listed here, then it has support for DXContainer:
// Common.PreserveDates
return DXContainer;
}
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-objcopy/DXContainer/basic-copy.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Tests that the copied DXContainer is identical to the original
## Tests that the copied DXContainer is identical to the original.

# RUN: yaml2obj %s -o %t
# RUN: llvm-objcopy %t %t.out
Expand Down
46 changes: 46 additions & 0 deletions llvm/test/tools/llvm-objcopy/DXContainer/basic-errs.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Check that llvm-objcopy reports a suitable error when it
## encounters an invalid input during reading. The purpose is not to have
## extensive of all read errors, that should be done in DXContainerTest.cpp,
## instead this is a sanity check that the error is produced when using the
## reader in llvm-objcopy.

## We can't have multiple DXIL parts.
# RUN: yaml2obj %s --docnum=1 -o %t1
# RUN: not llvm-objcopy %t1 %t1.out 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=ERROR1

# ERROR1: error: '[[FILE]]': More than one DXIL part is present in the file

--- !dxcontainer
Header:
Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
Version:
Major: 1
Minor: 0
PartCount: 2
Parts:
- Name: DXIL
Size: 28
- Name: DXIL
Size: 28
...

## The first part offset is out of file bound.
# RUN: yaml2obj %s --docnum=2 -o %t2
# RUN: not llvm-objcopy %t2 %t2.out 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=ERROR2

# ERROR2: error: '[[FILE]]': Reading structure out of file bounds

--- !dxcontainer
Header:
Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
Version:
Major: 2
Minor: 0
PartCount: 1
PartOffsets: [ 48 ]
Parts:
- Name: DXIL
Size: 28
...
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-objcopy/DXContainer/headers-copy.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Tests that the copied DXContainer is identical to the original, ensuring all
## the different headers are correctly handled
## the different headers are correctly handled.

# RUN: yaml2obj %s -o %t
# RUN: llvm-objcopy %t %t.out
Expand All @@ -12,7 +12,7 @@ Header:
Version:
Major: 1
Minor: 0
FileSize: 3548
FileSize: 1996
PartCount: 7
PartOffsets: [ 60, 76, 92, 108, 236, 1932, 1960 ]
Parts:
Expand Down
Loading