Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUI

julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
ifeq ($(OS),WINNT)
@echo '@"%~dp0\'"$$(echo $(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE)) | tr / '\\')"\" '%*' > $(BUILDROOT)/julia.bat
echo '@"%~dp0/'"$$(echo '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')"'" %*' | tr / '\\' > $(BUILDROOT)/julia.bat
chmod a+x $(BUILDROOT)/julia.bat
else
ifndef JULIA_VAGRANT_BUILD
Expand Down
8 changes: 5 additions & 3 deletions src/cgmemmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ static void unmap_page(void *ptr, size_t size)
enum class Prot : int {
RW = PAGE_READWRITE,
RX = PAGE_EXECUTE,
RO = PAGE_READONLY
RO = PAGE_READONLY,
NO = PAGE_NOACCESS
};

static void protect_page(void *ptr, size_t size, Prot flags)
Expand All @@ -81,7 +82,8 @@ static void protect_page(void *ptr, size_t size, Prot flags)
enum class Prot : int {
RW = PROT_READ | PROT_WRITE,
RX = PROT_READ | PROT_EXEC,
RO = PROT_READ
RO = PROT_READ,
NO = PROT_NONE
};

static void protect_page(void *ptr, size_t size, Prot flags)
Expand Down Expand Up @@ -647,7 +649,7 @@ class DualMapAllocator : public ROAllocator<exec> {
unmap_page((void*)block.wr_ptr, block.total);
}
else {
protect_page((void*)block.wr_ptr, block.total, Prot::RO);
protect_page((void*)block.wr_ptr, block.total, Prot::NO);
block.state = SplitPtrBlock::WRInit;
}
}
Expand Down
26 changes: 14 additions & 12 deletions src/debuginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ static void create_PRUNTIME_FUNCTION(uint8_t *Code, size_t Size, StringRef fnnam
tbl->BeginAddress = (DWORD)(Code - Section);
tbl->EndAddress = (DWORD)(Code - Section + Size);
tbl->UnwindData = (DWORD)(UnwindData - Section);
assert(Code >= Section && Code + Size <= Section + Allocated);
assert(UnwindData >= Section && UnwindData <= Section + Allocated);
#else // defined(_CPU_X86_64_)
Section += (uintptr_t)Code;
mod_size = Size;
Expand Down Expand Up @@ -265,20 +267,13 @@ class JITObjectRegistry
uint8_t *catchjmp = NULL;
for (const object::SymbolRef &sym_iter : Object.symbols()) {
StringRef sName = cantFail(sym_iter.getName());
uint8_t **pAddr = NULL;
if (sName.equals("__UnwindData")) {
pAddr = &UnwindData;
}
else if (sName.equals("__catchjmp")) {
pAddr = &catchjmp;
}
if (pAddr) {
if (sName.equals("__UnwindData") || sName.equals("__catchjmp")) {
uint64_t Addr = cantFail(sym_iter.getAddress());
auto Section = cantFail(sym_iter.getSection());
assert(Section != EndSection && Section->isText());
uint64_t SectionAddr = Section->getAddress();
sName = cantFail(Section->getName());
uint64_t SectionLoadAddr = getLoadAddress(sName);
StringRef secName = cantFail(Section->getName());
uint64_t SectionLoadAddr = getLoadAddress(secName);
assert(SectionLoadAddr);
if (SectionAddrCheck) // assert that all of the Sections are at the same location
assert(SectionAddrCheck == SectionAddr &&
Expand All @@ -288,8 +283,13 @@ class JITObjectRegistry
SectionWriteCheck = SectionLoadAddr;
if (lookupWriteAddress)
SectionWriteCheck = (uintptr_t)lookupWriteAddress((void*)SectionLoadAddr);
Addr += SectionWriteCheck - SectionLoadAddr;
*pAddr = (uint8_t*)Addr;
Addr += SectionWriteCheck - SectionLoadCheck;
if (sName.equals("__UnwindData")) {
UnwindData = (uint8_t*)Addr;
}
else if (sName.equals("__catchjmp")) {
catchjmp = (uint8_t*)Addr;
}
}
}
assert(catchjmp);
Expand All @@ -312,6 +312,7 @@ class JITObjectRegistry
UnwindData[6] = 1; // first instruction
UnwindData[7] = 0x50; // push RBP
*(DWORD*)&UnwindData[8] = (DWORD)(catchjmp - (uint8_t*)SectionWriteCheck); // relative location of catchjmp
UnwindData -= SectionWriteCheck - SectionLoadCheck;
#endif // defined(_OS_X86_64_)
#endif // defined(_OS_WINDOWS_)

Expand Down Expand Up @@ -1099,6 +1100,7 @@ static int jl_getDylibFunctionInfo(jl_frame_t **frames, size_t pointer, int skip
static IMAGEHLP_LINE64 frame_info_line;
DWORD dwDisplacement = 0;
uv_mutex_lock(&jl_in_stackwalk);
jl_refresh_dbg_module_list();
DWORD64 dwAddress = pointer;
frame_info_line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
if (SymGetLineFromAddr64(GetCurrentProcess(), dwAddress, &dwDisplacement, &frame_info_line)) {
Expand Down