[PATCH] D89795: [jitlink][ELF] Add zero-fill blocks for symbols in section SHN_COMMON

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 23:32:41 PDT 2020


lhames accepted this revision.
lhames added a comment.
This revision is now accepted and ready to land.

This looks good to me.

Suggested test case below (this would go in `llvm/test/ExecutionEngine/JITLink/X86/`). I didn't get a chance to see whether your patch fixes it yet -- I'll try that tomorrow.

  # RUN: rm -rf %t && mkdir -p %t
  # RUN: llvm-mc -triple=x86_64-unknown-linux -position-independent -filetype=obj -o %t/elf_common.o %s
  # RUN: llvm-jitlink -entry=load_common -noexec -check %s %t/elf_common.o
  
          .text
          .file   "ELF_common.c"
          .globl  load_common
          .p2align        4, 0x90
          .type   load_common, at function
  load_common:
  # Check that common variable GOT entry is synthesized correctly.
  # jitlink-check: decode_operand(load_common, 4) = \
  # jitlink-check:   got_addr(elf_common.o, common_data) - next_pc(load_common)
  # jitlink-check: *{8}(got_addr(elf_common.o, common_data)) = common_data
          movq    x at GOTPCREL(%rip), %rax
  .Lfunc_end0:
          .size   load_common, .Lfunc_end0-load_common
  
  # Check that common is zero-filled.
  # jitlink-check: *{4}(common_data) = 0
          .type   common_data, at object
          .comm   common_data,4,4


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89795/new/

https://reviews.llvm.org/D89795



More information about the llvm-commits mailing list