diff options
author | Esme-Yi <esme.yi@ibm.com> | 2021-09-14 06:18:03 +0000 |
---|---|---|
committer | Esme-Yi <esme.yi@ibm.com> | 2021-09-14 06:18:03 +0000 |
commit | b98c3e957f564d1101c1fe1522686c7d0a9a9ddb (patch) | |
tree | cd669c3c9d4605eed89064f270b9841f348deebd /llvm/lib/Object/XCOFFObjectFile.cpp | |
parent | 8b4afc5aef148aff26047ca7bad4cdcf58c35e25 (diff) | |
download | llvm-b98c3e957f564d1101c1fe1522686c7d0a9a9ddb.zip llvm-b98c3e957f564d1101c1fe1522686c7d0a9a9ddb.tar.gz llvm-b98c3e957f564d1101c1fe1522686c7d0a9a9ddb.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Object/XCOFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/XCOFFObjectFile.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp index dc9dcc0..edbf3f4 100644 --- a/llvm/lib/Object/XCOFFObjectFile.cpp +++ b/llvm/lib/Object/XCOFFObjectFile.cpp @@ -592,7 +592,9 @@ uint16_t XCOFFObjectFile::getMagic() const { Expected<DataRefImpl> XCOFFObjectFile::getSectionByNum(int16_t Num) const { if (Num <= 0 || Num > getNumberOfSections()) - return errorCodeToError(object_error::invalid_section_index); + return createStringError(object_error::invalid_section_index, + "the section index (" + Twine(Num) + + ") is invalid"); DataRefImpl DRI; DRI.p = getWithOffset(getSectionHeaderTableAddress(), |