Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1678 from ibuclaw/testdataalign
Browse files Browse the repository at this point in the history
Ensure that the writable data segment is aligned.
merged-on-behalf-of: Nathan Sashihara <n8sh@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Oct 10, 2018
2 parents f60615f + 9f7ae4b commit 8074173
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rt/sections_elf_shared.d
Expand Up @@ -676,7 +676,7 @@ version (Shared)
{
if (phdr.p_type == PT_DYNAMIC)
{
auto p = cast(ElfW!"Dyn"*)(info.dlpi_addr + phdr.p_vaddr);
auto p = cast(ElfW!"Dyn"*)(info.dlpi_addr + (phdr.p_vaddr & ~(size_t.sizeof - 1)));
dyns = p[0 .. phdr.p_memsz / ElfW!"Dyn".sizeof];
break;
}
Expand Down Expand Up @@ -745,12 +745,12 @@ void scanSegments(in ref dl_phdr_info info, DSO* pdso) nothrow @nogc
case PT_LOAD:
if (phdr.p_flags & PF_W) // writeable data segment
{
auto beg = cast(void*)(info.dlpi_addr + phdr.p_vaddr);
auto beg = cast(void*)(info.dlpi_addr + (phdr.p_vaddr & ~(size_t.sizeof - 1)));
pdso._gcRanges.insertBack(beg[0 .. phdr.p_memsz]);
}
version (Shared) if (phdr.p_flags & PF_X) // code segment
{
auto beg = cast(void*)(info.dlpi_addr + phdr.p_vaddr);
auto beg = cast(void*)(info.dlpi_addr + (phdr.p_vaddr & ~(size_t.sizeof - 1)));
pdso._codeSegments.insertBack(beg[0 .. phdr.p_memsz]);
}
break;
Expand Down

0 comments on commit 8074173

Please sign in to comment.