UNREG: put SRT into read-only data section
ClosedPublic

Authored by trofi on May 24 2018, 3:26 PM.

Details

Summary

Noticed section mismatch on UNREG build failure:

HC [stage 1] libraries/integer-gmp/dist-install/build/GHC/Integer/Type.o

   error: conflicting types for 'ufu0_srt'
   static StgWord ufu0_srt[]__attribute__((aligned(8)))= {
                  ^~~~~~~~

   note: previous declaration of 'ufu0_srt' was here
   IRO_(ufu0_srt);
        ^~~~~~~~

IRO_ has a 'const' qualifier.

The error is a leftover from commit 838b69032566ce6ab3918d70e8d5e098d0bcee02
"Merge FUN_STATIC closure with its SRT" where part of SRT was moved
into closure itself.

This change puts all SRTs into "relrodata".

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
trofi created this revision.May 24 2018, 3:26 PM

But SRTs are writable - they have a static link field at the end which is modified by the GC. So I'm confused, how can this work? We should probably fix the declaration to remove the const instead.

bgamari requested changes to this revision.May 28 2018, 11:43 AM

Indeed, it seems to me like we should rather remove the const.

So I'm confused, how can this work?

My guess is that the patch was written before the new SRT scheme was merged. If I recall correctly, tiis would have worked fine under the old scheme

This revision now requires changes to proceed.May 28 2018, 11:43 AM
trofi updated this revision to Diff 16557.May 28 2018, 12:09 PM

Updated SRTs to mark writable.

Dropped constness. GHC used to have small SRTs (marked const in C codegen) and large SRTs (marked writable).

For my understanding was small SRT marking as const correct?

I believe alll SRTs could previously be marked as read-only.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 1 2018, 11:22 AM
This revision was automatically updated to reflect the committed changes.