X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fldso%2Fdynlink.c;h=28b86bf761c81d3451494b164d07c87c3c2bcbf9;hb=fd7015d0c23edb9ae655e5ce3677f980f0cb1143;hp=df54230c8cf2517ce9941f14b711f51297b3fcae;hpb=e12fe65c928f038fb8db0caddcf535ab0a980c58;p=musl diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index df54230c..28b86bf7 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -563,10 +563,13 @@ void *__dynlink(int argc, char **argv) ehdr->e_phentsize, ehdr->e_phnum); /* Load preload/needed libraries, add their symbols to the global - * namespace, and perform all remaining relocations. */ + * namespace, and perform all remaining relocations. The main + * program must be relocated LAST since it may contain copy + * relocations which depend on libraries' relocations. */ if (env_preload) load_preload(env_preload); load_deps(app); make_global(app); + reloc_all(app->next); reloc_all(app); /* Switch to runtime mode: any further failures in the dynamic