Index: lld/ELF/SyntheticSections.h =================================================================== --- lld/ELF/SyntheticSections.h +++ lld/ELF/SyntheticSections.h @@ -536,6 +536,7 @@ class RelrBaseSection : public SyntheticSection { public: RelrBaseSection(); + bool empty() const override { return Relocs.empty(); } std::vector Relocs; }; Index: lld/test/ELF/empty-pack-dyn-relocs.s =================================================================== --- /dev/null +++ lld/test/ELF/empty-pack-dyn-relocs.s @@ -0,0 +1,11 @@ +// REQUIRES: aarch64 + +// RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %t.o +// RUN: ld.lld -pie --pack-dyn-relocs=relr %t.o -o %t +// RUN: llvm-readobj -sections %t | FileCheck %s + +.global _start +_start: + nop + +# CHECK-NOT: Name: .relr.dyn