Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kovdan01 committed Jan 31, 2024
1 parent acb1730 commit de73eae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
27 changes: 0 additions & 27 deletions lld/ELF/Relocations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,33 +1493,6 @@ template <class ELFT, class RelTy> void RelocationScanner::scanOne(RelTy *&i) {
}
}

// if (config->emachine == EM_AARCH64 && type == R_AARCH64_AUTH_ABS64) {
// // Assume relocations from relocatable objects are RELA.
// assert(RelTy::IsRela);
// std::lock_guard<std::mutex> lock(relocMutex);
// // For a preemptible symbol, we can't use a relative relocation. For an
// // undefined symbol, we can't compute offset at link-time and use a
// relative
// // relocation. Use a symbolic relocation instead.
// Partition &part = sec->getPartition();
// if (sym.isPreemptible || sym.isUndefined()) {
// part.relaDyn->addSymbolReloc(type, *sec, offset, sym, addend, type);
// } else if (part.relrAuthDyn && sec->addralign >= 2 && offset % 2 == 0 &&
// isInt<32>(sym.getVA(addend))) {
// // Implicit addend is below 32-bits so we can use the compressed
// // relative relocation section. The R_AARCH64_AUTH_RELATIVE
// // has a smaller addend fielf as bits [63:32] encode the
// signing-schema. sec->addReloc({expr, type, offset, addend, &sym});
// part.relrAuthDyn->relocsVec[parallel::getThreadIndex()].push_back(
// {sec, offset});
// } else {
// part.relaDyn->addReloc({R_AARCH64_AUTH_RELATIVE, sec, offset,
// DynamicReloc::AddendOnlyWithTargetVA, sym,
// addend, R_ABS});
// }
// return;
// }

// If the relocation does not emit a GOT or GOTPLT entry but its computation
// uses their addresses, we need GOT or GOTPLT to be created.
//
Expand Down
3 changes: 2 additions & 1 deletion lld/ELF/SyntheticSections.h
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ class RelocationBaseSection : public SyntheticSection {
return SyntheticSection::classof(d) &&
(d->type == llvm::ELF::SHT_RELA || d->type == llvm::ELF::SHT_REL ||
d->type == llvm::ELF::SHT_RELR ||
d->type == llvm::ELF::SHT_AARCH64_AUTH_RELR);
(config->emachine == llvm::ELF::EM_AARCH64 &&
d->type == llvm::ELF::SHT_AARCH64_AUTH_RELR));
}
int32_t dynamicTag, sizeDynamicTag;
SmallVector<DynamicReloc, 0> relocs;
Expand Down
20 changes: 10 additions & 10 deletions lld/test/ELF/aarch64-feature-pauth.s
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
# RUN: not ld.lld tag11.o tag12.o tag2.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR1 %s

# ERR1: error: incompatible values of AArch64 PAuth compatibility info found
# ERR1: {{.*}}: 0x2A000000000000000{{1|2}}00000000000000
# ERR1: {{.*}}: 0x2A000000000000000{{1|2}}00000000000000
# ERR1: tag11.o: 0x2A000000000000000{{1|2}}00000000000000
# ERR1: tag2.o: 0x2A000000000000000{{1|2}}00000000000000

# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-errs.s -o errs.o
# RUN: not ld.lld errs.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR2 %s

# ERR2: error: {{.*}}: invalid type field value 42 (1 expected)
# ERR2-NEXT: error: {{.*}}: invalid name field value XXX (ARM expected)
# ERR2-NEXT: error: {{.*}}: AArch64 PAuth compatibility info is too short (at least 16 bytes expected)
# ERR2: error: errs.o:(.note.AARCH64-PAUTH-ABI-tag): invalid type field value 42 (1 expected)
# ERR2-NEXT: error: errs.o:(.note.AARCH64-PAUTH-ABI-tag): invalid name field value XXX (ARM expected)
# ERR2-NEXT: error: errs.o:(.note.AARCH64-PAUTH-ABI-tag): AArch64 PAuth compatibility info is too short (at least 16 bytes expected)

# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-short.s -o short.o
# RUN: not ld.lld short.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR3 %s

# ERR3: error: {{.*}}: section is too short
# ERR3: error: short.o:(.note.AARCH64-PAUTH-ABI-tag): section is too short

# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu no-info.s -o noinfo1.o
# RUN: cp noinfo1.o noinfo2.o
# RUN: not ld.lld -z pauth-report=error tag11.o noinfo1.o noinfo2.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR4 %s
# RUN: ld.lld -z pauth-report=warning tag11.o noinfo1.o noinfo2.o -o /dev/null 2>&1 | FileCheck --check-prefix WARN %s
# RUN: ld.lld -z pauth-report=none tag11.o noinfo1.o noinfo2.o -o /dev/null 2>&1 | FileCheck --check-prefix NONE %s

# ERR4: error: {{.*}}noinfo1.o has no AArch64 PAuth compatibility info while {{.*}}tag11.o has one; either all or no input files must have it
# ERR4-NEXT: error: {{.*}}noinfo2.o has no AArch64 PAuth compatibility info while {{.*}}tag11.o has one; either all or no input files must have it
# WARN: warning: {{.*}}noinfo1.o has no AArch64 PAuth compatibility info while {{.*}}tag11.o has one; either all or no input files must have it
# WARN-NEXT: warning: {{.*}}noinfo2.o has no AArch64 PAuth compatibility info while {{.*}}tag11.o has one; either all or no input files must have it
# ERR4: error: noinfo1.o has no AArch64 PAuth compatibility info while tag11.o has one; either all or no input files must have it
# ERR4-NEXT: error: noinfo2.o has no AArch64 PAuth compatibility info while tag11.o has one; either all or no input files must have it
# WARN: warning: noinfo1.o has no AArch64 PAuth compatibility info while tag11.o has one; either all or no input files must have it
# WARN-NEXT: warning: noinfo2.o has no AArch64 PAuth compatibility info while tag11.o has one; either all or no input files must have it
# NONE-NOT: {{.*}} has no AArch64 PAuth compatibility info while {{.*}} has one; either all or no input files must have it

#--- abi-tag-short.s
Expand Down

0 comments on commit de73eae

Please sign in to comment.