Allocate bss section within proper range of other sections
AcceptedPublic

Authored by watashi on Oct 31 2018, 9:55 PM.

Details

Reviewers
simonmar
bgamari
angerman
erikd
Trac Issues
#15729
Summary

This re-applies D5195: Add a RTS option -xp to load PIC object anywhere in address space and D5235: Fix T15729 and T3001-2 in master, they were reverted as part of diff
stack to unbreak i386. The proper fix is done in D5289: Add a RTS option -xp to load PIC object anywhere in address space.

Allocate bss section within proper range of other sections:

  • when +RTS -xp is passed, allocate it contiguously as we did for jump islands
  • when we mmap the code to lower 2Gb, we should allocate bss section there too
Test Plan
  1. ./validate

with

DYNAMIC_GHC_PROGRAMS = NO
DYNAMIC_BY_DEFAULT = NO

TEST="T15729" make test passed in both linux (both i386 and x86_64) and macos.

Also test in a use case where we used to encouter error like:

ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) =
b90282ba

and now, everything works fine.