From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32486 invoked by alias); 14 Jul 2011 02:39:42 -0000 Received: (qmail 32476 invoked by uid 22791); 14 Jul 2011 02:39:40 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yi0-f41.google.com (HELO mail-yi0-f41.google.com) (209.85.218.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Jul 2011 02:39:20 +0000 Received: by yia13 with SMTP id 13so3137873yia.0 for ; Wed, 13 Jul 2011 19:39:19 -0700 (PDT) Received: by 10.101.178.21 with SMTP id f21mr1728873anp.138.1310611159474; Wed, 13 Jul 2011 19:39:19 -0700 (PDT) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id i14sm14934365ann.8.2011.07.13.19.39.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jul 2011 19:39:18 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id D7AB4170C1B3; Thu, 14 Jul 2011 12:09:10 +0930 (CST) Date: Thu, 14 Jul 2011 03:29:00 -0000 From: Alan Modra To: Ian Lance Taylor Cc: binutils@sourceware.org Subject: Re: ld -z options Message-ID: <20110714023910.GS26365@bubble.grove.modra.org> Mail-Followup-To: Ian Lance Taylor , binutils@sourceware.org References: <20110713144443.GR26365@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00141.txt.bz2 On Wed, Jul 13, 2011 at 04:07:35PM -0700, Ian Lance Taylor wrote: > Alan Modra writes: > > > I found today that none of the ld -z options are available on ELF > > targets that lack shared lib support (unless the target happens to > > provide some target specific options, which is weird). This patch > > rearranges the option support code in elf32.em to make a few useful > > options generally available, and moves a couple of x86/x86_64 options > > out of the general set. I'll commit this after running tests > > overnight. > > While you're looking at this, how would you feel about making the linker > give a warning or error when an unrecognized -z option is used? Done. A warning seems reasonable. I've also taken out the "-z KEYWORD Ignored for Solaris compatibility" help message, and moved emultempl/plt_unwind.em to emulparams/plt_unwind.sh so that it doesn't conflict with other uses of EXTRA_EM_FILE. * emultempl/elf32.em (gld${EMULATION_NAME}_add_options, gld${EMULATION_NAME}_handle_option, gld${EMULATION_NAME}_list_options): Provide --build-id, -z defs, -z muldefs, -z max-page-size, -z common-page-size, -z execstack, -z noexecstack for all targets. Add help for --exclude-libs. (OPTION_LD_GENERATED_UNWIND_INFO, OPTION_NO_LD_GENERATED_UNWIND_INFO): Move this.. (gld${EMULATION_NAME}_handle_option): ..and code handling --ld-generated-unwind-info and --no-ld-generated-unwind-info.. * emulparams/plt_unwind.sh: ..to here. New file. Add help. * emulparams/elf32_x86_64.sh: Include plt_unwind.sh. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. Index: ld/emulparams/elf32_x86_64.sh =================================================================== RCS file: /cvs/src/src/ld/emulparams/elf32_x86_64.sh,v retrieving revision 1.2 diff -u -p -r1.2 elf32_x86_64.sh --- ld/emulparams/elf32_x86_64.sh 16 Feb 2011 19:14:41 -0000 1.2 +++ ld/emulparams/elf32_x86_64.sh 14 Jul 2011 02:12:01 -0000 @@ -1,3 +1,4 @@ +. ${srcdir}/emulparams/plt_unwind.sh SCRIPT_NAME=elf ELFSIZE=32 OUTPUT_FORMAT="elf32-x86-64" Index: ld/emulparams/elf_i386.sh =================================================================== RCS file: /cvs/src/src/ld/emulparams/elf_i386.sh,v retrieving revision 1.10 diff -u -p -r1.10 elf_i386.sh --- ld/emulparams/elf_i386.sh 29 Jul 2009 14:59:23 -0000 1.10 +++ ld/emulparams/elf_i386.sh 14 Jul 2011 02:12:01 -0000 @@ -1,3 +1,4 @@ +. ${srcdir}/emulparams/plt_unwind.sh SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" NO_RELA_RELOCS=yes Index: ld/emulparams/elf_i386_chaos.sh =================================================================== RCS file: /cvs/src/src/ld/emulparams/elf_i386_chaos.sh,v retrieving revision 1.6 diff -u -p -r1.6 elf_i386_chaos.sh --- ld/emulparams/elf_i386_chaos.sh 9 Aug 2007 11:02:24 -0000 1.6 +++ ld/emulparams/elf_i386_chaos.sh 14 Jul 2011 02:12:01 -0000 @@ -1,3 +1,4 @@ +. ${srcdir}/emulparams/plt_unwind.sh SCRIPT_NAME=elf_chaos OUTPUT_FORMAT="elf32-i386" TEXT_START_ADDR=0x40000000 Index: ld/emulparams/elf_i386_ldso.sh =================================================================== RCS file: /cvs/src/src/ld/emulparams/elf_i386_ldso.sh,v retrieving revision 1.6 diff -u -p -r1.6 elf_i386_ldso.sh --- ld/emulparams/elf_i386_ldso.sh 22 Oct 2008 05:20:44 -0000 1.6 +++ ld/emulparams/elf_i386_ldso.sh 14 Jul 2011 02:12:01 -0000 @@ -1,3 +1,4 @@ +. ${srcdir}/emulparams/plt_unwind.sh SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" NO_RELA_RELOCS=yes Index: ld/emulparams/elf_l1om.sh =================================================================== RCS file: /cvs/src/src/ld/emulparams/elf_l1om.sh,v retrieving revision 1.2 diff -u -p -r1.2 elf_l1om.sh --- ld/emulparams/elf_l1om.sh 31 Mar 2011 22:23:09 -0000 1.2 +++ ld/emulparams/elf_l1om.sh 14 Jul 2011 02:12:01 -0000 @@ -1,3 +1,4 @@ +. ${srcdir}/emulparams/plt_unwind.sh SCRIPT_NAME=elf ELFSIZE=64 OUTPUT_FORMAT="elf64-l1om" Index: ld/emulparams/elf_x86_64.sh =================================================================== RCS file: /cvs/src/src/ld/emulparams/elf_x86_64.sh,v retrieving revision 1.22 diff -u -p -r1.22 elf_x86_64.sh --- ld/emulparams/elf_x86_64.sh 29 Jul 2009 14:59:23 -0000 1.22 +++ ld/emulparams/elf_x86_64.sh 14 Jul 2011 02:12:01 -0000 @@ -1,3 +1,4 @@ +. ${srcdir}/emulparams/plt_unwind.sh SCRIPT_NAME=elf ELFSIZE=64 OUTPUT_FORMAT="elf64-x86-64" Index: ld/emulparams/plt_unwind.sh =================================================================== RCS file: ld/emulparams/plt_unwind.sh diff -N ld/emulparams/plt_unwind.sh --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ld/emulparams/plt_unwind.sh 14 Jul 2011 02:34:57 -0000 @@ -0,0 +1,28 @@ +PARSE_AND_LIST_PROLOGUE=' +#define OPTION_LD_GENERATED_UNWIND_INFO 301 +#define OPTION_NO_LD_GENERATED_UNWIND_INFO 302 +' + +PARSE_AND_LIST_LONGOPTS=' + {"ld-generated-unwind-info", no_argument, NULL, + OPTION_LD_GENERATED_UNWIND_INFO}, + {"no-ld-generated-unwind-info", no_argument, NULL, + OPTION_NO_LD_GENERATED_UNWIND_INFO}, +' + +PARSE_AND_LIST_OPTIONS=' + fprintf (file, _("\ + --ld-generated-unwind-info Generate exception handling info for PLT.\n\ + --no-ld-generated-unwind-info Don'\''t do so.\n" + )); +' + +PARSE_AND_LIST_ARGS_CASES=' + case OPTION_LD_GENERATED_UNWIND_INFO: + link_info.no_ld_generated_unwind_info = FALSE; + break; + + case OPTION_NO_LD_GENERATED_UNWIND_INFO: + link_info.no_ld_generated_unwind_info = TRUE; + break; +' Index: ld/emultempl/elf32.em =================================================================== RCS file: /cvs/src/src/ld/emultempl/elf32.em,v retrieving revision 1.220 diff -u -p -r1.220 elf32.em --- ld/emultempl/elf32.em 20 Jun 2011 13:18:48 -0000 1.220 +++ ld/emultempl/elf32.em 14 Jul 2011 02:12:02 -0000 @@ -2106,8 +2106,6 @@ EOF fi fi -if test -n "$PARSE_AND_LIST_ARGS_CASES" -o x"$GENERATE_SHLIB_SCRIPT" = xyes; then - if test -n "$PARSE_AND_LIST_PROLOGUE" ; then fragment <