File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -242,13 +242,17 @@ static bool is_known_section_type(const ElfShdr<E> &shdr) {
242
242
//
243
243
// This function converts a CREL relocation table to a regular one.
244
244
template <typename E>
245
- std::vector<ElfRel<E>> decode_crel (Context<E> &ctx, std::string_view contents) {
246
- u8 *p = (u8 *)contents.data ();
245
+ std::vector<ElfRel<E>> decode_crel (Context<E> &ctx, ObjectFile<E> &file,
246
+ const ElfShdr<E> &shdr) {
247
+ u8 *p = (u8 *)file.get_string (ctx, shdr).data ();
247
248
u64 hdr = read_uleb (&p);
248
249
i64 nrels = hdr >> 3 ;
249
250
bool is_rela = hdr & 0b100 ;
250
251
i64 scale = hdr & 0b11 ;
251
252
253
+ if (is_rela && !E::is_rela)
254
+ Fatal (ctx) << file << " : CREL with addends is not supported for " << E::name;
255
+
252
256
u64 offset = 0 ;
253
257
i64 type = 0 ;
254
258
i64 symidx = 0 ;
@@ -350,7 +354,7 @@ void ObjectFile<E>::initialize_sections(Context<E> &ctx) {
350
354
}
351
355
case SHT_CREL:
352
356
decoded_crel.resize (i + 1 );
353
- decoded_crel[i] = decode_crel (ctx, this -> get_string (ctx , shdr) );
357
+ decoded_crel[i] = decode_crel (ctx, * this , shdr);
354
358
break ;
355
359
case SHT_REL:
356
360
case SHT_RELA:
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
. $( dirname $0 ) /common.inc
3
3
4
+ # Currently, CREL is not supported on REL-type targets
5
+ [ $MACHINE = arm ] && skip
6
+ [ $MACHINE = i686 ] && skip
7
+
4
8
[ " $CC " = cc ] || skip
5
9
clang -c -xc -o /dev/null /dev/null -Wa,--crel,--allow-experimental-crel || skip
6
10
You can’t perform that action at this time.
0 commit comments