-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[SystemZ][z/OS] yaml2obj GOFF symbols #75971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
36be167
ae601e2
e53969c
22c968e
25a8034
2ce0e3b
ddca557
c92c5c2
263bef6
85251f6
975462f
980e0d1
2861f97
97625ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -249,13 +249,13 @@ void GOFFState::writeHeader(GOFFYAML::FileHeader &FileHdr) { | |||||
void GOFFState::writeSymbol(GOFFYAML::Symbol Sym) { | ||||||
SmallString<80> SymName; | ||||||
if (std::error_code EC = ConverterEBCDIC::convertToEBCDIC(Sym.Name, SymName)) | ||||||
reportError("conversion error on " + Sym.Name); | ||||||
reportError("conversion error on " + Sym.Name + ": " + EC.message()); | ||||||
size_t SymNameLength = SymName.size(); | ||||||
if (SymNameLength > GOFF::MaxDataLength) | ||||||
reportError("symbol name is too long: " + Twine(SymNameLength) + | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test case for this error, please. |
||||||
". Max length is: " + Twine(GOFF::MaxDataLength)); | ||||||
|
||||||
unsigned NameLengthOffset = 69; | ||||||
const unsigned NameLengthOffset = 69; | ||||||
GW.makeNewRecord(GOFF::RT_ESD, NameLengthOffset + SymNameLength); | ||||||
GW << binaryBe(Sym.Type) // Symbol type | ||||||
<< binaryBe(Sym.ID) // ESDID | ||||||
|
@@ -308,11 +308,14 @@ bool GOFFState::writeObject() { | |||||
if (HasError) | ||||||
return false; | ||||||
// Iterate over all records. | ||||||
for (const std::unique_ptr<llvm::GOFFYAML::RecordBase> &Rec : Doc.Records) | ||||||
unsigned RecordNum = 0; | ||||||
for (const std::unique_ptr<llvm::GOFFYAML::RecordBase> &Rec : Doc.Records) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should look up the |
||||||
if (const auto *Sym = dyn_cast<GOFFYAML::Symbol>(Rec.get())) | ||||||
writeSymbol(*Sym); | ||||||
else | ||||||
reportError("unknown record type"); | ||||||
reportError("unknown record type on record index" + Twine(RecordNum)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This is clearer, I think. You should also have a test case for this error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is running in the wrong direction. The
There is no |
||||||
RecordNum++; | ||||||
} | ||||||
writeEnd(); | ||||||
return true; | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# RUN: yaml2obj %s | od -v -An -tx1 | FileCheck --ignore-case %s | ||
|
||
## This tests the long symbol name case requiring continuation records. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normally the order in tests is:
If there are multiple cases within the same test file, things vary a little depending on what typically changes between the test cases. |
||
|
||
--- !GOFF | ||
FileHeader: | ||
ArchitectureLevel: 1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# RUN: yaml2obj %s | od -v -An -tx1 | FileCheck --ignore-case %s | ||
|
||
## Test for 1 symbol case. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What coverage does this case give us that e.g. |
||
|
||
## Verify that GOFF Header is correct. | ||
# CHECK: 03 f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ||
# CHECK-NEXT: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,7 @@ | ||||||
# RUN: yaml2obj %s | od -v -An -tx1 | FileCheck --ignore-case %s | ||||||
jh7370 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## This tests contains a symbol where none of the optional fields are set. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## Verify that GOFF Header is correct. | ||||||
# CHECK: 03 f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ||||||
# CHECK-NEXT: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming back to this fresh, I think we can reword this:
You also should have a test case which triggers this error.