[llvm] [XCOFF][obj2yaml] Support SymbolAlignmentAndType as 2 separate fields in YAML. (PR #76828)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 12 08:01:03 PST 2024
================
@@ -525,11 +526,19 @@ bool XCOFFWriter::writeRelocations() {
}
void XCOFFWriter::writeAuxSymbol(const XCOFFYAML::CsectAuxEnt &AuxSym) {
+ uint8_t SymAlignAndType = AuxSym.SymbolAlignmentAndType.value_or(0);
+ if (AuxSym.SymbolType)
+ SymAlignAndType = (SymAlignAndType & ~XCOFFCsectAuxRef::SymbolTypeMask) |
+ *AuxSym.SymbolType;
+ if (AuxSym.SymbolAlignment)
+ SymAlignAndType =
+ (SymAlignAndType & ~XCOFFCsectAuxRef::SymbolAlignmentMask) |
+ (*AuxSym.SymbolAlignment << XCOFFCsectAuxRef::SymbolAlignmentBitOffset);
----------------
diggerlin wrote:
if both forms in a YAML file, in the source code "SymbolType/SymbolAlignment" will override SymbolAlignment, but the user may not know the rule, I have same opinion as Jame to emit an error to specify both forms.
if it is difficult to emit error/warning, I am prefer support "SymbolType/SymbolAlignment" not support SymbolAlignment.
since you only output SymbolType/SymbolAlignment in the xcoff2yaml.
https://github.com/llvm/llvm-project/pull/76828
More information about the llvm-commits
mailing list