Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
DTPMOD mod fix for musl's rcrt0
Browse files Browse the repository at this point in the history
  • Loading branch information
aep committed Dec 14, 2017
1 parent f6ee339 commit c63fa54
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions package/musl/0002-fix-rcrt1.o.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/ldso/dlstart.c b/ldso/dlstart.c
index 4dbe178..0dd1d5a 100644
--- a/ldso/dlstart.c
+++ b/ldso/dlstart.c
@@ -128,16 +128,18 @@ void _dlstart_c(size_t *sp, size_t *dynv)
rel = (void *)(base+dyn[DT_REL]);
rel_size = dyn[DT_RELSZ];
for (; rel_size; rel+=2, rel_size-=2*sizeof(size_t)) {
- if (!IS_RELATIVE(rel[1], 0)) continue;
size_t *rel_addr = (void *)(base + rel[0]);
+ if (rel[1] == REL_DTPMOD) *rel_addr = 1;
+ if (!IS_RELATIVE(rel[1], 0)) continue;
*rel_addr += base;
}

rel = (void *)(base+dyn[DT_RELA]);
rel_size = dyn[DT_RELASZ];
for (; rel_size; rel+=3, rel_size-=3*sizeof(size_t)) {
- if (!IS_RELATIVE(rel[1], 0)) continue;
size_t *rel_addr = (void *)(base + rel[0]);
+ if (rel[1] == REL_DTPMOD) *rel_addr = 1;
+ if (!IS_RELATIVE(rel[1], 0)) continue;
*rel_addr = base + rel[2];
}
#endif

0 comments on commit c63fa54

Please sign in to comment.