From d5658b08966f523aac8f8f2a44bd9b6c2e941a92 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Mon, 23 Nov 2015 21:47:51 +0000 Subject: [RuntimeDyld] Don't allocate unnecessary stub buffer space Summary: For relocation types that are known to not require stub functions, there is no need to allocate extra space for the stub functions. Reviewers: lhames, reames, maksfb Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14676 llvm-svn: 253920 --- .../RuntimeDyld/X86/ELF_x86_64_StubBuf.s | 26 ++++++++++++++++++++++ .../RuntimeDyld/X86/Inputs/ELF_x86_64_StubBuf.ll | 12 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 llvm/test/ExecutionEngine/RuntimeDyld/X86/ELF_x86_64_StubBuf.s create mode 100644 llvm/test/ExecutionEngine/RuntimeDyld/X86/Inputs/ELF_x86_64_StubBuf.ll (limited to 'llvm/test') diff --git a/llvm/test/ExecutionEngine/RuntimeDyld/X86/ELF_x86_64_StubBuf.s b/llvm/test/ExecutionEngine/RuntimeDyld/X86/ELF_x86_64_StubBuf.s new file mode 100644 index 00000000000..8bcba2c4bac --- /dev/null +++ b/llvm/test/ExecutionEngine/RuntimeDyld/X86/ELF_x86_64_StubBuf.s @@ -0,0 +1,26 @@ +# RUN: llvm-mc -triple=x86_64-apple-macosx10.10.0 -filetype=obj -o %T/test_ELF_x86_64_StubBuf.o %s +# RUN: llvm-rtdyld -print-alloc-requests -triple=x86_64-pc-linux -dummy-extern _g=196608 -verify %T/test_ELF_x86_64_StubBuf.o + +# Compiled from Inputs/ELF/ELF_x86_64_StubBuf.ll + +# CHECK: allocateCodeSection(Size = 42, Alignment = 16, SectionName = __text) + + .section __TEXT,__text,regular,pure_instructions + .macosx_version_min 10, 10 + .globl _f + .align 4, 0x90 +_f: ## @f + .cfi_startproc +## BB#0: ## %entry + pushq %rax +Ltmp0: + .cfi_def_cfa_offset 16 + callq _g + callq _g + callq _g + popq %rax + retq + .cfi_endproc + + +.subsections_via_symbols diff --git a/llvm/test/ExecutionEngine/RuntimeDyld/X86/Inputs/ELF_x86_64_StubBuf.ll b/llvm/test/ExecutionEngine/RuntimeDyld/X86/Inputs/ELF_x86_64_StubBuf.ll new file mode 100644 index 00000000000..625b487b8af --- /dev/null +++ b/llvm/test/ExecutionEngine/RuntimeDyld/X86/Inputs/ELF_x86_64_StubBuf.ll @@ -0,0 +1,12 @@ +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.10.0" + +declare void @g() + +define void @f() { + entry: + call void @g() + call void @g() + call void @g() + ret void +} -- cgit v1.2.3