@@ -71,8 +71,10 @@ InputSectionBase::InputSectionBase(InputFile *file, StringRef name,
71
71
// The ELF spec states that a value of 0 means the section has
72
72
// no alignment constraints.
73
73
uint32_t v = std::max<uint32_t >(addralign, 1 );
74
- if (!isPowerOf2_64 (v))
75
- Fatal (getCtx ()) << this << " : sh_addralign is not a power of 2" ;
74
+ if (!isPowerOf2_64 (v)) {
75
+ Err (getCtx ()) << this << " : sh_addralign is not a power of 2" ;
76
+ v = 1 ;
77
+ }
76
78
this ->addralign = v;
77
79
78
80
// If SHF_COMPRESSED is set, parse the header. The legacy .zdebug format is no
@@ -104,8 +106,10 @@ InputSectionBase::InputSectionBase(ObjFile<ELFT> &file,
104
106
// We reject object files having insanely large alignments even though
105
107
// they are allowed by the spec. I think 4GB is a reasonable limitation.
106
108
// We might want to relax this in the future.
107
- if (hdr.sh_addralign > UINT32_MAX)
108
- Fatal (getCtx ()) << &file << " : section sh_addralign is too large" ;
109
+ if (hdr.sh_addralign > UINT32_MAX) {
110
+ Err (getCtx ()) << &file << " : section sh_addralign is too large" ;
111
+ addralign = 1 ;
112
+ }
109
113
}
110
114
111
115
size_t InputSectionBase::getSize () const {
@@ -123,7 +127,7 @@ static void decompressAux(Ctx &ctx, const InputSectionBase &sec, uint8_t *out,
123
127
if (Error e = hdr->ch_type == ELFCOMPRESS_ZLIB
124
128
? compression::zlib::decompress (compressed, out, size)
125
129
: compression::zstd::decompress (compressed, out, size))
126
- Fatal (ctx) << &sec << " : decompress failed: " << std::move (e);
130
+ Err (ctx) << &sec << " : decompress failed: " << std::move (e);
127
131
}
128
132
129
133
void InputSectionBase::decompress () const {
@@ -649,9 +653,11 @@ static uint64_t getRISCVUndefinedRelativeWeakVA(uint64_t type, uint64_t p) {
649
653
// of the RW segment.
650
654
static uint64_t getARMStaticBase (const Symbol &sym) {
651
655
OutputSection *os = sym.getOutputSection ();
652
- if (!os || !os->ptLoad || !os->ptLoad ->firstSec )
653
- Fatal (os->ctx ) << " SBREL relocation to " << sym.getName ()
654
- << " without static base" ;
656
+ if (!os || !os->ptLoad || !os->ptLoad ->firstSec ) {
657
+ Err (os->ctx ) << " SBREL relocation to " << sym.getName ()
658
+ << " without static base" ;
659
+ return 0 ;
660
+ }
655
661
return os->ptLoad ->firstSec ->addr ;
656
662
}
657
663
@@ -1304,7 +1310,7 @@ template <class ELFT> void InputSection::writeTo(Ctx &ctx, uint8_t *buf) {
1304
1310
if (Error e = hdr->ch_type == ELFCOMPRESS_ZLIB
1305
1311
? compression::zlib::decompress (compressed, buf, size)
1306
1312
: compression::zstd::decompress (compressed, buf, size))
1307
- Fatal (ctx) << this << " : decompress failed: " << std::move (e);
1313
+ Err (ctx) << this << " : decompress failed: " << std::move (e);
1308
1314
uint8_t *bufEnd = buf + size;
1309
1315
relocate<ELFT>(ctx, buf, bufEnd);
1310
1316
return ;
0 commit comments