Source: libc6 Version: 2.17-97 Severity: wishlist Tags: upstream Hi,
I'm using ifunc functions but I would like to read the environment in order to select the runtime function. A small program easily shows that the libc 'environ' variable (nor "_environ" nor "__environ") is not yet initialized (so the 'getenv' function does not work either). Is there a way I did not find to access to the environment of the program at the point where ifunc functions are resolved? Looking at the sources, the environment is read way before by ld.so itself (looking for LD_... envvar). However, the pointer to the initial environment is not exported by ld.so (at least I did not find it). It is given to the libc, but too late (in ./csu/init-first.c if I read the sources correctly). Would it be possible to export the initial environment (ie the __environ variable used by ld.so with another name, not the __environ of the libc)? Or can the call to the ifunc resolver function have a (char**envp) parameter (it would be backward binary compatible but programs requiring this behavior would need to depends on recent version of libc)? Or would it be possible to initialize the libc __environ variable more quickly? I'm willing to prepare and test patches if you tell me which solution I should implement. Regards, Vincent PS: I attach a small program showing the environ is not yet initialized. PPS: I already post my question on stackoverflow without any useful answer http://stackoverflow.com/questions/20353246/reading-the-environment-when-executing-elf-ifunc-dispatch-functions -- System Information: Debian Release: jessie/sid APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 armel mipsel Kernel: Linux 3.12-rc7-amd64 (SMP w/8 CPU cores) Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org