[yaml2obj][XCOFF] add the SectionIndex field for symbol.
authorEsme-Yi <esme.yi@ibm.com>
Tue, 14 Sep 2021 06:18:03 +0000 (06:18 +0000)
committerEsme-Yi <esme.yi@ibm.com>
Tue, 14 Sep 2021 06:18:03 +0000 (06:18 +0000)
commitb98c3e957f564d1101c1fe1522686c7d0a9a9ddb
treecd669c3c9d4605eed89064f270b9841f348deebd
parent8b4afc5aef148aff26047ca7bad4cdcf58c35e25
[yaml2obj][XCOFF] add the SectionIndex field for symbol.

Summary: Add the SectionIndex field for symbol.
1: a symbol can reference a section by SectionName or SectionIndex.
2: a symbol can reference a section by both SectionName and SectionIndex.
3: if both Section and SectionIndex are specified, but the two values refer
   to different sections, an error will be reported.
4: an invalid SectionIndex is allowed.
5: if a symbol references a non-existent section by SectionName, an error will be reported.

Reviewed By: jhenderson, Higuoxing

Differential Revision: https://reviews.llvm.org/D109566
llvm/include/llvm/ObjectYAML/XCOFFYAML.h
llvm/lib/Object/XCOFFObjectFile.cpp
llvm/lib/ObjectYAML/XCOFFEmitter.cpp
llvm/lib/ObjectYAML/XCOFFYAML.cpp
llvm/test/tools/yaml2obj/XCOFF/symbol-section.yaml [new file with mode: 0644]