| # RUN: llvm-objcopy --only-section=foo %t %t2 |
| # RUN: obj2yaml %t2 | FileCheck --implicit-check-not TYPE --implicit-check-not linking %s |
| ## Test that it's the same with only-section + keep-section (for the same section). |
| # RUN: llvm-objcopy --only-section=foo --keep-section=foo %t %t2 |
| # RUN: obj2yaml %t2 | FileCheck --implicit-check-not TYPE --implicit-check-not linking %s |
| ## Also test that only-section overrides remove-section. |
| # RUN: llvm-objcopy --only-section=foo --remove-section=foo %t %t2 |
| # RUN: obj2yaml %t2 | FileCheck --implicit-check-not linking %s |
| ## This file has both known and custom sections. Check that only the foo section is left. |
| # CHECK-NEXT: - Type: CUSTOM |
| # CHECK-NEXT: Payload: DEADBEEF |
| ## Test that only-section + keep-section keeps both sections. |
| # RUN: llvm-objcopy --only-section=foo --keep-section=linking %t %t2 |
| # RUN: obj2yaml %t2 | FileCheck --implicit-check-not=TYPE --check-prefix=KEEP %s |