This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ld -o behaviour


Hi Guys,

: I think it would be also OK to simply remove the -omagic option.  I
: think it was only introduced so that -N would have a long option name.

Actually looking into this a little bit more, I think that the
intention of naming the option -omagic was to indicate that it was
connected to the OMAGIC value unsed in some Unix systems.  From ld.1:

   -N 
      specifies readable and writable text and data sections.
      If the output format supports Unix style magic numbers,
      the output is marked as OMAGIC.

      When you use the -N option, the linker does not page-align
      the data segment.

  -n
      sets the text segment to be read only, and NMAGIC is
      written if possible.


So I am proposing the patch below which renames -omagic to -set-omagic
and -nmagic to -set-nmagic.

Note - there is still a problem if the user decides to call their
executable 'utput' since "gcc -output foo.c" will collide with the
-output linker switch...

Any objections to this patch ?

Cheers
	Nick


2000-12-27  Nick Clifton  <nickc@redhat.com>

	* lexsup.c (ld_options): Rename '-omagic' to -set-omagic' to
	avoid collisions with -o<name> when <name> is "magic".
	Rename '-nmagic' to '-set-nmagic' for consistency with
	-set-omagic.
	(ld.texinfo): Update documentation for renamed command line
	switches.

Index: ld/lexsup.c
===================================================================
RCS file: /cvs/src//src/ld/lexsup.c,v
retrieving revision 1.24
diff -p -r1.24 lexsup.c
*** lexsup.c	2000/12/12 20:53:00	1.24
--- lexsup.c	2000/12/27 19:30:23
*************** static const struct ld_option ld_options
*** 196,204 ****
        'm', N_("EMULATION"), N_("Set emulation"), ONE_DASH },
    { {"print-map", no_argument, NULL, 'M'},
        'M', NULL, N_("Print map file on standard output"), TWO_DASHES },
!   { {"nmagic", no_argument, NULL, 'n'},
        'n', NULL, N_("Do not page align data"), TWO_DASHES },
!   { {"omagic", no_argument, NULL, 'N'},
        'N', NULL, N_("Do not page align data, do not make text readonly"),
        TWO_DASHES },
    { {"output", required_argument, NULL, 'o'},
--- 196,204 ----
        'm', N_("EMULATION"), N_("Set emulation"), ONE_DASH },
    { {"print-map", no_argument, NULL, 'M'},
        'M', NULL, N_("Print map file on standard output"), TWO_DASHES },
!   { {"set-nmagic", no_argument, NULL, 'n'},
        'n', NULL, N_("Do not page align data"), TWO_DASHES },
!   { {"set-omagic", no_argument, NULL, 'N'},
        'N', NULL, N_("Do not page align data, do not make text readonly"),
        TWO_DASHES },
    { {"output", required_argument, NULL, 'o'},

Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src//src/ld/ld.texinfo,v
retrieving revision 1.30
diff -p -r1.30 ld.texinfo
*** ld.texinfo	2000/12/26 20:55:29	1.30
--- ld.texinfo	2000/12/27 19:30:23
*************** which caused the archive member to be br
*** 555,572 ****
  @kindex -n
  @cindex read-only text
  @cindex NMAGIC
! @kindex --nmagic
  @item -n
! @itemx --nmagic
  Turn off page alignment of sections, and mark the output as
  @code{NMAGIC} if possible. 
  
  @kindex -N
! @kindex --omagic
  @cindex read/write from cmd line
  @cindex OMAGIC
  @item -N 
! @itemx --omagic
  Set the text and data sections to be readable and writable.  Also, do
  not page-align the data segment.  If the output format supports Unix
  style magic numbers, mark the output as @code{OMAGIC}.
--- 555,572 ----
  @kindex -n
  @cindex read-only text
  @cindex NMAGIC
! @kindex --set-nmagic
  @item -n
! @itemx --set-nmagic
  Turn off page alignment of sections, and mark the output as
  @code{NMAGIC} if possible. 
  
  @kindex -N
! @kindex --set-omagic
  @cindex read/write from cmd line
  @cindex OMAGIC
  @item -N 
! @itemx --set-omagic
  Set the text and data sections to be readable and writable.  Also, do
  not page-align the data segment.  If the output format supports Unix
  style magic numbers, mark the output as @code{OMAGIC}.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]