-
Notifications
You must be signed in to change notification settings - Fork 8
Add workaround for musl
lack of SONAME support
#34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
staticfloat
wants to merge
7
commits into
master
Choose a base branch
from
sf/musl_workaround
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8ddec8b
Add workaround for `musl` lack of SONAME support
staticfloat 721c07f
Import `Libdl`
staticfloat 614c5ca
Update src/runtime_musl_workaround.jl
staticfloat 407bf99
debugging
staticfloat a6fe9fa
Add SONAME parsing
staticfloat fce4f2f
Add support for all versions of musl used by Alpine v3.1-v3.13
staticfloat 1090fc1
cache musl version
staticfloat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#= | ||
struct dso { | ||
#if DL_FDPIC | ||
struct fdpic_loadmap *loadmap; | ||
#else | ||
unsigned char *base; | ||
#endif | ||
char *name; | ||
size_t *dynv; | ||
struct dso *next, *prev; | ||
|
||
Phdr *phdr; | ||
int phnum; | ||
size_t phentsize; | ||
int refcnt; | ||
Sym *syms; | ||
uint32_t *hashtab; | ||
uint32_t *ghashtab; | ||
int16_t *versym; | ||
char *strings; | ||
unsigned char *map; | ||
size_t map_len; | ||
dev_t dev; | ||
ino_t ino; | ||
signed char global; | ||
char relocated; | ||
char constructed; | ||
char kernel_mapped; | ||
struct dso **deps, *needed_by; | ||
char *rpath_orig, *rpath; | ||
void *tls_image; | ||
size_t tls_len, tls_size, tls_align, tls_id, tls_offset; | ||
size_t relro_start, relro_end; | ||
void **new_dtv; | ||
unsigned char *new_tls; | ||
volatile int new_dtv_idx, new_tls_idx; | ||
struct td_index *td_index; | ||
struct dso *fini_next; | ||
char *shortname; | ||
#if DL_FDPIC | ||
unsigned char *base; | ||
#else | ||
struct fdpic_loadmap *loadmap; | ||
#endif | ||
struct funcdesc { | ||
void *addr; | ||
size_t *got; | ||
} *funcdescs; | ||
size_t *got; | ||
char buf[]; | ||
}; | ||
=# | ||
|
||
struct musl_dso_v1_1_12 <: musl_dso | ||
# Things we find mildly interesting | ||
base::Ptr{Cvoid} | ||
name::Ptr{UInt8} | ||
|
||
# The wasteland of things we don't care about | ||
dynv::Ptr{Csize_t} | ||
next::Ptr{musl_dso} | ||
prev::Ptr{musl_dso} | ||
|
||
phdr::Ptr{Elf_Phdr} | ||
phnum::Cint | ||
phentsize::Csize_t | ||
refcount::Cint | ||
|
||
syms::Ptr{Cvoid} | ||
hashtab::Ptr{Cvoid} | ||
ghashtab::Ptr{Cvoid} | ||
versym::Ptr{Int16} | ||
strings::Ptr{UInt8} | ||
lazy::Ptr{Csize_t} | ||
lazy_cnt::Csize_t | ||
|
||
map::Ptr{Cuchar} | ||
map_len::Csize_t | ||
|
||
# We assume that dev_t and ino_t are always `uint64_t`, even on 32-bit systems. | ||
dev::UInt64 | ||
ino::UInt64 | ||
dso_global::Cchar | ||
relocated::Cchar | ||
constructed::Cchar | ||
kernel_mapped::Cchar | ||
# NOTE: struct layout rules should insert 5 bytes of space here | ||
deps::Ptr{Ptr{musl_dso}} | ||
needed_by::Ptr{musl_dso} | ||
rpath_orig::Ptr{UInt8} | ||
rpath::Ptr{UInt8} | ||
|
||
tls::Ptr{Cvoid} | ||
tls_len::Csize_t | ||
tls_size::Csize_t | ||
tls_align::Csize_t | ||
tls_id::Csize_t | ||
tls_offset::Csize_t | ||
relro_start::Csize_t | ||
relro_end::Csize_t | ||
new_dtv::Ptr{Ptr{Cuint}} | ||
new_tls::Ptr{UInt8} | ||
new_dtv_idx::Cint | ||
new_tls_idx::Cint | ||
td_index::Ptr{Cvoid} | ||
fini_next::Ptr{musl_dso} | ||
|
||
# Finally! The field we're interested in! | ||
shortname::Ptr{UInt8} | ||
|
||
# We'll put this stuff at the end because it might be interesting to someone somewhere | ||
loadmap::Ptr{Cvoid} | ||
funcdesc::Ptr{Cvoid} | ||
got::Ptr{Csize_t} | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#= | ||
struct dso { | ||
#if DL_FDPIC | ||
struct fdpic_loadmap *loadmap; | ||
#else | ||
unsigned char *base; | ||
#endif | ||
char *name; | ||
size_t *dynv; | ||
struct dso *next, *prev; | ||
|
||
Phdr *phdr; | ||
int phnum; | ||
size_t phentsize; | ||
int refcnt; | ||
Sym *syms; | ||
Elf_Symndx *hashtab; | ||
uint32_t *ghashtab; | ||
int16_t *versym; | ||
char *strings; | ||
unsigned char *map; | ||
size_t map_len; | ||
dev_t dev; | ||
ino_t ino; | ||
signed char global; | ||
char relocated; | ||
char constructed; | ||
char kernel_mapped; | ||
struct dso **deps, *needed_by; | ||
char *rpath_orig, *rpath; | ||
struct tls_module tls; | ||
size_t tls_id; | ||
size_t relro_start, relro_end; | ||
void **new_dtv; | ||
unsigned char *new_tls; | ||
volatile int new_dtv_idx, new_tls_idx; | ||
struct td_index *td_index; | ||
struct dso *fini_next; | ||
char *shortname; | ||
#if DL_FDPIC | ||
unsigned char *base; | ||
#else | ||
struct fdpic_loadmap *loadmap; | ||
#endif | ||
struct funcdesc { | ||
void *addr; | ||
size_t *got; | ||
} *funcdescs; | ||
size_t *got; | ||
char buf[]; | ||
}; | ||
=# | ||
|
||
struct musl_dso_v1_1_13 <: musl_dso | ||
# Things we find mildly interesting | ||
base::Ptr{Cvoid} | ||
name::Ptr{UInt8} | ||
|
||
# The wasteland of things we don't care about | ||
dynv::Ptr{Csize_t} | ||
next::Ptr{musl_dso} | ||
prev::Ptr{musl_dso} | ||
|
||
phdr::Ptr{Elf_Phdr} | ||
phnum::Cint | ||
phentsize::Csize_t | ||
refcount::Cint | ||
|
||
syms::Ptr{Cvoid} | ||
hashtab::Ptr{Cvoid} | ||
ghashtab::Ptr{Cvoid} | ||
versym::Ptr{Int16} | ||
strings::Ptr{UInt8} | ||
lazy::Ptr{Csize_t} | ||
lazy_cnt::Csize_t | ||
|
||
map::Ptr{Cuchar} | ||
map_len::Csize_t | ||
|
||
# We assume that dev_t and ino_t are always `uint64_t`, even on 32-bit systems. | ||
dev::UInt64 | ||
ino::UInt64 | ||
dso_global::Cchar | ||
relocated::Cchar | ||
constructed::Cchar | ||
kernel_mapped::Cchar | ||
# NOTE: struct layout rules should insert 5 bytes of space here | ||
deps::Ptr{Ptr{musl_dso}} | ||
needed_by::Ptr{musl_dso} | ||
rpath_orig::Ptr{UInt8} | ||
rpath::Ptr{UInt8} | ||
|
||
tls::musl_tls_module | ||
tls_id::Csize_t | ||
relro_start::Csize_t | ||
relro_end::Csize_t | ||
new_dtv::Ptr{Ptr{Cuint}} | ||
new_tls::Ptr{UInt8} | ||
new_dtv_idx::Cint | ||
new_tls_idx::Cint | ||
td_index::Ptr{Cvoid} | ||
fini_next::Ptr{musl_dso} | ||
|
||
# Finally! The field we're interested in! | ||
shortname::Ptr{UInt8} | ||
|
||
# We'll put this stuff at the end because it might be interesting to someone somewhere | ||
loadmap::Ptr{Cvoid} | ||
funcdesc::Ptr{Cvoid} | ||
got::Ptr{Csize_t} | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#= | ||
struct dso { | ||
#if DL_FDPIC | ||
struct fdpic_loadmap *loadmap; | ||
#else | ||
unsigned char *base; | ||
#endif | ||
char *name; | ||
size_t *dynv; | ||
struct dso *next, *prev; | ||
|
||
Phdr *phdr; | ||
int phnum; | ||
size_t phentsize; | ||
Sym *syms; | ||
Elf_Symndx *hashtab; | ||
uint32_t *ghashtab; | ||
int16_t *versym; | ||
char *strings; | ||
struct dso *syms_next, *lazy_next; | ||
size_t *lazy, lazy_cnt; | ||
unsigned char *map; | ||
size_t map_len; | ||
dev_t dev; | ||
ino_t ino; | ||
char relocated; | ||
char constructed; | ||
char kernel_mapped; | ||
struct dso **deps, *needed_by; | ||
char *rpath_orig, *rpath; | ||
struct tls_module tls; | ||
size_t tls_id; | ||
size_t relro_start, relro_end; | ||
uintptr_t *new_dtv; | ||
unsigned char *new_tls; | ||
volatile int new_dtv_idx, new_tls_idx; | ||
struct td_index *td_index; | ||
struct dso *fini_next; | ||
char *shortname; | ||
#if DL_FDPIC | ||
unsigned char *base; | ||
#else | ||
struct fdpic_loadmap *loadmap; | ||
#endif | ||
struct funcdesc { | ||
void *addr; | ||
size_t *got; | ||
} *funcdescs; | ||
size_t *got; | ||
char buf[]; | ||
}; | ||
=# | ||
|
||
struct musl_dso_v1_1_17 <: musl_dso | ||
# Things we find mildly interesting | ||
base::Ptr{Cvoid} | ||
name::Ptr{UInt8} | ||
|
||
# The wasteland of things we don't care about | ||
dynv::Ptr{Csize_t} | ||
next::Ptr{musl_dso} | ||
prev::Ptr{musl_dso} | ||
|
||
phdr::Ptr{Elf_Phdr} | ||
phnum::Cint | ||
phentsize::Csize_t | ||
|
||
syms::Ptr{Cvoid} | ||
hashtab::Ptr{Cvoid} | ||
ghashtab::Ptr{Cvoid} | ||
versym::Ptr{Int16} | ||
strings::Ptr{UInt8} | ||
syms_next::Ptr{musl_dso} | ||
lazy_next::Ptr{musl_dso} | ||
lazy::Ptr{Csize_t} | ||
lazy_cnt::Csize_t | ||
|
||
map::Ptr{Cuchar} | ||
map_len::Csize_t | ||
|
||
# We assume that dev_t and ino_t are always `uint64_t`, even on 32-bit systems. | ||
dev::UInt64 | ||
ino::UInt64 | ||
relocated::Cchar | ||
constructed::Cchar | ||
kernel_mapped::Cchar | ||
# NOTE: struct layout rules should insert 5 bytes of space here | ||
deps::Ptr{Ptr{musl_dso}} | ||
needed_by::Ptr{musl_dso} | ||
rpath_orig::Ptr{UInt8} | ||
rpath::Ptr{UInt8} | ||
|
||
tls::musl_tls_module | ||
tls_id::Csize_t | ||
relro_start::Csize_t | ||
relro_end::Csize_t | ||
new_dtv::Ptr{Ptr{Cuint}} | ||
new_tls::Ptr{UInt8} | ||
new_dtv_idx::Cint | ||
new_tls_idx::Cint | ||
td_index::Ptr{Cvoid} | ||
fini_next::Ptr{musl_dso} | ||
|
||
# Finally! The field we're interested in! | ||
shortname::Ptr{UInt8} | ||
|
||
# We'll put this stuff at the end because it might be interesting to someone somewhere | ||
loadmap::Ptr{Cvoid} | ||
funcdesc::Ptr{Cvoid} | ||
got::Ptr{Csize_t} | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.