This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj]Re-allow dynamic sections to have raw content
ClosedPublic

Authored by jhenderson on Feb 22 2019, 4:21 AM.

Details

Summary

Recently, support was added to yaml2obj to allow dynamic sections to have a list of entries, to make it easier to write tests with dynamic sections. However, this change also removed the abiltiy to provide custom contents to the dynamic section, making it hard to test malformed contents (e.g. because the section is valid size to contain an array of entries). This change reinstates this. An error is emitted if raw content and dynamic entries are both specified.

Diff Detail

Repository
rL LLVM

Event Timeline

jhenderson created this revision.Feb 22 2019, 4:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2019, 4:21 AM
grimar accepted this revision.Feb 22 2019, 4:27 AM

LGTM with a minor nit.

test/tools/yaml2obj/dynamic-section-raw-content.yaml
21

Could you group (move closer) the invocations and check lines?
i.e:

# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj -x .dynamic --sections %t1 | FileCheck %s --check-prefix=RAW

# RAW:      Name: .dynamic
# RAW-NEXT: Type: SHT_DYNAMIC
# RAW-NEXT: Flags [
# RAW-NEXT: ]
# RAW-NEXT: Address:
# RAW-NEXT: Offset:
# RAW-NEXT: Size: 5

# RAW:      Hex dump of section '.dynamic':
# RAW-NEXT: 0x00000000 01234567 89 {{.*}}

# RUN: not yaml2obj --docnum=2 %s -o %t2 2>&1 | FileCheck %s --check-prefix=ERR
# ERR: Cannot specify both raw content and explicit entries for dynamic section '.dynamic'.
This revision is now accepted and ready to land.Feb 22 2019, 4:27 AM

Re-order test run/check lines.