[llvm] [XCOFF][obj2yaml] support parsing auxiliary symbols for XCOFF (PR #70642)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 21 13:59:26 PST 2023
================
@@ -282,45 +282,53 @@ static void auxSymMapping(IO &IO, XCOFFYAML::SectAuxEntForStat &AuxSym) {
void MappingTraits<std::unique_ptr<XCOFFYAML::AuxSymbolEnt>>::mapping(
IO &IO, std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym) {
- assert(!IO.outputting() && "We don't dump aux symbols currently.");
+
+ auto ResetAuxSym = [&](auto *AuxEnt) {
+ if (!IO.outputting())
+ AuxSym.reset(AuxEnt);
+ };
+
const bool Is64 =
static_cast<XCOFFYAML::Object *>(IO.getContext())->Header.Magic ==
(llvm::yaml::Hex16)XCOFF::XCOFF64;
+
XCOFFYAML::AuxSymbolType AuxType;
+ if (IO.outputting())
+ AuxType = AuxSym.get()->Type;
IO.mapRequired("Type", AuxType);
switch (AuxType) {
case XCOFFYAML::AUX_EXCEPT:
if (!Is64)
IO.setError("an auxiliary symbol of type AUX_EXCEPT cannot be defined in "
"XCOFF32");
- AuxSym.reset(new XCOFFYAML::ExcpetionAuxEnt());
+ ResetAuxSym(new XCOFFYAML::ExcpetionAuxEnt());
----------------
diggerlin wrote:
the error print out, but the it do not return function immediately. it go to the `ResetAuxSym(new XCOFFYAML::ExcpetionAuxEnt())` , since the ExcpetionAuxEnt is not support in the 32bit, do not need to run the `ResetAuxSym(new XCOFFYAML::ExcpetionAuxEnt());' is it correct ?
https://github.com/llvm/llvm-project/pull/70642
More information about the llvm-commits
mailing list