Add support for darwin linker options.

* config/darwin.h(LINK_SPEC): Add darwin specific linker options.
	* doc/invoke.texi: Add new "Darwin Options" section.

From-SVN: r60010
This commit is contained in:
Devang Patel 2002-12-10 12:20:47 -08:00 committed by Devang Patel
parent 0e9f8e8295
commit 48aec0bcc6
3 changed files with 342 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2002-12-10 Devang Patel <dpatel@appple.com>
* config/darwin.h(LINK_SPEC): Add darwin specific linker options.
* doc/invoke.texi: Add new "Darwin Options" section.
2002-12-10 Jim Wilson <wilson@redhat.com>
* rs6000.h (RETURN_IN_MEMORY): If ABI_V4, then TFmode is returned in

View File

@ -84,11 +84,184 @@ Boston, MA 02111-1307, USA. */
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
/* This table intercepts weirdo options whose names would interfere
with normal driver conventions, and either translates them into
standardly-named options, or adds a 'Z' so that they can get to
specs processing without interference.
Do not expand a linker option to "-Xlinker -<option>", since that
forfeits the ability to control via spec strings later. However,
as a special exception, do this translation with -filelist, because
otherwise the driver will think there are no input files and quit.
(The alternative would be to hack the driver to recognize -filelist
specially, but it's simpler to use the translation table.)
Note that an option name with a prefix that matches another option
name, that also takes an argument, needs to be modified so the
prefix is different, otherwise a '*' after the shorter option will
match with the longer one. */
/* Ignore -dynamic for now */
#define TARGET_OPTION_TRANSLATE_TABLE \
{ "-all_load", "-Zall_load" }, \
{ "-allowable_client", "-Zallowable_client" }, \
{ "-arch_errors_fatal", "-Zarch_errors_fatal" }, \
{ "-bind_at_load", "-Zbind_at_load" }, \
{ "-bundle", "-Zbundle" }, \
{ "-bundle_loader", "-Zbundle_loader" }, \
{ "-weak_reference_mismatches", "-Zweak_reference_mismatches" }, \
{ "-dependency-file", "-MF" }, \
{ "-dylib_file", "-Zdylib_file" }, \
{ "-dynamic", " " }, \
{ "-dynamiclib", "-Zdynamiclib" }, \
{ "-exported_symbols_list", "-Zexported_symbols_list" }, \
{ "-seg_addr_table_filename", "-Zseg_addr_table_filename" }, \
{ "-filelist", "-Xlinker -filelist -Xlinker" }, \
{ "-flat_namespace", "-Zflat_namespace" }, \
{ "-force_cpusubtype_ALL", "-Zforce_cpusubtype_ALL" }, \
{ "-force_flat_namespace", "-Zforce_flat_namespace" }, \
{ "-image_base", "-Zimage_base" }, \
{ "-init", "-Zinit" }, \
{ "-install_name", "-Zinstall_name" }, \
{ "-multiply_defined_unused", "-Zmultiplydefinedunused" }, \
{ "-multiply_defined", "-Zmultiply_defined" }, \
{ "-multi_module", "-Zmulti_module" }, \
{ "-static", "-static -Wa,-static" }, \
{ "-single_module", "-Zsingle_module" }, \
{ "-unexported_symbols_list", "-Zunexported_symbols_list" }
/* These compiler options take n arguments. */
#undef WORD_SWITCH_TAKES_ARG
#define WORD_SWITCH_TAKES_ARG(STR) \
(DEFAULT_WORD_SWITCH_TAKES_ARG (STR) ? 1 : \
!strcmp (STR, "Zallowable_client") ? 1 : \
!strcmp (STR, "arch") ? 1 : \
!strcmp (STR, "arch_only") ? 1 : \
!strcmp (STR, "Zbundle_loader") ? 1 : \
!strcmp (STR, "client_name") ? 1 : \
!strcmp (STR, "compatibility_version") ? 1 : \
!strcmp (STR, "current_version") ? 1 : \
!strcmp (STR, "Zdylib_file") ? 1 : \
!strcmp (STR, "Zexported_symbols_list") ? 1 : \
!strcmp (STR, "Zimage_base") ? 1 : \
!strcmp (STR, "Zinit") ? 1 : \
!strcmp (STR, "Zinstall_name") ? 1 : \
!strcmp (STR, "Zmultiplydefinedunused") ? 1 : \
!strcmp (STR, "Zmultiply_defined") ? 1 : \
!strcmp (STR, "precomp-trustfile") ? 1 : \
!strcmp (STR, "read_only_relocs") ? 1 : \
!strcmp (STR, "sectcreate") ? 3 : \
!strcmp (STR, "sectorder") ? 3 : \
!strcmp (STR, "Zseg_addr_table_filename") ?1 :\
!strcmp (STR, "seg1addr") ? 1 : \
!strcmp (STR, "segprot") ? 3 : \
!strcmp (STR, "seg_addr_table") ? 1 : \
!strcmp (STR, "sub_library") ? 1 : \
!strcmp (STR, "sub_umbrella") ? 1 : \
!strcmp (STR, "umbrella") ? 1 : \
!strcmp (STR, "undefined") ? 1 : \
!strcmp (STR, "Zunexported_symbols_list") ? 1 : \
!strcmp (STR, "Zweak_reference_mismatches") ? 1 : \
!strcmp (STR, "pagezero_size") ? 1 : \
!strcmp (STR, "segs_read_only_addr") ? 1 : \
!strcmp (STR, "segs_read_write_addr") ? 1 : \
!strcmp (STR, "sectalign") ? 3 : \
!strcmp (STR, "sectobjectsymbols") ? 2 : \
!strcmp (STR, "segcreate") ? 3 : \
!strcmp (STR, "dylinker_install_name") ? 1 : \
0)
/* Machine dependent cpp options. */
#undef CPP_SPEC
#define CPP_SPEC "%{static:-D__STATIC__}%{!static:-D__DYNAMIC__}"
/* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus
precomp, libtool, and fat build additions. Also we
don't specify a second %G after %L because libSystem is
self-contained and doesn't need to link against libgcc.a. */
/* In general, random Darwin linker flags should go into LINK_SPEC
instead of LINK_COMMAND_SPEC. The command spec is better for
specifying the handling of options understood by generic Unix
linkers, and for positional arguments like libraries. */
#define LINK_COMMAND_SPEC "\
%{!fdump=*:%{!fsyntax-only:%{!precomp:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%{!Zdynamiclib:%(linker)}%{Zdynamiclib:/usr/bin/libtool} \
%l %X %{d} %{s} %{t} %{Z} \
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
%{!Zdynamiclib:%{!A:%{!nostdlib:%{!nostartfiles:%S}}}} \
%{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%G %L}} \
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} \
%{!--help:%{!no-c++filt|c++filt:| c++filt3 }} }}}}}}}}"
/* Please keep the random linker options in alphabetical order (modulo
'Z' and 'no' prefixes). Options that can only go to one of libtool
or ld must be listed twice, under both !Zdynamiclib and
Zdynamiclib, with one of the cases reporting an error. */
/* Note that options taking arguments may appear multiple times on a
command line with different arguments each time, so put a * after
their names so all of them get passed. */
#define LINK_SPEC \
"%{static}%{!static:-dynamic} \
%{!Zdynamiclib: \
%{Zbundle:-bundle} \
%{Zbundle_loader*:-bundle_loader %*} \
%{client_name*} \
%{compatibility_version*:%e-compatibility_version only allowed with -dynamiclib\
} \
%{current_version*:%e-current_version only allowed with -dynamiclib} \
%{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
%{Zforce_flat_namespace:-force_flat_namespace} \
%{Zinstall_name*:%e-install_name only allowed with -dynamiclib} \
%{keep_private_externs} \
%{private_bundle} \
} \
%{Zdynamiclib: \
%{Zbundle:%e-bundle not allowed with -dynamiclib} \
%{Zbundle_loader*:%e-bundle_loader not allowed with -dynamiclib} \
%{client_name*:%e-client_name not allowed with -dynamiclib} \
%{compatibility_version*} \
%{current_version*} \
%{Zforce_cpusubtype_ALL:%e-force_cpusubtype_ALL not allowed with -dynamiclib} \
%{Zforce_flat_namespace:%e-force_flat_namespace not allowed with -dynamiclib} \
%{Zinstall_name*:-install_name %*} \
%{keep_private_externs:%e-keep_private_externs not allowed with -dynamiclib} \
%{private_bundle:%e-private_bundle not allowed with -dynamiclib} \
} \
%{Zall_load:-all_load}%{Zdynamiclib:%{!Zall_load:-noall_load}} \
%{Zallowable_client*:-allowable_client %*} \
%{Zbind_at_load:-bind_at_load} \
%{Zarch_errors_fatal:-arch_errors_fatal} \
%{Zdylib_file*:-dylib_file %*} \
%{Zexported_symbols_list*:-exported_symbols_list %*} \
%{Zflat_namespace:-flat_namespace} \
%{headerpad_max_install_names*} \
%{Zimage_base*:-image_base %*} \
%{Zinit*:-init %*} \
%{nomultidefs} \
%{Zmulti_module:-multi_module} %{Zsingle_module:-single_module} \
%{Zmultiply_defined*:-multiply_defined %*} \
%{Zmultiplydefinedunused*:-multiply_defined_unused %*} \
%{prebind} %{noprebind} %{prebind_all_twolevel_modules} \
%{read_only_relocs} \
%{sectcreate*} %{sectorder*} %{seg1addr*} %{segprot*} %{seg_addr_table*} \
%{Zseg_addr_table_filename*:-seg_addr_table_filename %*} \
%{sub_library*} %{sub_umbrella*} \
%{twolevel_namespace} %{twolevel_namespace_hints} \
%{umbrella*} \
%{undefined*} \
%{Zunexported_symbols_list*:-unexported_symbols_list %*} \
%{Zweak_reference_mismatches*:-weak_reference_mismatches %*} \
%{X} \
%{y*} \
%{w} \
%{pagezero_size*} %{segs_read_*} %{seglinkedit} %{noseglinkedit} \
%{sectalign*} %{sectobjectsymbols*} %{segcreate*} %{whyload} \
%{whatsloaded} %{dylinker_install_name*} \
%{dylinker} %{Mach} "
/* Machine dependent libraries. */
#undef LIB_SPEC
@ -98,8 +271,15 @@ Boston, MA 02111-1307, USA. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"%{pg:%{static:-lgcrt0.o}%{!static:-lgcrt1.o} -lcrt2.o} \
%{!pg:%{static:-lcrt0.o}%{!static:-lcrt1.o} -lcrt2.o}"
"%{!Zdynamiclib:%{Zbundle:%{!static:-lbundle1.o}} \
%{!Zbundle:%{pg:%{static:-lgcrt0.o} \
%{!static:%{object:-lgcrt0.o} \
%{!object:%{preload:-lgcrt0.o} \
%{!preload:-lgcrt1.o -lcrt2.o}}}} \
%{!pg:%{static:-lcrt0.o} \
%{!static:%{object:-lcrt0.o} \
%{!object:%{preload:-lcrt0.o} \
%{!preload:-lcrt1.o -lcrt2.o}}}}}}"
/* The native Darwin linker doesn't necessarily place files in the order
that they're specified on the link line. Thus, it is pointless

View File

@ -463,6 +463,28 @@ in the following sections.
-msim -mmvme -mads -myellowknife -memb -msdata @gol
-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread}
@emph{Darwin Options}
@gccoptlist{
-all_load -allowable_client -arch -arch_errors_fatal @gol
-arch_only -bind_at_load -bundle -bundle_loader @gol
-client_name -compatibility_version -current_version @gol
-dependency-file -dylib_file -dylinker_install_name @gol
-dynamic -dynamiclib -exported_symbols_list @gol
-filelist -flat_namespace -force_cpusubtype_ALL @gol
-force_flat_namespace -headerpad_max_install_names @gol
-image_base -init -install_name -keep_private_externs @gol
-multi_module -multiply_defined -multiply_defined_unused @gol
-noall_load -nomultidefs -noprebind -noseglinkedit @gol
-pagezero_size -prebind -prebind_all_twolevel_modules @gol
-private_bundle -read_only_relocs -sectalign @gol
-sectobjectsymbols -whyload -seg1addr @gol
-sectcreate -sectobjectsymbols -sectorder @gol
-seg_addr_table -seg_addr_table_filename -seglinkedit @gol
-segprot -segs_read_only_addr -segs_read_write_addr @gol
-single_module -static -sub_library -sub_umbrella @gol
-twolevel_namespace -umbrella -undefined @gol
-unexported_symbols_list -weak_reference_mismatches -whatsloaded}
@emph{RT Options}
@gccoptlist{
-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol
@ -5202,6 +5224,7 @@ that macro, which enables you to change the defaults.
* M32R/D Options::
* M88K Options::
* RS/6000 and PowerPC Options::
* Darwin Options::
* RT Options::
* MIPS Options::
* i386 and x86-64 Options::
@ -7227,6 +7250,138 @@ This option sets flags for both the preprocessor and linker.
@end table
@node Darwin Options
@subsection Darwin Options
@cindex Darwin options
@table @gcctabopt
@item -all_load
@item -allowable_client
@item -arch
@item -arch_errors_fatal
@item -arch_only
@item -bind_at_load
@item -bundle
@item -bundle_loader
@item -client_name
@item -compatibility_version
@item -current_version
@item -dependency-file
@item -dylib_file
@item -dylinker_install_name
@item -dynamic
@item -dynamiclib
@item -exported_symbols_list
@item -filelist
@item -flat_namespace
@item -force_cpusubtype_ALL
@item -force_flat_namespace
@item -headerpad_max_install_names
@item -image_base
@item -init
@item -install_name
@item -keep_private_externs
@item -multi_module
@item -multiply_defined
@item -multiply_defined_unused
@item -noall_load
@item -nomultidefs
@item -noprebind
@item -noseglinkedit
@item -pagezero_size
@item -prebind
@item -prebind_all_twolevel_modules
@item -private_bundle
@item -read_only_relocs
@item -sectalign
@item -sectobjectsymbols
@item -whyload
@item -seg1addr
@item -sectcreate
@item -sectobjectsymbols
@item -sectorder
@item -seg_addr_table
@item -seg_addr_table_filename
@item -seglinkedit
@item -segprot
@item -segs_read_only_addr
@item -segs_read_write_addr
@item -single_module
@item -static
@item -sub_library
@item -sub_umbrella
@item -twolevel_namespace
@item -umbrella
@item -undefined
@item -unexported_symbols_list
@item -weak_reference_mismatches
@item -whatsloaded
@opindex all_load
@opindex allowable_client
@opindex arch
@opindex arch_errors_fatal
@opindex arch_only
@opindex bind_at_load
@opindex bundle
@opindex bundle_loader
@opindex client_name
@opindex compatibility_version
@opindex current_version
@opindex dependency-file
@opindex dylib_file
@opindex dylinker_install_name
@opindex dynamic
@opindex dynamiclib
@opindex exported_symbols_list
@opindex filelist
@opindex flat_namespace
@opindex force_cpusubtype_ALL
@opindex force_flat_namespace
@opindex headerpad_max_install_names
@opindex image_base
@opindex init
@opindex install_name
@opindex keep_private_externs
@opindex multi_module
@opindex multiply_defined
@opindex multiply_defined_unused
@opindex noall_load
@opindex nomultidefs
@opindex noprebind
@opindex noseglinkedit
@opindex pagezero_size
@opindex prebind
@opindex prebind_all_twolevel_modules
@opindex private_bundle
@opindex read_only_relocs
@opindex sectalign
@opindex sectobjectsymbols
@opindex whyload
@opindex seg1addr
@opindex sectcreate
@opindex sectobjectsymbols
@opindex sectorder
@opindex seg_addr_table
@opindex seg_addr_table_filename
@opindex seglinkedit
@opindex segprot
@opindex segs_read_only_addr
@opindex segs_read_write_addr
@opindex single_module
@opindex static
@opindex sub_library
@opindex sub_umbrella
@opindex twolevel_namespace
@opindex umbrella
@opindex undefined
@opindex unexported_symbols_list
@opindex weak_reference_mismatches
@opindex whatsloaded
This options are available for Darwin linker. Darwin linker man page
describes them in detail.
@end table
@node RT Options
@subsection IBM RT Options
@cindex RT options