Go to file
Joseph Myers d2892faac6 lto: Fix option merging [PR106129]
The LTO merging of options from different input files was broken by:

commit 227a2ecf66
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Mar 12 11:53:47 2021 +0100

    lto-wrapper: Use vec<cl_decoded_option> data type.

Previously, find_and_merge_options would merge options it read into
those in *opts. After this commit, options in *opts on entry to
find_and_merge_options are ignored; the only merging that takes place
is between multiple sets of options in the same input file that are
read in the same call to this function (not sure how that case can
occur at all). The effects include, for example, that if some objects
are built with PIC enabled and others with it disabled, and the last
LTO object processed has PIC enabled, the choice of PIC for the last
object will result in the whole program being built as PIC, when the
merging logic is intended to ensure that a mixture of PIC and non-PIC
objects results in the whole program being built as non-PIC.

Fix this with an extra argument to find_and_merge_options to determine
whether merging should take place.  This shows up a second issue with
that commit (which I think wasn't actually intended to change code
semantics at all): once merging is enabled again, the check for
-Xassembler options became an infinite loop in the case where both
inputs had -Xassembler options, with the same first option, so fix
that loop to restore the previous semantics.

Note that I'm not sure how LTO option merging might be tested in the
testsuite (clearly there wasn't sufficient, if any, coverage to detect
these bugs).

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

	PR lto/106129
	* lto-wrapper.cc (find_option): Add argument start.
	(merge_and_complain): Loop over existing_opt_index and
	existing_opt2_index for Xassembler check.  Update calls to
	find_option.
	(find_and_merge_options): Add argument first to determine whether
	to merge options with those passed in *opts.
	(run_gcc): Update calls to find_and_merge_options.

(cherry picked from commit 8a8ee37a33)
2022-07-27 11:23:45 +02:00
INSTALL
c++tools Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
config Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
contrib Daily bump. 2022-05-07 00:18:53 +00:00
fixincludes Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
gcc lto: Fix option merging [PR106129] 2022-07-27 11:23:45 +02:00
gnattools Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
gotools Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
include Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
intl Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libada Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libatomic Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libbacktrace Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libcc1 Daily bump. 2022-07-03 00:19:11 +00:00
libcody Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libcpp Daily bump. 2022-05-31 00:19:02 +00:00
libdecnumber Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libffi Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libgcc Daily bump. 2022-05-17 00:18:54 +00:00
libgfortran Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libgo libgo: don't include <linux/fs.h> when building gen-sysinfo.go 2022-07-21 13:39:43 +02:00
libgomp Daily bump. 2022-06-29 00:19:26 +00:00
libiberty Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libitm Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libobjc Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
liboffloadmic Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libphobos Daily bump. 2022-07-27 00:19:35 +00:00
libquadmath Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libsanitizer libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream 2022-07-21 13:38:10 +02:00
libssp Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
libstdc++-v3 Daily bump. 2022-07-27 00:19:35 +00:00
libvtv Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
lto-plugin Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
maintainer-scripts Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
zlib Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
.dir-locals.el dir-locals: Use https for bug references 2021-07-20 11:40:34 +01:00
.gitattributes Add *.md diff=md. 2020-01-15 14:29:53 +01:00
.gitignore Add cscope.out to git ignore. 2021-06-24 16:51:40 +05:30
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Update ChangeLog and version files for release 2022-05-06 07:07:53 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS: Update my email address. 2022-04-19 10:29:15 -07:00
Makefile.def toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.in toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.tpl Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
README
ar-lib
compile
config-ml.in config-ml.in: Suppress output from multi-do recipes 2020-11-09 14:28:37 +00:00
config.guess config.sub, config.guess : Import upstream 2021-01-25. 2021-02-23 17:21:10 +08:00
config.rpath
config.sub config.sub: change mode to 755. 2021-12-21 09:10:57 +01:00
configure LoongArch Port: Regenerate configure 2022-03-29 17:43:32 +08:00
configure.ac LoongArch Port: Regenerate configure 2022-03-29 17:43:32 +08:00
depcomp
install-sh
libtool-ldflags
libtool.m4 Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
ltgcc.m4
ltmain.sh Do not use HAVE_DOS_BASED_FILE_SYSTEM for Cygwin. 2020-04-17 09:22:51 +02:00
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
symlink-tree
test-driver
ylwrap

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.