[Openmp-commits] [openmp] [OpenMP][FIX] Ensure we do not read outside the device image (PR #74669)
Joseph Huber via Openmp-commits
openmp-commits at lists.llvm.org
Wed Dec 6 14:53:49 PST 2023
================
@@ -53,9 +57,15 @@ Error GenericGlobalHandlerTy::getGlobalMetadataFromELF(
const ELF64LE::Shdr &Section, GlobalTy &ImageGlobal) {
// The global's address is computed as the image begin + the ELF section
- // offset + the ELF symbol value.
- ImageGlobal.setPtr(advanceVoidPtr(
- Image.getStart(), Section.sh_offset - Section.sh_addr + Symbol.st_value));
+ // offset + the ELF symbol value except for NOBITS sections that, as the name
+ // suggests, have no bits in the image. We still record the size and use
+ // nullptr to indicate there is no location.
+ if (Section.sh_type == ELF::SHT_NOBITS)
----------------
jhuber6 wrote:
Sure, it makes more sense to avoid propagating ELF specific stuff from the generic interface.
https://github.com/llvm/llvm-project/pull/74669
More information about the Openmp-commits
mailing list