@@ -761,9 +761,7 @@ static void reportUndefinedSymbol(Ctx &ctx, const UndefinedDiag &undef,
761761
762762 // Provide a spelling-like hint when we fail to resolve a local symbol but
763763 // find a corresponding export in another compartment.
764- // FIXME: Is there a better way to test for cheriot here?
765- if (ctx.arg .isCheriAbi && ctx.arg .emachine == EM_RISCV &&
766- ctx.arg .capabilitySize == 8 ) {
764+ if (ctx.arg .eflags & EF_RISCV_CHERIOT) {
767765 StringRef SymName = sym.getName ();
768766 for (auto GlobalSymbol : ctx.symtab ->getSymbols ()) {
769767 if (!GlobalSymbol->isGlobal ())
@@ -792,39 +790,6 @@ static void reportUndefinedSymbol(Ctx &ctx, const UndefinedDiag &undef,
792790 }
793791 }
794792
795- // Provide a spelling-like hint when we fail to resolve a local symbol but
796- // find a corresponding export in another compartment.
797- // FIXME: Is there a better way to test for cheriot here?
798- if (ctx.arg .isCheriAbi && ctx.arg .emachine == EM_RISCV &&
799- ctx.arg .capabilitySize == 8 ) {
800- StringRef SymName = sym.getName ();
801- for (auto GlobalSymbol : ctx.symtab ->getSymbols ()) {
802- if (!GlobalSymbol->isGlobal ())
803- continue ;
804- if (!GlobalSymbol->isDefined ())
805- continue ;
806-
807- StringRef GlobalName = GlobalSymbol->getName ();
808- if (!GlobalName.consume_front (" __export_" ))
809- continue ;
810- size_t functionNameStart = GlobalName.find (" __Z" );
811- if (functionNameStart == StringRef::npos)
812- continue ;
813-
814- StringRef GlobalCompartmentName =
815- GlobalName.take_front (functionNameStart);
816- StringRef GlobalFunctionName = GlobalName.substr (functionNameStart + 1 );
817- if (GlobalFunctionName == SymName) {
818- msg << " \n >>> did you mean the \" " << toStr (ctx, sym)
819- << " \" export from compartment \" " << GlobalCompartmentName
820- << " \" ?\n "
821- << " >>> defined in: " << toStr (ctx, GlobalSymbol->file ) << " \n "
822- << " >>> the declaration may be missing a compartment annotation" ;
823- break ;
824- }
825- }
826- }
827-
828793 if (sym.getName ().starts_with (" _ZTV" ))
829794 msg << " \n >>> the vtable symbol may be undefined because the class is "
830795 " missing its key function "
0 commit comments