diff options
Diffstat (limited to 'lld/ELF/Writer.cpp')
| -rw-r--r-- | lld/ELF/Writer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 5bee84a5cf81..4c0b4df5bea1 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -632,6 +632,7 @@ static bool isRelroSection(const OutputSection *sec) { enum RankFlags { RF_NOT_ADDR_SET = 1 << 27, RF_NOT_ALLOC = 1 << 26, + RF_HIP_FATBIN = 1 << 19, RF_PARTITION = 1 << 18, // Partition number (8 bits) RF_LARGE_ALT = 1 << 15, RF_WRITE = 1 << 14, @@ -729,6 +730,15 @@ unsigned elf::getSectionRank(OutputSection &osec) { if (osec.type == SHT_NOBITS) rank |= RF_BSS; + // Put HIP fatbin related sections further away to avoid wasting relocation + // range to jump over them. Make sure .hip_fatbin is the furthest. + if (osec.name == ".hipFatBinSegment") + rank |= RF_HIP_FATBIN; + if (osec.name == ".hip_gpubin_handle") + rank |= RF_HIP_FATBIN | 2; + if (osec.name == ".hip_fatbin") + rank |= RF_HIP_FATBIN | RF_WRITE | 3; + // Some architectures have additional ordering restrictions for sections // within the same PT_LOAD. if (config->emachine == EM_PPC64) { |
