Skip to content

Commit

Permalink
Fix test flakiness for SH4
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Jul 11, 2024
1 parent e03f74a commit 83ee496
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions elf/passes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1603,13 +1603,21 @@ void copy_chunks(Context<E> &ctx) {
// For --relocatable and --emit-relocs, we want to copy non-relocation
// sections first. This is because REL-type relocation sections (as
// opposed to RELA-type) stores relocation addends to target sections.
//
// We also does that for SH4 because despite being RELA, we always need
// to write addends to relocated places for SH4.
auto is_rel = [](Chunk<E> &chunk) {
return chunk.shdr.sh_type == SHT_REL ||
(is_sh4<E> && chunk.shdr.sh_type == SHT_RELA);
};

tbb::parallel_for_each(ctx.chunks, [&](Chunk<E> *chunk) {
if (chunk->shdr.sh_type != SHT_REL)
if (!is_rel(*chunk))
copy(*chunk);
});

tbb::parallel_for_each(ctx.chunks, [&](Chunk<E> *chunk) {
if (chunk->shdr.sh_type == SHT_REL)
if (is_rel(*chunk))
copy(*chunk);
});

Expand Down

0 comments on commit 83ee496

Please sign in to comment.