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]

Re: Is -T meaningful as an assembler option?


Mark Mitchell wrote:

Yes, I think that's the best plan, but I don't think it's as bad as you
do.  And, there's nothing that says you have to do all targets to make
progress here.  I'd suggest:

1. In config/svr4.h:

* Define SVR4_ASM_SPEC like so:

#ifndef USE_GAS
#define SVR4_ASM_SPEC <its current value>
#else
#define SVR4_ASM_SPEC <its current value without -T>

* Define ASM_SPEC to SVR4_ASM_SPEC

2. In config/rs6000/sysv4.h, in the midst of the big string, do:

#define ASM_SPEC "%(asm_cpu) \

%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} " \
  SVR4_ASM_SPEC \
 "%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC}
  ..."

This is backwards-compatible in that configurations including
config/svr4.h still work as before -- except that they no longer pass -T
to GAS, which is good, since that doesn't work.  The Power bug is then
fixed.  Other configurations using config/svr4.h that are overriding
ASM_SPEC can, if they want, update to use SVR4_ASM_SPEC as above to
avoid code duplication.

OK, the attached patch does that. I've also removed some other options that don't make sense for GAS, and added a blurb about -T to invoke.texi.


OK to commit? I regression-tested the patch on a 4.3 powerpc-eabi configuration but was unable to get the same configuration (without the patch) to build at all from mainline head. It's getting an unrecognizable insn error while building libgcc; I don't really have the time or target-specific knowledge to track that down right now. :-(

-Sandra

2008-10-14  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* config.gcc (powerpc-*): Make t-ppcgas imply usegas.h.
	* config/svr4.h (SVR4_ASM_SPEC): New.
	(ASM_SPEC): Inherit from SVR4_ASM_SPEC.
	* config/rs6000/sysv4.h (ASM_SPEC): Inherit from SVR4_ASM_SPEC.
	
	gcc/doc/
	* invoke.texi (Option Summary): Add -T to linker options.
	(Link Options): Document -T.
	
Index: gcc/config.gcc
===================================================================
*** gcc/config.gcc	(revision 141083)
--- gcc/config.gcc	(working copy)
*************** powerpc-*-eabisimaltivec*)
*** 1777,1788 ****
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcendian rs6000/t-ppccomm"
  	;;
  powerpc-*-eabisim*)
! 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
  powerpc-*-elf*)
! 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
--- 1777,1788 ----
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcendian rs6000/t-ppccomm"
  	;;
  powerpc-*-eabisim*)
! 	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
  powerpc-*-elf*)
! 	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
*************** powerpc-*-eabialtivec*)
*** 1792,1803 ****
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcendian rs6000/t-ppccomm"
  	;;
  powerpc-xilinx-eabi*)
! 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
  powerpc-*-eabi*)
! 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
--- 1792,1803 ----
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcendian rs6000/t-ppccomm"
  	;;
  powerpc-xilinx-eabi*)
! 	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
  powerpc-*-eabi*)
! 	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	;;
*************** powerpc-*-lynxos*)
*** 1885,1906 ****
  	gas=yes
  	;;
  powerpcle-*-elf*)
! 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	;;
  powerpcle-*-eabisim*)
! 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	;;
  powerpcle-*-eabi*)
! 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	;;
  powerpc-xilinx-eabi*)
!  	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h rs6000/xfpu.h"
    	extra_options="${extra_options} rs6000/sysv4.opt"
    	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
    	;;
--- 1885,1906 ----
  	gas=yes
  	;;
  powerpcle-*-elf*)
! 	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	;;
  powerpcle-*-eabisim*)
! 	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	;;
  powerpcle-*-eabi*)
! 	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h"
  	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
  	extra_options="${extra_options} rs6000/sysv4.opt"
  	;;
  powerpc-xilinx-eabi*)
!  	tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h rs6000/xfpu.h"
    	extra_options="${extra_options} rs6000/sysv4.opt"
    	tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
    	;;
Index: gcc/config/svr4.h
===================================================================
*** gcc/config/svr4.h	(revision 141083)
--- gcc/config/svr4.h	(working copy)
*************** along with GCC; see the file COPYING3.  
*** 55,61 ****
    && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")	\
    && strcmp (STR, "Tbss"))
  
! /* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
     many of the specialized svr4 assembler options as seems reasonable,
     given that there are certain options which we can't (or shouldn't)
     support directly due to the fact that they conflict with other options
--- 55,62 ----
    && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")	\
    && strcmp (STR, "Tbss"))
  
! /* Provide an ASM_SPEC appropriate for svr4.
!    If we're not using GAS, we try to support as
     many of the specialized svr4 assembler options as seems reasonable,
     given that there are certain options which we can't (or shouldn't)
     support directly due to the fact that they conflict with other options
*************** along with GCC; see the file COPYING3.  
*** 74,82 ****
     read its stdin.
  */
  
! #undef  ASM_SPEC
! #define ASM_SPEC \
    "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
  
  #define AS_NEEDS_DASH_FOR_PIPED_INPUT
  
--- 75,90 ----
     read its stdin.
  */
  
! #ifdef USE_GAS
! #define SVR4_ASM_SPEC \
!   "%{v:-V} %{Wa,*:%*}"
! #else
! #define SVR4_ASM_SPEC \
    "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
+ #endif
+ 
+ #undef  ASM_SPEC
+ #define ASM_SPEC SVR4_ASM_SPEC
  
  #define AS_NEEDS_DASH_FOR_PIPED_INPUT
  
Index: gcc/config/rs6000/sysv4.h
===================================================================
*** gcc/config/rs6000/sysv4.h	(revision 141083)
--- gcc/config/rs6000/sysv4.h	(working copy)
*************** extern int fixuplabelno;
*** 585,593 ****
  /* Override svr4.h definition.  */
  #undef	ASM_SPEC
  #define	ASM_SPEC "%(asm_cpu) \
! %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
! %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
! %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
  %{memb|msdata|msdata=eabi: -memb} \
  %{mlittle|mlittle-endian:-mlittle; \
    mbig|mbig-endian      :-mbig;    \
--- 585,593 ----
  /* Override svr4.h definition.  */
  #undef	ASM_SPEC
  #define	ASM_SPEC "%(asm_cpu) \
! %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
! SVR4_ASM_SPEC \
! "%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
  %{memb|msdata|msdata=eabi: -memb} \
  %{mlittle|mlittle-endian:-mlittle; \
    mbig|mbig-endian      :-mbig;    \
Index: gcc/doc/invoke.texi
===================================================================
*** gcc/doc/invoke.texi	(revision 141083)
--- gcc/doc/invoke.texi	(working copy)
*************** Objective-C and Objective-C++ Dialects}.
*** 405,411 ****
  @gccoptlist{@var{object-file-name}  -l@var{library} @gol
  -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
  -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
! -Wl,@var{option}  -Xlinker @var{option} @gol
  -u @var{symbol}}
  
  @item Directory Options
--- 405,411 ----
  @gccoptlist{@var{object-file-name}  -l@var{library} @gol
  -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
  -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
! -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
  -u @var{symbol}}
  
  @item Directory Options
*************** about any unresolved references (unless 
*** 7847,7852 ****
--- 7847,7860 ----
  option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
  this option.
  
+ @item -T @var{script}
+ @opindex T
+ @cindex linker script
+ Use @var{script} as the linker script.  This option is supported by most
+ systems using the GNU linker.  On some targets, such as bare-board
+ targets without an operating system, the @option{-T} option may be required 
+ when linking to avoid references to undefined symbols.
+ 
  @item -Xlinker @var{option}
  @opindex Xlinker
  Pass @var{option} as an option to the linker.  You can use this to

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