Bug 10980 - Please support more options available from old ld
Summary: Please support more options available from old ld
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.20
: P2 enhancement
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-18 17:34 UTC by robert.wohlrab
Modified: 2014-05-28 19:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description robert.wohlrab 2009-11-18 17:34:51 UTC
I rebuild the whole debian archive and noticed that many programs don't build
because gold doesn't support special operations. Is it possible to support more
of them? Some are maybe completely useless or used in a wrong. Please add only
add a information for them so I can forward the information to the maintainer of
the package.

The first list of package/flags are following:

 2 ld: -G: unknown option
 * java3d
 * qdbm

 1 ld: -fpic: unknown option
 * cyclades-serial-client

 1 ld: -fPIC: unknown option
 * lsb-build-base3

 1 ld: -g: unknown option
 * qdbm

 1 ld: -i: unknown option
 * ulogd

 1 ld: --section-start: unknown option
 * gfxboot

 2 ld: --warn-constructors: unknown option
 * memtest86
 * memtest86+

 1 ld: --warn-multiple-gp: unknown option
 * mkelfimage

 1 ld: --add-needed: unknown option
 * kwave

 1 ld: --allow-multiple-definition: unknown option
 * brutefir

 2 ld: -assert: unknown option
 * aspectc++

 1 ld: -combreloc: unknown -z option
 * db1-compat

 1 ld: --cref: unknown option
 * faumachine

 2 ld: def: unknown -z option
 * bobcat
 * gnugk

 1 ld: --discard-all: unknown option
 * traybiff

 1 ld: -fPIE: unknown option
 * mandos

 1 ld: muldefs: unknown -z option
 * gnudatalanguage

 1 ld: --no-undefined-version: unknown option
 * libdebian-installer

 1 ld:  relro: unknown -z option
 * kerneloops

 1 ld: --retain-symbols-file: unknown option
 * yate

 1 ld: --sort-common: unknown option
 * busybox

 1 ld: syms: unknown -z option
 * xbuffy

 1 ld: -warn-common: unknown option
 * gputils

13 ld: -x: unknown option
 * asterisk-chan-capi
 * c2hs
 * gtk2hs
 * libcap2
 * libedit
 * libf2c2
 * libpam-chroot
 * libpam-foreground
 * libpam-opie
 * libpam-pwdfile
 * muddleftpd
 * openafs
 * pam-krb5-migrate


More packages/flags will follow because they must be analysed per hand.

Downstream bug can be found at http://bugs.debian.org/555886
Comment 1 robert.wohlrab 2009-11-18 20:04:00 UTC
I think following list includes most of the packages with missing linker flags

 3 ld: -G: unknown option
 * java3d
 * qdbm
 * osmo

 1 ld: -fpic: unknown option
 * cyclades-serial-client

 1 ld: -fPIC: unknown option
 * lsb-build-base3

 3 ld: -g: unknown option
 * qdbm
 * thunar-volman
 * xfce4-linelight-plugin

 1 ld: -i: unknown option
 * ulogd

 1 ld: --section-start: unknown option
 * gfxboot

 2 ld: --warn-constructors: unknown option
 * memtest86
 * memtest86+

 1 ld: --warn-multiple-gp: unknown option
 * mkelfimage

 1 ld: --add-needed: unknown option
 * kwave

 1 ld: --allow-multiple-definition: unknown option
 * brutefir

 2 ld: -assert: unknown option
 * aspectc++

 1 ld: -combreloc: unknown -z option
 * db1-compat

 1 ld: --cref: unknown option
 * faumachine

 6 ld: def: unknown -z option
 * bobcat
 * gnugk
 * openh323
 * openh323-titan
 * ptlib
 * pwlib

 1 ld: --discard-all: unknown option
 * traybiff

 1 ld: -fPIE: unknown option
 * mandos

 1 ld: muldefs: unknown -z option
 * gnudatalanguage

 1 ld: --no-undefined-version: unknown option
 * libdebian-installer

 1 ld:  relro: unknown -z option
 * kerneloops

 1 ld: --retain-symbols-file: unknown option
 * yate

 1 ld: --sort-common: unknown option
 * busybox

 6 ld: syms: unknown -z option
 * xbuffy
 * cdebconf-entropy
 * cdebconf-terminal
 * ratpoison
 * xbuffy
 * xfm

 1 ld: -warn-common: unknown option
 * gputils

 2 ld: --warn-unresolved-symbols: unknown option
 * gnome-settings-daemon
 * libapache2-mod-authn-sasl

 4 ld: -defs: unknown -z option
 * gtk2-engines-xfce
 * ristretto
 * xfce4-mailwatch-plugin
 * xfmpc

13 ld: -x: unknown option
 * asterisk-chan-capi
 * c2hs
 * gtk2hs
 * libcap2
 * libedit
 * libf2c2
 * libpam-chroot
 * libpam-foreground
 * libpam-opie
 * libpam-pwdfile
 * muddleftpd
 * openafs
 * pam-krb5-migrate

 1 ld: --warn-shared-textrel: unknown option
 * sendmail
Comment 2 Ian Lance Taylor 2009-11-19 07:01:54 UTC
Thanks for the extensive list.  Just a couple of notes:

> ld: --warn-constructors: unknown option

This one is implemented in the development version.

> ld: -combreloc: unknown -z option

This is a bug in the package.  The GNU linker simply ignores unrecognized -z
options.  The option, for both linkers, is -z combreloc, not -z -combreloc.

> ld: -fPIE: unknown option

This is almost certainly a bug in the package.  The GNU linker does support a -f
option which gold does not, but the package most likely wants the -pie option.

> ld:  relro: unknown -z option

I don't understand this one, as gold does support the -z relro option.  I note
the extra space--could this be something like -z " relro", which the GNU linker
would ignore?

> ld: -warn-common: unknown option

This is implemented in the development version.

> ld: -fpic: unknown option
> ld: -fPIC: unknown option

As with -fPIE, these are almost certainly bugs in the package.
Comment 3 robert.wohlrab 2009-11-19 16:53:16 UTC
Thanks for your fast reply. All your information was forwarded to the actual
maintainer of the packages. And yes, the extra space was the problem with
relro... haven't seen that there is a extra space. It was reported to
http://bugs.debian.org/557077 with patch.
Comment 4 Sourceware Commits 2009-12-31 06:06:01 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2009-12-31 06:05:49

Modified files:
	gold           : ChangeLog options.h 

Log message:
	PR 10980
	* options.h (class General_options): Permit two dashes with
	--retain-symbols-file.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.417&r2=1.418
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.124&r2=1.125

Comment 5 Ian Lance Taylor 2009-12-31 06:07:40 UTC
I think that this is the current set of missing options:

--add-needed
--allow-multiple-definition
--cref
--no-undefined-version
--section-start
--warn-multiple-gp
--warn-shared-textrel
--warn-unresolved-symbols
-G
-assert
-g
-i
-z combreloc
-z def
-z defs
-z muldefs
-z syms
Comment 6 Sourceware Commits 2010-01-04 23:59:24 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-04 23:59:13

Modified files:
	gold           : ChangeLog options.h 

Log message:
	PR 10980
	* options.h (class General_options): Add -G as a short version of
	--shared.  Add no-op options -assert, -g, and -i.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.419&r2=1.420
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.125&r2=1.126

Comment 7 Sourceware Commits 2010-01-05 00:32:33 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-05 00:32:23

Modified files:
	gold           : ChangeLog object.cc options.h 

Log message:
	PR 10980
	* options.h (class General_options): Add --add-needed and
	--copy-dt-needed-entries.  Tweak --as-needed help entry.
	* object.cc (Input_objects::check_dynamic_dependencies): Give an
	error if --copy-dt-needed-entries aka --add-needed is used and
	would cause a change in behaviour.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.420&r2=1.421
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/object.cc.diff?cvsroot=src&r1=1.112&r2=1.113
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.126&r2=1.127

Comment 8 Ian Lance Taylor 2010-01-05 05:52:29 UTC
2 ld: def: unknown -z option
 * bobcat
 * gnugk

There is no -z def option for the GNU linker.  However, as noted earlier, the GNU 
linker does not complain about unknown -z options.  These two packages presumably 
mean to use -z defs rather than -z def.
Comment 9 Sourceware Commits 2010-01-05 05:56:39 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-05 05:56:28

Modified files:
	gold           : ChangeLog options.h resolve.cc 

Log message:
	PR 10980
	* options.h (class General_options): Add
	--allow-multiple-definition and -z muldefs.
	* resolve.cc (Symbol_table::should_override): Don't warn about a
	multiple symbol definition if --allow-multiple-definition or -z
	muldefs.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.421&r2=1.422
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.127&r2=1.128
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/resolve.cc.diff?cvsroot=src&r1=1.48&r2=1.49

Comment 10 Sourceware Commits 2010-01-05 21:53:12 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-05 21:52:51

Modified files:
	gold           : ChangeLog cref.cc cref.h dynobj.cc dynobj.h 
	                 main.cc mapfile.h object.cc object.h options.h 
	                 plugin.cc plugin.h 

Log message:
	PR 10980
	* options.h (class General_options): Add --cref.
	* main.cc (main): Print cref table if --cref.  Don't close mapfile
	until after printing cref table.
	* cref.cc: Include "symtab.h".
	(class Cref_inputs): Define Cref_table_compare and Cref_table.
	(Cref_table_compare::operator()): New function.
	(Cref_inputs::gather_cref): New function.
	(filecol): New static const.
	(Cref_inputs::print_cref): New function.
	(Cref::print_cref): New function.
	* cref.h: Include <cstdio>.
	(class Cref): Update declarations.
	* mapfile.h (Mapfile::file): New function.
	* object.h (class Object): Define Symbols.  Declare virtual
	do_get_global_symbols.
	(Object::get_global_symbols): New function.
	* object.cc (Input_objects::add_object): Pass object to cref_ if
	--cref.
	(Input_objects::archive_start): Likewise.
	(Input_objects::archive_stop): Likewise.
	(Input_objects::print_cref): New function.
	* dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
	* dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
	--cref.
	* plugin.cc (Sized_pluginobj::do_get_global_symbols): New
	function.
	* plugin.h (class Sized_pluginobj): Update declarations.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.423&r2=1.424
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/cref.cc.diff?cvsroot=src&r1=1.1&r2=1.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/cref.h.diff?cvsroot=src&r1=1.1&r2=1.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/dynobj.cc.diff?cvsroot=src&r1=1.52&r2=1.53
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/dynobj.h.diff?cvsroot=src&r1=1.36&r2=1.37
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/main.cc.diff?cvsroot=src&r1=1.36&r2=1.37
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/mapfile.h.diff?cvsroot=src&r1=1.2&r2=1.3
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/object.cc.diff?cvsroot=src&r1=1.113&r2=1.114
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/object.h.diff?cvsroot=src&r1=1.87&r2=1.88
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.128&r2=1.129
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/plugin.cc.diff?cvsroot=src&r1=1.26&r2=1.27
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/plugin.h.diff?cvsroot=src&r1=1.9&r2=1.10

Comment 11 Sourceware Commits 2010-01-06 05:30:55 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-06 05:30:24

Modified files:
	gold           : ChangeLog gold.cc options.h script.cc script.h 

Log message:
	PR 10980
	* options.h (class General_options): Add --undefined-version.
	* script.cc (struct Version_expression): Add was_matched_by_symbol
	field.
	(Version_script_info::matched_symbol): New function.
	(Version_script_info::get_symbol_version_helper): Call
	matched_symbol.
	(Version_script_info::check_unmatched_names): New function.
	* script.h (class Version_script_info): Update declarations.
	* gold.cc (queue_middle_tasks): Handle --no-undefined-version.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.425&r2=1.426
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/gold.cc.diff?cvsroot=src&r1=1.75&r2=1.76
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.130&r2=1.131
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/script.cc.diff?cvsroot=src&r1=1.64&r2=1.65
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/script.h.diff?cvsroot=src&r1=1.30&r2=1.31

Comment 12 Sourceware Commits 2010-01-06 22:37:35 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-06 22:37:19

Modified files:
	gold           : ChangeLog layout.cc options.cc options.h 
	                 output.cc output.h 

Log message:
	PR 10980
	* options.cc (General_options::parse_section_start): New function.
	(General_options::section_start): New function.
	(General_options::General_options): Initialize all members.
	* options.h: Include <map>
	(class General_options): Add --section-start.  Add section_starts_
	member.
	* layout.cc (Layout::attach_allocated_section_to_segment): If
	--section-start was used, set the address of the segment.  Remove
	local sort_sections.
	(Layout::relaxation_loop_body): If the address of the load segment
	has been set by --section-start, don't use it.
	* output.h (Output_segment::update_flags_for_output_section): New
	function.
	* output.cc (Output_segment::add_output_section): Call
	update_flags_for_output_section.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.426&r2=1.427
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/layout.cc.diff?cvsroot=src&r1=1.155&r2=1.156
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.cc.diff?cvsroot=src&r1=1.97&r2=1.98
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.131&r2=1.132
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/output.cc.diff?cvsroot=src&r1=1.111&r2=1.112
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/output.h.diff?cvsroot=src&r1=1.93&r2=1.94

Comment 13 Sourceware Commits 2010-01-07 05:57:40 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-07 05:57:25

Modified files:
	gold           : ChangeLog options.h 

Log message:
	PR 10980
	* options.h (class General_options): Add --warn-multiple-gp.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.428&r2=1.429
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.132&r2=1.133

Comment 14 Sourceware Commits 2010-01-07 06:05:39 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-07 06:05:24

Modified files:
	gold           : ChangeLog layout.cc options.h 

Log message:
	PR 10980
	* options.h (class General_options): Add --warn-shared-textrel.
	* layout.cc (Layout::finish_dynamic_section): Implement
	--warn-shared-textrel.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.429&r2=1.430
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/layout.cc.diff?cvsroot=src&r1=1.156&r2=1.157
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.133&r2=1.134

Comment 15 Ian Lance Taylor 2010-01-07 06:11:21 UTC
> 1 ld: syms: unknown -z option
>  * xbuffy

This is actually another package error.  There is no -z syms option in the GNU 
linker.  As noted earlier, the GNU linker ignores unknown -z options, whereas 
gold gives an error for them.
Comment 16 Sourceware Commits 2010-01-07 18:31:45 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2010-01-07 18:31:30

Modified files:
	gold           : ChangeLog errors.cc options.h 

Log message:
	PR 10980
	* options.h (class General_options): Add --warn-unresolved-symbols
	and --error-unresolved-symbols.
	* errors.cc (Errors::undefined_symbol): Implement
	--warn-unresolved-symbols.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.432&r2=1.433
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/errors.cc.diff?cvsroot=src&r1=1.11&r2=1.12
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&r1=1.135&r2=1.136

Comment 17 Ian Lance Taylor 2010-01-07 18:33:47 UTC
I believe that all the command line options mentioned here are now implemented, 
or are erroneous.

Thanks for the comprehensive report.

Please open a new bug report for any new missing options, or for any problems 
with the options I recently added.
Comment 18 Sourceware Commits 2010-01-13 16:19:18 UTC
Subject: Bug 10980

CVSROOT:	/cvs/src
Module name:	src
Branch: 	binutils-2_20-branch
Changes by:	ian@sourceware.org	2010-01-13 16:19:03

Modified files:
	gold           : ChangeLog object.cc options.h 

Log message:
	Bring over from mainline:
	2010-01-04  Ian Lance Taylor  <iant@google.com>
	
	PR 10980
	* options.h (class General_options): Add --add-needed and
	--copy-dt-needed-entries.  Tweak --as-needed help entry.
	* object.cc (Input_objects::check_dynamic_dependencies): Give an
	error if --copy-dt-needed-entries aka --add-needed is used and
	would cause a change in behaviour.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.281.2.15&r2=1.281.2.16
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/object.cc.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.98.2.1&r2=1.98.2.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/options.h.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.106.2.2&r2=1.106.2.3

Comment 19 Jari Aalto 2010-03-30 16:55:51 UTC
Rebuilding of Debian package scratchbox2 fails, because it uses:

  Makefile:14:  -Wl,--retain-symbols-file=preload/ldexportlist

Which produces:

  make[1]: Entering directory `/srv/deb/rc/scratchbox2/scratchbox2.git/obj-32'
  make[2]: Entering directory `/srv/deb/rc/scratchbox2/scratchbox2.git/obj-32'
[SHLIB] preload/libsb2.so
  /usr/bin/ld.gold.real: --retain-symbols-file=preload/ldexportlist: unknown 
option
  /usr/bin/ld.gold.real: use the --help option for usage information
collect2: ld returned 1 exit status

The options syntax only allows:

  $ /usr/bin/ld.gold.real --help | grep retain
  -retain-symbols-file [file] keep only symbols listed in this file

Whereas GNU ld(1) manual page reads:

       --retain-symbols-file=filename
           Retain only the symbols listed in the file filename, discarding all 
others.  filename is
           simply a flat file, with one symbol name per line.  This option is 
especially useful in
           environments (such as VxWorks) where a large global symbol table is 
accumulated
           gradually, to conserve run-time memory.

SUGGESTION

Please allow form "option=value" in all cases.
Comment 20 Ian Lance Taylor 2010-04-01 01:44:38 UTC
As I said in comment #17, please open a new bug report about any specific issues.  
Please do not reopen this bug report.  Thanks.

All options which take values do accept =VALUE.  I expect that you are using old 
sources--e.g., any 2.20 release.  If you still have trouble with the current 
development sources, please open a new bug report.
[+] Comment 21 Jackie Rosen 2014-02-16 17:50:57 UTC Comment hidden (spam)