@@ -195,8 +195,8 @@ RelExpr ARM::getRelExpr(RelType type, const Symbol &s,
195195 // not ARMv4 output, we can just ignore it.
196196 return R_NONE;
197197 default :
198- error ( getErrorLoc (ctx, loc) + " unknown relocation (" + Twine (type) +
199- " ) against symbol " + toString (s)) ;
198+ Err (ctx) << getErrorLoc (ctx, loc) << " unknown relocation (" << Twine (type)
199+ << " ) against symbol " << &s ;
200200 return R_NONE;
201201 }
202202}
@@ -556,8 +556,8 @@ void ARM::encodeAluGroup(uint8_t *loc, const Relocation &rel, uint64_t val,
556556 rot = (lz + 8 ) << 7 ;
557557 }
558558 if (check && imm > 0xff )
559- error ( getErrorLoc (ctx, loc) + " unencodeable immediate " + Twine (val). str () +
560- " for relocation " + toString ( rel.type )) ;
559+ Err (ctx) << getErrorLoc (ctx, loc) << " unencodeable immediate "
560+ << Twine (val). str () << " for relocation " << rel.type ;
561561 write32 (ctx, loc,
562562 (read32 (ctx, loc) & 0xff3ff000 ) | opcode | rot | (imm & 0xff ));
563563}
@@ -1216,20 +1216,22 @@ template <class ELFT> void ObjFile<ELFT>::importCmseSymbols() {
12161216 sym->stOther = eSym.st_other ;
12171217
12181218 if (eSym.st_shndx != SHN_ABS) {
1219- error ( " CMSE symbol '" + sym->getName () + " ' in import library ' " +
1220- toString ( this ) + " ' is not absolute" ) ;
1219+ ErrAlways (ctx) << " CMSE symbol '" << sym->getName ()
1220+ << " ' in import library ' " << this << " ' is not absolute" ;
12211221 continue ;
12221222 }
12231223
12241224 if (!(eSym.st_value & 1 ) || (eSym.getType () != STT_FUNC)) {
1225- error (" CMSE symbol '" + sym->getName () + " ' in import library '" +
1226- toString (this ) + " ' is not a Thumb function definition" );
1225+ ErrAlways (ctx) << " CMSE symbol '" << sym->getName ()
1226+ << " ' in import library '" << this
1227+ << " ' is not a Thumb function definition" ;
12271228 continue ;
12281229 }
12291230
12301231 if (ctx.symtab ->cmseImportLib .count (sym->getName ())) {
1231- error (" CMSE symbol '" + sym->getName () +
1232- " ' is multiply defined in import library '" + toString (this ) + " '" );
1232+ ErrAlways (ctx) << " CMSE symbol '" << sym->getName ()
1233+ << " ' is multiply defined in import library '" << this
1234+ << " '" ;
12331235 continue ;
12341236 }
12351237
@@ -1283,7 +1285,8 @@ void elf::processArmCmseSymbols(Ctx &ctx) {
12831285 // If input object build attributes do not support CMSE, error and disable
12841286 // further scanning for <sym>, __acle_se_<sym> pairs.
12851287 if (!ctx.arg .armCMSESupport ) {
1286- error (" CMSE is only supported by ARMv8-M architecture or later" );
1288+ ErrAlways (ctx)
1289+ << " CMSE is only supported by ARMv8-M architecture or later" ;
12871290 ctx.arg .cmseImplib = false ;
12881291 break ;
12891292 }
@@ -1293,16 +1296,17 @@ void elf::processArmCmseSymbols(Ctx &ctx) {
12931296 StringRef name = acleSeSym->getName ().substr (std::strlen (ACLESESYM_PREFIX));
12941297 Symbol *sym = ctx.symtab ->find (name);
12951298 if (!sym) {
1296- error (toString (acleSeSym->file ) + " : cmse special symbol '" +
1297- acleSeSym->getName () +
1298- " ' detected, but no associated entry function definition '" + name +
1299- " ' with external linkage found" );
1299+ ErrAlways (ctx)
1300+ << acleSeSym->file << " : cmse special symbol '"
1301+ << acleSeSym->getName ()
1302+ << " ' detected, but no associated entry function definition '" << name
1303+ << " ' with external linkage found" ;
13001304 continue ;
13011305 }
13021306
13031307 std::string errMsg = checkCmseSymAttributes (acleSeSym, sym);
13041308 if (!errMsg.empty ()) {
1305- error (errMsg) ;
1309+ ErrAlways (ctx) << errMsg ;
13061310 continue ;
13071311 }
13081312
@@ -1432,7 +1436,8 @@ void ArmCmseSGSection::finalizeContents() {
14321436 // Check if the start address of '.gnu.sgstubs' correspond to the
14331437 // linker-synthesized veneer with the lowest address.
14341438 if ((getVA () & ~1 ) != (addr & ~1 )) {
1435- error (" start address of '.gnu.sgstubs' is different from previous link" );
1439+ ErrAlways (ctx)
1440+ << " start address of '.gnu.sgstubs' is different from previous link" ;
14361441 return ;
14371442 }
14381443
@@ -1500,8 +1505,8 @@ template <typename ELFT> void elf::writeARMCmseImportLib(Ctx &ctx) {
15001505 Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
15011506 FileOutputBuffer::create (ctx.arg .cmseOutputLib , fileSize, flags);
15021507 if (!bufferOrErr) {
1503- error ( " failed to open " + ctx.arg .cmseOutputLib + " : " +
1504- llvm::toString (bufferOrErr.takeError () ));
1508+ ErrAlways (ctx) << " failed to open " << ctx.arg .cmseOutputLib << " : "
1509+ << llvm::toString (bufferOrErr.takeError ());
15051510 return ;
15061511 }
15071512
0 commit comments