mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 3/3] use the real symbol name for environ in execvp
@ 2013-02-10 22:33 Jens Gustedt
  0 siblings, 0 replies; only message in thread
From: Jens Gustedt @ 2013-02-10 22:33 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-10 22:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-10 22:33 [PATCH 3/3] use the real symbol name for environ in execvp Jens Gustedt

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).