This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy] - Reimplement strip-dwo-groups.test to stop using the precompiled object.
ClosedPublic

Authored by grimar on Jul 25 2019, 5:01 AM.

Details

Summary

When llvm-copy removes .dwo sections the index of symbol table,
the indices of the symbols and the indices of the sections which go
after the removed ones changes. That affects on SHT_GROUP sections,
which needs to be updated.

Initially this test used a precompiled object, I rewrote it to use YAML
and improved a bit.

Diff Detail

Event Timeline

grimar created this revision.Jul 25 2019, 5:01 AM
MaskRay added inline comments.Jul 25 2019, 8:14 PM
test/tools/llvm-objcopy/ELF/strip-dwo-groups.test
5–11

The comment may be too verbose. Suggested wording (please improve as you rewrite :) ):

After the removal of .dwo sections, the indices of sections which go after them will change. Check that the sh_link and sh_info fields of .group and their contents (indices of member sections) are updated.

69

Delete the empty Relocations:

jhenderson accepted this revision.Jul 26 2019, 3:59 AM

LGTM, once @MaskRay's comments have been addressed.

This revision is now accepted and ready to land.Jul 26 2019, 3:59 AM
grimar updated this revision to Diff 211915.Jul 26 2019, 5:10 AM
grimar marked 4 inline comments as done.
  • Addressed review comments.
test/tools/llvm-objcopy/ELF/strip-dwo-groups.test
5–11

Your version looks OK to me.

But I do not feel that "too verbose" is a problem,
I like to read the description of the problem and the details.
Unfortunately often svn/git commit comments are the only source.
"too verbose" is in my understanding can be used for the code comments,
but while we are in the test cases area, If you do not mind, I would keep it verbose.

69

Done (I thought this is a mandatory field, but it is not).

MaskRay accepted this revision.Jul 26 2019, 5:37 AM
MaskRay added inline comments.
test/tools/llvm-objcopy/ELF/strip-dwo-groups.test
5–11

Unfortunately often svn/git commit comments are the only source.

Agreed.

"too verbose" is in my understanding can be used for the code comments, but while we are in the test cases area, If you do not mind, I would keep it verbose.

I am fine with the current version but I feel we can convey the same information while making it more concise. For example, we don't have to emphasize the previous bug:

In the past llvm-objcopy --strip-dwo used to produce invalid binaries with broken .group section, this test verifies the correctness of Link, Info and the content of this section.

The expected behavior is kind of self-explanatory with the existence of the test.

their contents (indices of member sections) are updated.

It emphasizes the purpose updating the contents.

grimar marked an inline comment as done.Jul 27 2019, 3:37 AM
grimar added inline comments.
test/tools/llvm-objcopy/ELF/strip-dwo-groups.test
5–11

For example, we don't have to emphasize the previous bug

Sometimes the description of the previous bug can be helpful, but I agree with you that here it is not.
I'll remove the part that starts from "In the past..." before the commit.

grimar closed this revision.Jul 29 2019, 2:41 AM

Revision: 367202

The test appears to fail when the compilation path contains the debug_ substring.
This is not ideal.

FAIL: LLVM :: tools/llvm-objcopy/ELF/strip-dwo-groups.test (1254 of 2021)
******************** TEST 'LLVM :: tools/llvm-objcopy/ELF/strip-dwo-groups.test' FAILED ********************
Script:
--
: 'RUN: at line 1';   /tmp/llvm-project_debug_compiled-with-clang/bin/yaml2obj /redacted/llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-dwo-groups.test -o /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp
: 'RUN: at line 2';   /tmp/llvm-project_debug_compiled-with-clang/bin/llvm-objcopy --strip-dwo /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp
: 'RUN: at line 3';   /tmp/llvm-project_debug_compiled-with-clang/bin/llvm-readobj --symbols -S --elf-section-groups /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp | /tmp/llvm-project_debug_compiled-with-clang/bin/FileCheck /redacted/llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-dwo-groups.test --implicit-check-not=debug_
--
Exit Code: 1

Command Output (stderr):
--
command line:1:22: error: CHECK-NOT: excluded string found in input
-implicit-check-not='debug_'
                     ^
<stdin>:2:25: note: found here
File: /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp
                        ^~~~~~

--

********************
Testing Time: 6.87s
********************
Failing Tests (1):
    LLVM :: tools/llvm-objcopy/ELF/strip-dwo-groups.test

The test appears to fail when the compilation path contains the debug_ substring.
This is not ideal.

FAIL: LLVM :: tools/llvm-objcopy/ELF/strip-dwo-groups.test (1254 of 2021)
******************** TEST 'LLVM :: tools/llvm-objcopy/ELF/strip-dwo-groups.test' FAILED ********************
Script:
--
: 'RUN: at line 1';   /tmp/llvm-project_debug_compiled-with-clang/bin/yaml2obj /redacted/llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-dwo-groups.test -o /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp
: 'RUN: at line 2';   /tmp/llvm-project_debug_compiled-with-clang/bin/llvm-objcopy --strip-dwo /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp
: 'RUN: at line 3';   /tmp/llvm-project_debug_compiled-with-clang/bin/llvm-readobj --symbols -S --elf-section-groups /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp | /tmp/llvm-project_debug_compiled-with-clang/bin/FileCheck /redacted/llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-dwo-groups.test --implicit-check-not=debug_
--
Exit Code: 1

Command Output (stderr):
--
command line:1:22: error: CHECK-NOT: excluded string found in input
-implicit-check-not='debug_'
                     ^
<stdin>:2:25: note: found here
File: /tmp/llvm-project_debug_compiled-with-clang/test/tools/llvm-objcopy/ELF/Output/strip-dwo-groups.test.tmp
                        ^~~~~~

--

********************
Testing Time: 6.87s
********************
Failing Tests (1):
    LLVM :: tools/llvm-objcopy/ELF/strip-dwo-groups.test

Thanks for reporting! I committed rL367702, it should fix this.