Mercury Bugs - mercury
View Issue Details
0000444mercuryBugpublic2018-01-11 12:342018-01-12 17:33
Reporterwangp 
Assigned Towangp 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000444: static linking with musl crashes
DescriptionWhen using musl, static linking (i.e. --linkage static) causes the program to crash during initialisation of the GC. It has to do with passing the "-Wl,-defsym -Wl,_DYNAMIC=0" in the linking step. The program will not crash if _DYNAMIC is not defined.
TagsNo tags attached.
Attached Files

Notes
(0000960)
wangp   
2018-01-11 12:50   
Without "-Wl,-defsym -Wl,_DYNAMIC=0", the binary DOES have a symbol _DYNAMIC but with a non-zero address:

bash-4.4$ nm -a hello | grep _DYNAMIC
00000000006dcdf8 d _DYNAMIC

bash-4.4$ ./hello
Hello, world
(0000961)
wangp   
2018-01-12 17:33   
Fixed by commit ee177a481

Issue History
2018-01-11 12:34wangpNew Issue
2018-01-11 12:50wangpNote Added: 0000960
2018-01-12 17:33wangpAssigned To => wangp
2018-01-12 17:33wangpStatusnew => resolved
2018-01-12 17:33wangpResolutionopen => fixed
2018-01-12 17:33wangpNote Added: 0000961