Question about the layout of StgInfoTable
Summary
I'm wondering why the StgInfoTable is in the .text section. And through debugging, I found out that libHSghc-internal-9.1001.0-inplace-ghc9.10.1.so gets the address of stg_upd_frame_info and subtracts the address by 8 to get StgInfoTable_->type.
However, building the latest ghc code ( 6cf579b9) in LoongArch/x86 using gnu-ld, the build command is “hadrian/build binary-dist-dir ”, stg_upd_frame_info@plt exists in _build/stage1/bin/ghc, and libHSghc-internal-9.1001.0-inplace-ghc9.10.1.so get the address of stg_upd_frame_info@plt in _build/stage1/bin/ghc when it wants to get the address of stg_upd_frame_info in libHSrts-1.0.2_thr-ghc9.6.6.so. So ghc execution reported an error with wrong StgInfoTable_->type(the address is stg_upd_frame_info@plt-8).
In a nutshell, it means that the stg_upd_frame_info of libHSrts-1.0.2_thr-ghc9.6.6.so is preempted by stg_upd_frame_info@plt in _build/stage1/bin/ghc because executable is looked up earlier than shared library. I'm wondering if it makes sense to do something by getting the address of stg_upd_frame_info and subtracting an offset from it.