Skip to content

Commit

Permalink
Merge branch 'cross_prelink_staging' into master_staging
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Hatle <[email protected]>
  • Loading branch information
Mark Hatle committed Mar 22, 2016
2 parents 335a6e5 + 5cb7a3e commit e7d3832
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
6 changes: 5 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
2016-22-28 Mark Hatle <[email protected]>
2016-03-22 Mark Hatle <[email protected]>
* src/gather.c, src/get.c: Fix LD_PRELOAD
* Merge with cross_prelink

2016-03-22 Mark Hatle <[email protected]>
* Merge with cross_prelink

2016-03-18 Donn Seeley <[email protected]>
Expand Down
20 changes: 15 additions & 5 deletions src/gather.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
int i, j, seen = 0;
FILE *f = NULL;
const char *argv[5];
const char *envp[4];
const char *envp[5];
char *line = NULL, *p, *q = NULL;
const char **depends = NULL, **depends_temp;
size_t ndepends = 0, ndepends_alloced = 0;
Expand Down Expand Up @@ -162,10 +162,20 @@ gather_deps (DSO *dso, struct prelink_entry *ent)

argv[i++] = ent_filename;
argv[i] = NULL;
envp[0] = "LD_TRACE_LOADED_OBJECTS=1";
envp[1] = "LD_TRACE_PRELINKING=1";
envp[2] = "LD_WARN=";
envp[3] = NULL;

j = 0;
if(etype == ET_EXEC && ld_preload)
{
p = alloca (sizeof "LD_PRELOAD=" + strlen (ld_preload) + 1);
strcpy (stpcpy (p, "LD_PRELOAD="), ld_preload);
envp[j++] = p;
}

envp[j++] = "LD_TRACE_LOADED_OBJECTS=1";
envp[j++] = "LD_TRACE_PRELINKING=1";
envp[j++] = "LD_WARN=";
envp[j] = NULL;

f = execve_open (dl, (char * const *)argv, (char * const *)envp);
if (f == NULL)
goto error_out;
Expand Down
20 changes: 14 additions & 6 deletions src/get.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ prelink_get_relocations (struct prelink_info *info)
FILE *f;
DSO *dso = info->dso;
const char *argv[5];
const char *envp[4];
int i, ret, status;
const char *envp[5];
int i, j, ret, status;
char *p;
const char *dl = dynamic_linker ?: dso->arch->dynamic_linker;
const char *ent_filename;
Expand Down Expand Up @@ -691,12 +691,20 @@ prelink_get_relocations (struct prelink_info *info)
}
argv[i++] = ent_filename;
argv[i] = NULL;
envp[0] = "LD_TRACE_LOADED_OBJECTS=1";
envp[1] = "LD_BIND_NOW=1";

j = 0;
if(etype == ET_EXEC && ld_preload)
{
p = alloca (sizeof "LD_PRELOAD=" + strlen (ld_preload));
strcpy (stpcpy (p, "LD_PRELOAD="), ld_preload);
envp[j++] = p;
}
envp[j++] = "LD_TRACE_LOADED_OBJECTS=1";
envp[j++] = "LD_BIND_NOW=1";
p = alloca (sizeof "LD_TRACE_PRELINKING=" + strlen (info->ent->filename));
strcpy (stpcpy (p, "LD_TRACE_PRELINKING="), info->ent->filename);
envp[2] = p;
envp[3] = NULL;
envp[j++] = p;
envp[j] = NULL;

ret = 2;
f = execve_open (dl, (char * const *)argv, (char * const *)envp);
Expand Down

0 comments on commit e7d3832

Please sign in to comment.