This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
For some time now, I've wanted to add configuration support to add additional
directories for the compiler to search automatically, without having to edit
local files in my directory.
I have some questions about these patches, that I will put after the
explanation of the functionality.
One of the motivations is to tie into the installed IBM Advance Toolchain (AT),
which provides newer compilers and libraries to Power customers who need
facilities in the newer compilers, that aren't yet a part of the standard GCC
that is shipped with the distribution. While the AT is a motivation, I'm
trying to write these patches to be more general.
The AT provides its own libraries, both static and shared that are built for
serveral different targets (power5, power6, power7, etc.). It is not a
--sysroot type of release, because if a given library is not provided, it will
default to using the host libraries on the system. The AT has its own dynamic
linker as well as the normal binutils and compiler binaries.
These patches add 4 configuration switches that add additional directories to
the search paths:
--with-extra-exec-prefix=<dirs>
Add extra directories to the executable search path. You can have more
that one directory, separated by colon's (":"). For example, to use
the binaries in /opt/at5.0/bin, I would do:
--with-extra-exec-prefix=/opt/at5.0/bin
--with-extra-startfile-prefix=<dirs>
Add extra directories to the startfile and library search path. You
can have more than one directory, separated by colon's. In multilib
systems, the multilib prefix will be appended to this prefix to find
the correct multilib. For example to use the libraries and startfiles
in /opt/at5.0/lib, I would do:
--with-extra-startfile-prefix=/opt/at5.0/lib
--with-extra-rpath-prefix=<dirs>
Add extra directories via -rpath unless -static is used when linking.
Like the startfile prefix, this is appended with the current multilib
prefix to get the appropriate directory. For example, with the Advance
Toolchain 5.0, I would use:
--with-extra-rpath-prefix=/opt/at5.0/lib
--with-extra-prefixes=<dirs>
This is a combination option, that sets --with-extra-exec-prefixes,
--with-extra-startfile-prefixes, and --with-extra-rpath-prefixes if
they were not already set. For example:
--with-extra-prefix=/opt/at5.0:/opt/at4.0
would be equivalent to:
--with-extra-exec-prefix=/opt/at5.0/bin:/opt/at4.0/bin
--with-extra-startfile-prefix=/opt/at5.0/lib:/opt/at4.0/lib
--with-extra-rpath-prefix=/opt/at5.0/lib:/opt/at4.0/lib
In the machine independent part of the patches, it will use the exec prefixes
to look up executables, it will add -L <dir> for each of the startfile prefixed
directories when linking, and if -static is not used will add -rpath for each
of the directories in the rpath directories.
In the powerpc part of the patches, it will add code to look up the dynamic
linker in the prefixes, and to add -L<dir>/<machine> if the user did
-mcpu=<machine> and -static to pick up the machine specific static libraries.
This code uses spec functions provided by gcc.c, so it is fairly easy to add
similar support to other targets.
My questions are:
1) Do people want this functionality in GCC? If it isn't desirable to put in
the general options, would people have objections if I put in
powerpc64-linux specific configure options to accomplish the same thing?
2) In terms of the shared library paths, I am not up on all of the ins and outs
of the various ways these paths get set (via -rpath=, -rpath-dir=, looking
at LD_RUN_PATH if -rpath is not specified, and with/without the option
--enable-new-dtags). Is the current patch appropriate, or are there better
ways to add directories to the path? The current path adds the directories
via -rpath. If LD_RUN_PATH is set, it will also add the directories in
LD_RUN_PATH, since the linker will only look at LD_RUN_PATH if -rpath is not
set.
3) Should I include a prefix option for finding include files?
4) Did we want to update other backends to look at dynamic linkers and machine
dependent static libraries like I did for the powerpc.
Here is the ChangeLog.
2012-05-30 Michael Meissner <meissner@linux.vnet.ibm.com>
* doc/install.texi (--with-extra-prefix=): Add new configuration
switches to specify alternate compiler binary, startfile and
library directories at configure time. This allows the configured
compiler to use these alternate paths ahead of the standard paths,
but to fall back to using the standard paths if the executable or
library doesn't exist. For static links, support a new spec
function to allow the backend to specify machine dependent
subdirectories to get access to a library compiled for a
particular machine. For dynamic libraries, add the extra library
directories to the dynamic linker search path via -rpath. On the
powerpc, find the dynamic linker in the extra search paths. Merge
common code together in gcc.c for doing path lookups on colon
separated environment variables.
(--with-extra-exec-prefix=): Likewise.
(--with-extra-startfile-prefix=): Likewise.
(--with-extra-rpath-prefix=): Likewise.
* gcc.c (find_dynamic_linker_spec_function): Likewise.
(extra_rpath_dirs_spec_function): Likewise.
(extra_cpu_dirs_spec_function): Likewise.
(LINK_COMMAND_SPEC): Likewise.
(configure_startfile_prefix): Likewise.
(configure_exec_prefix): Likewise.
(static_spec_functions): Likewise.
(add_multiple_prefix): Likewise.
(process_command): Likewise.
(config_rpath): Likewise.
(build_rpath_or_cpu_dirs): Likewise.
* gcc.h (extra_cpu_dirs_spec_function): Likewise.
* config.in (CONFIGURE_EXEC_PREFIX): Likewise.
(CONFIGURE_STARTFILE_PREFIX): Likewise.
* configure.ac (--with-extra-prefix=): Likewise.
(--with-extra-exec-prefix=): Likewise.
(--with-extra-startfile-prefix=): Likewise.
(--with-extra-rpath-prefix=): Likewise.
* config/rs6000/x-rs6000 (driver-rs6000.o): Likewise.
* config/rs6000/linux64.h (GLIBC_DYNAMIC_LINKER32) Likewise.
(GLIBC_DYNAMIC_LINKER64): Likewise.
(LINUX_EXTRA_STATIC_LIBDIRS64): Likewise.
(LINUX_EXTRA_STATIC_LIBDIRS32): Likewise.
(LINK_OS_LINUX_SPEC32): Likewise.
(LINK_OS_LINUX_SPEC64): Likewise.
* config/rs6000/rs6000.h (LOCAL_CPU_EXTRA_SPEC_FUNCTIONS):
Likewise.
(EXTRA_SPEC_FUNCTIONS): Likewise.
* config/rs6000/driver-rs6000.c (rs6000_extra_static_libdirs):
Likewise.
* config/rs6000/sysv4.h (GLIBC_DYNAMIC_LINKER): Likewise.
(LINK_OS_LINUX_SPEC): Likewise.
(LINUX_EXTRA_STATIC_LIBDIRS32): Likewise.
(LINK_OS_LINUX_SPEC): Likewise.
(rs6000_extra_static_libdirs): Likewise.
(SUBTARGET_EXTRA_SPEC_FUNCTIONS): Likewise.
--
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meissner@linux.vnet.ibm.com fax +1 (978) 399-6899
Attachment:
gcc-power7.patch342b
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |