X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com Message-ID: <554F1325.2040805@iki.fi> Date: Sun, 10 May 2015 11:13:25 +0300 From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi)" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "DJGPP List (E-mail)" Subject: DXE related problem in DJGPP v2.05 beta Content-Type: multipart/mixed; boundary="------------060503090000050907080100" Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. --------------060503090000050907080100 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit I had to update gettext and libiconv to try to build current early development snapshot of GCC-6.0.0. Build failed due to GCC build process defining explicitly LD_LIBRARY_PATH. Having only one environment variable is not sufficient in this case. For example in Linux system wide shared library lookup directories are managed by ldconfig anbd ldconfig.conf. Directories specified in LD_LIBRARY_PATH are searched before system ones. We need something similar for DJGPP Attached patch add additional DXE search path that cannot be overridden by user from environment directly. Unfortunately that causes compatibility problem with already existing packages which use DXE. I had as result no other choice rather than defining LD_LIBRARY_PATH to the same value in earlier way. Some small optimization was added to dlopen() to avoid doing unnecessary lookup twice (not very foolproof, but harm from looking up twice is not very noticeable) I will commit it unless there are objections Change will require rebuilding packages which uses DXE to fully use this change. There should be no regressions without rebuilding, but without it freely overriding LD_LIBRARY_PATH will cause DJGPP own DXE loading to fail (as it is now) Andris PS. Noticed also that file name handling in dlopen() assumes non-LFN filename without directory part (length 12). That also should be fixed. I did not want to mix more than one thing into change at the same time, so I left this thing for now. --------------060503090000050907080100 Content-Type: text/x-patch; name="dlload_update.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dlload_update.patch" Index: djgpp.env =================================================================== RCS file: /cvs/djgpp/djgpp/djgpp.env,v retrieving revision 1.16 diff -p -r1.16 djgpp.env *** djgpp.env 29 Mar 2007 22:49:19 -0000 1.16 --- djgpp.env 10 May 2015 07:50:49 -0000 *************** DJDIR=%:/>DJGPP% *** 12,17 **** --- 12,18 ---- +TEXMFMAIN=%DJDIR%/share/texmf +GO32STUB=%DJDIR%/bin/stubify.exe +LD_LIBRARY_PATH=%DJDIR%/lib;%DJDIR%/bin + SYSTEM_DXE_PATH=%DJDIR%/lib;%DJDIR%/bin [bison] +BISON_HAIRY=%DJDIR%/lib/bison.hai Index: src/docs/kb/wc205.txi =================================================================== RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc205.txi,v retrieving revision 1.1 diff -p -r1.1 wc205.txi *** src/docs/kb/wc205.txi 3 May 2015 10:14:57 -0000 1.1 --- src/docs/kb/wc205.txi 10 May 2015 07:50:49 -0000 *************** *** 1,12 **** --- 1,31 ---- @node Changes in 2.05, , Changes in 2.04, What Changed + @section Changes in 2.05 Here is a list of changes from DJGPP V2.04 to DJGPP V2.05 DJGPP v2.04 was actually never released and stayed in beta stage much too long. + @subsection Replacement of memory managment with nmalloc + One of basic problems of DJGPP v2.04 was slow memory management especially @code{free}. In DJGPP V2.05 memory management was replaced by completely different implementation @strong{nmalloc} written by Charles B. Falconer (1931-2012). nmalloc was used already for a rather long time for various DJGPP packages including DJGPP port of GCC + + @subsection Update of DXE lookup + + Updated handling of DXE search path for relative file names + @itemize @bullet + @item At first directories from @env{LD_LIBRARY_PATH} are tried. The predefined + value of @env{LD_LIBRARY_PATH} is currently kept for compatibility with. + User can use this environment variable to specify DXE search directories + additionally to DJGPP own ones + @item After that directories from @env{SYSTEM_DXE_PATH} are tried. The value + of @env{SYSTEM_DXE_PATH} is predefined and contains directories where DJGPP own + DXE files can be found. + @end itemize + Both environment variables contain @strong{;} separated lists of directories. + Earlier only @env{LD_LIBRARY_PATH} was used. The result was DXE lookup failure + when @env{LD_LIBRARY_PATH} was redefined by user. Index: src/libc/dxe/dlopen.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.c,v retrieving revision 1.3 diff -p -r1.3 dlopen.c *** src/libc/dxe/dlopen.c 15 Jan 2005 19:18:49 -0000 1.3 --- src/libc/dxe/dlopen.c 10 May 2015 07:50:50 -0000 *************** void *dlopen (const char *filename, int *** 122,150 **** /* Find the dynamic module along the LD_LIBRARY_PATH */ if (!ACCESS(filename)) { char *nextscan; size_t fnl = strlen (filename) + 1; /* LD_LIBRARY_PATH is scanned only for relative paths */ if ((filename[0] != '/') && (filename[0] != '\\') && (filename[1] != ':')) { ! for (scan = getenv ("LD_LIBRARY_PATH"); scan && *scan; ! scan = nextscan + strspn (nextscan, "; \t")) ! { ! char *name; ! nextscan = strchr (scan, ';'); ! if (!nextscan) nextscan = strchr (scan, 0); ! if (nextscan - scan > FILENAME_MAX - 12) ! continue; ! memcpy (tempfn, scan, nextscan - scan); ! name = tempfn + (nextscan - scan); ! if (name [-1] != '/' && name [-1] != '\\') ! *name++ = '/'; ! memcpy (name, filename, fnl); ! if (ACCESS(tempfn)) ! { ! filename = tempfn; ! goto found; ! } ! } } errno = ENOENT; return NULL; --- 122,155 ---- /* Find the dynamic module along the LD_LIBRARY_PATH */ if (!ACCESS(filename)) { + const char *env_names[] = {"LD_LIBRARY_PATH", "SYSTEM_DXE_PATH"}; + const int num_env_names = sizeof(env_names) / sizeof(*env_names); char *nextscan; size_t fnl = strlen (filename) + 1; /* LD_LIBRARY_PATH is scanned only for relative paths */ if ((filename[0] != '/') && (filename[0] != '\\') && (filename[1] != ':')) { ! for (i = 0; i < num_env_names; i++) ! { ! for (scan = getenv (env_names[i]); scan && *scan; ! scan = nextscan + strspn (nextscan, "; \t")) ! { ! char *name; ! nextscan = strchr (scan, ';'); ! if (!nextscan) nextscan = strchr (scan, 0); ! if (nextscan - scan > FILENAME_MAX - 12) ! continue; ! memcpy (tempfn, scan, nextscan - scan); ! name = tempfn + (nextscan - scan); ! if (name [-1] != '/' && name [-1] != '\\') ! *name++ = '/'; ! memcpy (name, filename, fnl); ! if (ACCESS(tempfn)) ! { ! filename = tempfn; ! goto found; ! } ! } ! } } errno = ENOENT; return NULL; Index: src/libc/dxe/dlopen.txh =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.txh,v retrieving revision 1.1 diff -p -r1.1 dlopen.txh *** src/libc/dxe/dlopen.txh 23 Apr 2003 06:10:56 -0000 1.1 --- src/libc/dxe/dlopen.txh 10 May 2015 07:50:50 -0000 *************** and @code{dlclose} (@pxref{dlclose}) fun *** 18,26 **** @vindex LD_LIBRARY_PATH If @var{filename} contains a path it is used, else it searches the path ! specified by the environment variable @env{LD_LIBRARY_PATH}. The typical ! extension used is @file{.DXE}, and these dynamic loadable images are created ! using @command{dxe3gen} (@pxref{dxe3gen, , dxe3gen, utils}). The @var{mode} field is a combination of @code{RTLD_xxx} flags, of which only @code{RTLD_GLOBAL} works (others are defined in @file{dlfcn.h} for --- 18,29 ---- @vindex LD_LIBRARY_PATH If @var{filename} contains a path it is used, else it searches the path ! specified by the environment variable @env{LD_LIBRARY_PATH} and ! @env{SYSTEM_DXE_PATH}. DJGPP own search paths are specified in ! @env{SYSTEM_DXE_PATH}. User may add additional search path by defining ! then in @env{LD_LIBRARY_PATH}. The typical extension used is @file{.DXE}, ! and these dynamic loadable images are created using ! @command{dxe3gen} (@pxref{dxe3gen, , dxe3gen, utils}). The @var{mode} field is a combination of @code{RTLD_xxx} flags, of which only @code{RTLD_GLOBAL} works (others are defined in @file{dlfcn.h} for --------------060503090000050907080100--