bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Option -n does not work with ld in binutils-2.12


From: Nick Clifton
Subject: Re: Option -n does not work with ld in binutils-2.12
Date: 11 Apr 2002 17:53:58 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

Hi Tobias,

> It is easy to see because of the (presumed) bug below.  Here you can see 
> that -n does not do the same as --nmagic:
> 
> $ arm-elf-ld -V
> GNU ld version 2.12
>   Supported emulations:
>    armelf
> $ arm-elf-ld -Ttmp2.lds crt.o -o tmp.elf
> arm-elf-ld: tmp.elf: Not enough room for program headers, try linking with -N
> arm-elf-ld: final link failed: Bad value
> $ arm-elf-ld -Ttmp2.lds -n crt.o -o tmp.elf
> arm-elf-ld: tmp.elf: Not enough room for program headers, try linking with -N
> arm-elf-ld: final link failed: Bad value
> $ arm-elf-ld -Ttmp2.lds --nmagic crt.o -o tmp.elf

Ahh - thanks.  I am now able to reproduce the problem and here is a
patch to fix it.  Poor old getopt is getting confused between
'--no-pipeline-knowledge' and '-n'.  What happens is that elf32.em
calls getopt_long_only() which accepts both '-' and '--' as a prefix
for a long option, but in its list of short options it does not have
the letter 'n'.  So getopt_long_only sees '-n', discovers that is a
unique abbreviation for '--no-pipeline-knowledge' and checks that
there are no short option using the letter 'n', (there isn't) and so
returns its shorter form, '-p' which is then parsed as disabling the
ARB backend's knowledge of ARM pipeline lengths.

The fix is to add 'n' to the list of short options so that it will be
caught and then ignored by elf32.em and passed back to parse_args()
where it can be handled properly.

Cheers
        Nick


2002-04-11  Nick Clifton  <address@hidden>

        * emultempl/armelf.em (PARSE_AND_LIST_SHORTOPTS): Add 'n' in order
        to prevent "-n" from being taken as an abbreviation for
        "--no-pipeline-knowledge".

Index: ld/emultempl/armelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/armelf.em,v
retrieving revision 1.24
diff -c -3 -p -w -r1.24 armelf.em
*** ld/emultempl/armelf.em      15 Nov 2001 12:44:03 -0000      1.24
--- ld/emultempl/armelf.em      11 Apr 2002 16:50:19 -0000
*************** PARSE_AND_LIST_PROLOGUE='
*** 156,162 ****
  #define OPTION_THUMB_ENTRY            301
  '
  
! PARSE_AND_LIST_SHORTOPTS=p
  
  PARSE_AND_LIST_LONGOPTS='
    { "no-pipeline-knowledge", no_argument, NULL, '\'p\''},
--- 156,167 ----
  #define OPTION_THUMB_ENTRY            301
  '
  
! # Note we add 'n' to the short option list in order to prevent
! # getopt_long_only from thinking that -n is a unique abbreviation
! # for --no-pipeline-knowledge.  There is no case to handle 'n' here
! # however, so instead it will be passed back to parse_args() in
! # lexsup.c where it will be handled.
! PARSE_AND_LIST_SHORTOPTS=pn
  
  PARSE_AND_LIST_LONGOPTS='
    { "no-pipeline-knowledge", no_argument, NULL, '\'p\''},




reply via email to

[Prev in Thread] Current Thread [Next in Thread]