GHCi cannot load .o built from c with -fPIC on i386 linux
GHCi cannot load .o built from c with -fPIC on i386 linux. On i386 linux, the PIC object code looks like:
000001ac <hs_remWord64>:
1ac: 53 push %ebx
1ad: 83 ec 08 sub $0x8,%esp
1b0: e8 fc ff ff ff call 1b1 <hs_remWord64+0x5>
1b1: R_386_PC32 __x86.get_pc_thunk.bx
1b5: 81 c3 02 00 00 00 add $0x2,%ebx
1b7: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
1bb: ff 74 24 1c pushl 0x1c(%esp)
1bf: ff 74 24 1c pushl 0x1c(%esp)
1c3: ff 74 24 1c pushl 0x1c(%esp)
1c7: ff 74 24 1c pushl 0x1c(%esp)
1cb: e8 fc ff ff ff call 1cc <hs_remWord64+0x20>
1cc: R_386_PLT32 __umoddi3
1d0: 83 c4 18 add $0x18,%esp
1d3: 5b pop %ebx
1d4: c3 ret
- the GOT symbol
_GLOBAL_OFFSET_TABLE_
may be undefined - the runtime linker doesn't support PIC-related i386 relocations like
R_386_GOTPC
orR_386_PLT32
As a result, we will see errors like
unknown symbol '_GLOBAL_OFFSET_TABLE_'
or unhandled ELF relocation
.
Trac metadata
Trac field | Value |
---|---|
Version | 8.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System (Linker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |