From 9b3af5e7b70239516cbe56f82fb195f8a55d3a2e Mon Sep 17 00:00:00 2001 From: Augusto Noronha Date: Fri, 25 Feb 2022 15:20:02 -0300 Subject: [dsymutil] Apply relocations present in Swift reflection sections The strippable Swift reflection sections contain subtractor relocations that need to be applied. There are two situations we need to support. 1) Both symbols used in the relocation come from the .o file (for example, one symbol lives in __swift5_fieldmd and the second in __swift5_reflstr). 2) One symbol comes from th .o file and the second from the main binary (for example, __swift5_fieldmd and __swift5_typeref). Differential Revision: https://reviews.llvm.org/D120574 --- llvm/lib/Object/ObjectFile.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Object/ObjectFile.cpp') diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp index 2e3c2ed..fed6726 100644 --- a/llvm/lib/Object/ObjectFile.cpp +++ b/llvm/lib/Object/ObjectFile.cpp @@ -198,3 +198,12 @@ ObjectFile::createObjectFile(StringRef ObjectPath) { return OwningBinary(std::move(Obj), std::move(Buffer)); } + +bool ObjectFile::isReflectionSectionStrippable( + llvm::binaryformat::Swift5ReflectionSectionKind ReflectionSectionKind) + const { + using llvm::binaryformat::Swift5ReflectionSectionKind; + return ReflectionSectionKind == Swift5ReflectionSectionKind::fieldmd || + ReflectionSectionKind == Swift5ReflectionSectionKind::reflstr || + ReflectionSectionKind == Swift5ReflectionSectionKind::assocty; +} -- cgit v1.1