Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1360535304.23424.465.camel@eris.loria.fr>
Date: Sun, 10 Feb 2013 23:33:09 +0100
From: Jens Gustedt <Jens.Gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: [PATCH 3/3] use the real symbol name for environ in execvp

When switching optimization to higher levels (-O3) and enable link time
optimization (-flto) my linker explodes because "__environ" is accessed
through an alias named "environ", and that text segment has already been
removed:

`environ' referenced in section `.text.execvp' of /tmp/cckGfCaK.ltrans1.ltrans.o: defined in discarded section `.text' of src/env/__environ.lo (symbol from plugin)
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.22 assertion fail ../../bfd/elf64-x86-64.c:4365

Use the "real" name of __environ directly, we control all symbol names,
anyhow.

2	2	src/process/execvp.c

diff --git a/src/process/execvp.c b/src/process/execvp.c
index 682680d..0a33e42 100644
--- a/src/process/execvp.c
+++ b/src/process/execvp.c
@@ -4,7 +4,7 @@
 #include <errno.h>
 #include <limits.h>
 
-extern char **environ;
+extern char **__environ;
 
 int __execvpe(const char *file, char *const argv[], char *const envp[])
 {
@@ -45,5 +45,5 @@ int __execvpe(const char *file, char *const argv[], char *const envp[])
 
 int execvp(const char *file, char *const argv[])
 {
-	return __execvpe(file, argv, environ);
+	return __execvpe(file, argv, __environ);
 }
-- 
1.7.9.5

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.