JITTargetAddress Size, bool IsCallable,
bool IsLive) {
assert(SymStorage && "Storage cannot be null");
- assert(Offset < Base.getSize() && "Symbol offset is outside block");
+ assert((Offset + Size) <= Base.getSize() &&
+ "Symbol extends past end of block");
auto *Sym = reinterpret_cast<Symbol *>(SymStorage);
new (Sym) Symbol(Base, Offset, StringRef(), Size, Linkage::Strong,
Scope::Local, IsLive, IsCallable);
JITTargetAddress Size, Linkage L, Scope S,
bool IsLive, bool IsCallable) {
assert(SymStorage && "Storage cannot be null");
- assert(Offset < Base.getSize() && "Symbol offset is outside block");
+ assert((Offset + Size) <= Base.getSize() &&
+ "Symbol extends past end of block");
assert(!Name.empty() && "Name cannot be empty");
auto *Sym = reinterpret_cast<Symbol *>(SymStorage);
new (Sym) Symbol(Base, Offset, Name, Size, L, S, IsLive, IsCallable);
--- /dev/null
+# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t.o %s
+# RUN: llvm-jitlink -noexec -entry hook %t.o
+#
+# Make sure that an empty __text section doesn't cause any problems.
+
+ .section __TEXT,__text,regular,pure_instructions
+ .macosx_version_min 10, 15
+l_empty:
+
+ .section __TEXT,__const
+ .globl hook
+ .p2align 2
+hook:
+ .long 42
+
+.subsections_via_symbols