diff options
author | carlos <carlos@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-07-28 01:23:30 +0000 |
---|---|---|
committer | carlos <carlos@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-07-28 01:23:30 +0000 |
commit | e8b3a7c12a2b6f68f29de7debf3b09d980d845d9 (patch) | |
tree | 98c9fdbd2717abdae8211283e19e4666ec861f29 | |
parent | 69f4201438e46fd5436c363757251cf5b5df4ba0 (diff) |
2006-07-27 Carlos O'Donell <carlos@codesourcery.com>csl/sourcerygxx/4.1-17csl/renesas/4.1-6
gcc/
* gcc.c: Organize search path variables into $prefix relative,
and well-known native. Add comments.
(add_sysrooted_prefix): Add comment.
(process_command): If !gcc_exec_prefix add $prefix based paths.
If *cross_compile == '0', add native well-known paths.
Assert tooldir_base_prefix is always relative.
(main): If print_search_dirs, and if gcc_exec_prefix is set,
use this value for 'install:' path.
2006-07-27 Carlos O'Donell <carlos@codesourcery.com>
gcc/
* config/arm/linux-elf.h (NEED_INDICATE_EXEC_STACK): Define as 1.
* arm.c (arm_file_end): If NEED_INDICATE_EXEC_STACK call
file_end_indicate_exec_stack.
* arm.h [!NEED_INDICATE_EXEC_STACK] (NEED_INIDCATE_EXEC_STACK):
Define as 0.
* lib1funcs.asm [__ELF__ && __linux__]: Emit .note.GNU-stack section
for a non-executable stack.
* crti.asm: Likewise.
* crtn.asm: Likewise.
* libunwind.S: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/csl/sourcerygxx-4_1@115788 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | ChangeLog.csl | 26 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 4 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 6 | ||||
-rw-r--r-- | gcc/config/arm/crti.asm | 6 | ||||
-rw-r--r-- | gcc/config/arm/crtn.asm | 6 | ||||
-rw-r--r-- | gcc/config/arm/lib1funcs.asm | 7 | ||||
-rw-r--r-- | gcc/config/arm/libunwind.S | 6 | ||||
-rw-r--r-- | gcc/config/arm/linux-elf.h | 4 | ||||
-rw-r--r-- | gcc/gcc.c | 129 |
9 files changed, 130 insertions, 64 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl index a8164968476..60c4c53fbbf 100644 --- a/ChangeLog.csl +++ b/ChangeLog.csl @@ -1,3 +1,29 @@ +2006-07-27 Carlos O'Donell <carlos@codesourcery.com> + + gcc/ + * gcc.c: Organize search path variables into $prefix relative, + and well-known native. Add comments. + (add_sysrooted_prefix): Add comment. + (process_command): If !gcc_exec_prefix add $prefix based paths. + If *cross_compile == '0', add native well-known paths. + Assert tooldir_base_prefix is always relative. + (main): If print_search_dirs, and if gcc_exec_prefix is set, + use this value for 'install:' path. + +2006-07-27 Carlos O'Donell <carlos@codesourcery.com> + + gcc/ + * config/arm/linux-elf.h (NEED_INDICATE_EXEC_STACK): Define as 1. + * arm.c (arm_file_end): If NEED_INDICATE_EXEC_STACK call + file_end_indicate_exec_stack. + * arm.h [!NEED_INDICATE_EXEC_STACK] (NEED_INIDCATE_EXEC_STACK): + Define as 0. + * lib1funcs.asm [__ELF__ && __linux__]: Emit .note.GNU-stack section + for a non-executable stack. + * crti.asm: Likewise. + * crtn.asm: Likewise. + * libunwind.S: Likewise. + 2006-07-26 Richard Sandiford <richard@codesourcery.com> gcc/ diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index ccbaf37c8d7..40b50997729 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -15193,6 +15193,10 @@ arm_file_end (void) { int regno; + if (NEED_INDICATE_EXEC_STACK) + /* Add .note.GNU-stack. */ + file_end_indicate_exec_stack (); + if (! thumb_call_reg_needed) return; diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index f775cb86476..88eff57e1ab 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2832,4 +2832,10 @@ enum arm_builtins ARM_BUILTIN_MAX }; + +/* Do not emit .note.GNU-stack by default. */ +#ifndef NEED_INDICATE_EXEC_STACK +#define NEED_INDICATE_EXEC_STACK 0 +#endif + #endif /* ! GCC_ARM_H */ diff --git a/gcc/config/arm/crti.asm b/gcc/config/arm/crti.asm index 166a3ce34e8..6f0acd199e0 100644 --- a/gcc/config/arm/crti.asm +++ b/gcc/config/arm/crti.asm @@ -31,6 +31,12 @@ # the executable file might be covered by the GNU General Public License. # +/* An executable stack is *not* required for these functions. */ +#if defined(__ELF__) && defined(__linux__) +.section .note.GNU-stack,"",%progbits +.previous +#endif + # This file just make a stack frame for the contents of the .fini and # .init sections. Users may put any desired instructions in those # sections. diff --git a/gcc/config/arm/crtn.asm b/gcc/config/arm/crtn.asm index 360afae9753..36c417d7dde 100644 --- a/gcc/config/arm/crtn.asm +++ b/gcc/config/arm/crtn.asm @@ -31,6 +31,12 @@ # the executable file might be covered by the GNU General Public License. # +/* An executable stack is *not* required for these functions. */ +#if defined(__ELF__) && defined(__linux__) +.section .note.GNU-stack,"",%progbits +.previous +#endif + # This file just makes sure that the .fini and .init sections do in # fact return. Users may put any desired instructions in those sections. # This file is the last thing linked into any executable. diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm index 9f5ca0c1c90..c725f90955a 100644 --- a/gcc/config/arm/lib1funcs.asm +++ b/gcc/config/arm/lib1funcs.asm @@ -27,6 +27,13 @@ You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* An executable stack is *not* required for these functions. */ +#if defined(__ELF__) && defined(__linux__) +.section .note.GNU-stack,"",%progbits +.previous +#endif + /* ------------------------------------------------------------------------ */ #if !defined(__thumb__) diff --git a/gcc/config/arm/libunwind.S b/gcc/config/arm/libunwind.S index 786d04de492..1585eb206ba 100644 --- a/gcc/config/arm/libunwind.S +++ b/gcc/config/arm/libunwind.S @@ -26,6 +26,12 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* An executable stack is *not* required for these functions. */ +#if defined(__ELF__) && defined(__linux__) +.section .note.GNU-stack,"",%progbits +.previous +#endif + #ifndef __symbian__ #include "lib1funcs.asm" diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h index 0cb8c9cad91..945f248b546 100644 --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h @@ -109,3 +109,7 @@ /* The GNU/Linux profiler needs a frame pointer. */ #define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile + +/* Add .note.GNU-stack. */ +#undef NEED_INDICATE_EXEC_STACK +#define NEED_INDICATE_EXEC_STACK 1 diff --git a/gcc/gcc.c b/gcc/gcc.c index ffa71875503..48d940c154a 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1459,25 +1459,33 @@ static const char *gcc_libexec_prefix; #define MD_STARTFILE_PREFIX_1 "" #endif +/* These directories are locations set at configure-time based on the + --prefix option provided to configure. Their initializers are + defined in Makefile.in. These paths are not *directly* used when + gcc_exec_prefix is set because, in that case, we know where the + compiler has been installed, and use paths relative to that + location instead. */ static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; +static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX; +static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX; +static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; + +/* For native compilers, these are well-known paths containing + components that may be provided by the system. For cross + compilers, these paths are not used. */ static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/"; static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/"; static const char *md_exec_prefix = MD_EXEC_PREFIX; - static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; -static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; -static const char *const standard_startfile_prefix_1 +static const char *const standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1; static const char *const standard_startfile_prefix_2 = STANDARD_STARTFILE_PREFIX_2; +/* A relative path to be used in finding the location of tools + relative to the driver. */ static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX; -static const char *tooldir_prefix; - -static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX; - -static const char *standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX; /* Subdirectory to use for locating libraries. Set by set_multilib_dir based on the compilation options. */ @@ -2631,6 +2639,7 @@ add_prefix (struct path_prefix *pprefix, const char *prefix, } /* Same as add_prefix, but prepending target_system_root to prefix. */ +/* The target_system_root prefix has been relocated by gcc_exec_prefix. */ static void add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix, const char *component, @@ -3159,6 +3168,7 @@ process_command (int argc, const char **argv) int is_modify_target_name; int j; #endif + const char *tooldir_prefix; GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX"); @@ -3268,6 +3278,9 @@ process_command (int argc, const char **argv) } #else #endif + /* From this point onward, gcc_exec_prefix is non-null if the toolchain + is relocated. The toolchain was either relocated using GCC_EXEC_PREFIX + or an automatically created GCC_EXEC_PREFIX from argv[0]. */ if (gcc_exec_prefix) { @@ -3814,62 +3827,50 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" use_pipes = 0; } - /* Set up the search paths before we go looking for config files. */ + /* Set up the search paths. We add directories that we expect to + contain GNU Toolchain components before directories specified by + the machine description so that we will find GNU components (like + the GNU assembler) before those of the host system. */ - /* These come before the md prefixes so that we will find gcc's subcommands - (such as cpp) rather than those of the host system. */ - /* Use 2 as fourth arg meaning try just the machine as a suffix, - as well as trying the machine and the version. */ + /* If we don't know where the toolchain has been installed, use the + configured-in locations. */ + if (!gcc_exec_prefix) + { #ifndef OS2 - add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC", - PREFIX_PRIORITY_LAST, 1, 0); - add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS", - PREFIX_PRIORITY_LAST, 2, 0); - add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS", - PREFIX_PRIORITY_LAST, 2, 0); - add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS", - PREFIX_PRIORITY_LAST, 2, 0); - add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS", - PREFIX_PRIORITY_LAST, 2, 0); + add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC", + PREFIX_PRIORITY_LAST, 1, 0); + add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS", + PREFIX_PRIORITY_LAST, 2, 0); + add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS", + PREFIX_PRIORITY_LAST, 2, 0); #endif + add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", + PREFIX_PRIORITY_LAST, 1, 0); + } - add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", - PREFIX_PRIORITY_LAST, 1, 0); - add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", - PREFIX_PRIORITY_LAST, 1, 0); + /* If not cross-compiling, search well-known system locations. */ + if (*cross_compile == '0') + { +#ifndef OS2 + add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS", + PREFIX_PRIORITY_LAST, 2, 0); + add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS", + PREFIX_PRIORITY_LAST, 2, 0); +#endif + add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", + PREFIX_PRIORITY_LAST, 1, 0); + } + gcc_assert (!IS_ABSOLUTE_PATH (tooldir_base_prefix)); tooldir_prefix = concat (tooldir_base_prefix, spec_machine, dir_separator_str, NULL); - /* If tooldir is relative, base it on exec_prefixes. A relative - tooldir lets us move the installed tree as a unit. - - If GCC_EXEC_PREFIX is defined, then we want to add two relative - directories, so that we can search both the user specified directory - and the standard place. */ - - if (!IS_ABSOLUTE_PATH (tooldir_prefix)) - { - if (gcc_exec_prefix) - { - char *gcc_exec_tooldir_prefix - = concat (gcc_exec_prefix, spec_machine, dir_separator_str, - spec_version, dir_separator_str, tooldir_prefix, NULL); - - add_prefix (&exec_prefixes, - concat (gcc_exec_tooldir_prefix, "bin", - dir_separator_str, NULL), - NULL, PREFIX_PRIORITY_LAST, 0, 0); - add_prefix (&startfile_prefixes, - concat (gcc_exec_tooldir_prefix, "lib", - dir_separator_str, NULL), - NULL, PREFIX_PRIORITY_LAST, 0, 1); - } - - tooldir_prefix = concat (standard_exec_prefix, spec_machine, - dir_separator_str, spec_version, - dir_separator_str, tooldir_prefix, NULL); - } + /* Look for tools relative to the location from which the driver is + running, or, if that is not available, the configured prefix. */ + tooldir_prefix + = concat (gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix, + spec_machine, dir_separator_str, + spec_version, dir_separator_str, tooldir_prefix, NULL); add_prefix (&exec_prefixes, concat (tooldir_prefix, "bin", dir_separator_str, NULL), @@ -6274,18 +6275,16 @@ main (int argc, const char **argv) PREFIX_PRIORITY_LAST, 0, 1); else if (*cross_compile == '0') { - if (gcc_exec_prefix) - add_prefix (&startfile_prefixes, - concat (gcc_exec_prefix, machine_suffix, - standard_startfile_prefix, NULL), - NULL, PREFIX_PRIORITY_LAST, 0, 1); add_prefix (&startfile_prefixes, - concat (standard_exec_prefix, - machine_suffix, + concat (gcc_exec_prefix + ? gcc_exec_prefix : standard_exec_prefix, + machine_suffix, standard_startfile_prefix, NULL), NULL, PREFIX_PRIORITY_LAST, 0, 1); } + /* Sysrooted prefixes are relocated because target_system_root is + also relocated by gcc_exec_prefix. */ if (*standard_startfile_prefix_1) add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_1, "BINUTILS", @@ -6329,7 +6328,9 @@ main (int argc, const char **argv) if (print_search_dirs) { - printf (_("install: %s%s\n"), standard_exec_prefix, machine_suffix); + printf (_("install: %s%s\n"), + gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix, + gcc_exec_prefix ? "" : machine_suffix); printf (_("programs: %s\n"), build_search_list (&exec_prefixes, "", 0)); printf (_("libraries: %s\n"), build_search_list (&startfile_prefixes, "", 0)); return (0); |