First check in

This commit is contained in:
2016-09-24 23:05:39 -05:00
commit 8d3cfe877f
6 changed files with 351 additions and 0 deletions

106
Makefile Normal file
View File

@@ -0,0 +1,106 @@
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation here:
# (http://www.gnu.org/licenses/gpl-2.0.html)
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
DEPENDS =
ARCH = x86_64
URL = https://gcc.gnu.org/
DESC = The GNU Compiler Collection includes front ends for C, C++, \
Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these \
languages (libstdc++, libgcj,...).
SNAPVER = sr0
ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1)
TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n')
SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//')
PATCHDIR := $(PWD)/SRC/patches
BUILDDIR := $(PWD)/BUILD
VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')$(SNAPVER)
MACHINE := $(gcc -dumpmachine)
MAKE = make
MAKEINST = make install
SNAPHACKS = mkdir -pv $(ROOT)/lib && \
mv -v $(ROOT)/usr/lib64/* $(ROOT)/usr/lib && \
rmdir $(ROOT)/usr/lib64 && \
ln -sfv lib $(ROOT)/usr/lib64 && \
ln -sv ../usr/bin/cpp $(ROOT)/lib/cpp && \
ln -sv gcc $(ROOT)/usr/bin/cc && \
install -v -dm755 $(ROOT)/usr/lib/bfd-plugins && \
ln -sfv ../../libexec/gcc/$(MACHINE)/$(VERSION)/liblto_plugin.so \
$(ROOT)/usr/lib/bfd-plugins && \
mkdir -pv $(ROOT)/usr/share/gdb/auto-load/usr/lib && \
mv -v $(ROOT)/usr/lib/*gdb.py $(ROOT)/usr/share/gdb/auto-load/usr/lib
include /usr/share/snap/Makefile.snaplinux
$(SRCDIR)/configure: $(ARCHIVE)
@echo "Extracting archive..."
@if [ '$(TYPE)' == 'application/x-bzip2' ]; then \
tar -jxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-gzip' ]; then \
tar -zxf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-tar' ]; then \
tar -xf $(ARCHIVE); \
elif [ '$(TYPE)' == 'application/x-xz' ]; then \
tar -xf $(ARCHIVE); \
else \
echo 'Unable to determine archive type'; \
exit 1; \
fi
@touch $(SRCDIR)/configure
$(BUILDDIR)/config.log: $(SRCDIR)/configure
@if [ ! -d $(BUILDDIR) ]; then \
mkdir -v $(BUILDDIR); \
fi
@if [ -f $(PATCHDIR)/*.patch ]; then \
cd $(SRCDIR) && cat $(PATCHDIR)/*.patch|patch --verbose -Np1; \
fi
@cd $(BUILDDIR); \
../$(SRCDIR)/configure \
--prefix=/usr \
--enable-languages=c,c++ \
--disable-multilib \
--disable-bootstrap \
--with-system-zlib \
--without-cloog \
--without-isl \
--build=x86_64-snap-linux-gnu \
--host=x86_64-snap-linux-gnu \
--target=x86_64-snap-linux-gnu
$(BUILDDIR)/gcc: $(BUILDDIR)/config.log
@cd $(BUILDDIR); \
$(MAKE)
$(ROOT): $(BUILDDIR)/gcc
@if [ -d $(ROOT) ]; then \
touch $(ROOT); \
else \
mkdir -v $(ROOT); \
fi
@cd $(BUILDDIR); \
$(MAKEINST) DESTDIR=$(ROOT)
@$(SNAPHACKS)
test: $(ROOT)
@cd $(BUILDDIR); \
make -k check
clean:
@rm -rvf $(ROOT) \
$(SNAPINFO) \
$(MANIFEST) \
$(FILES) \
$(SRCDIR) \
$(BUILDDIR)

3
SNAP/README Normal file
View File

@@ -0,0 +1,3 @@
This is the directory where the manifest, snapinfo, and files.tar.gz
files will be created. It is also where the usher file should be
placed if it is required by the package.

BIN
SRC/gcc-4.9.1.tar.bz2 Normal file

Binary file not shown.

BIN
SRC/gcc-4.9.1.tar.bz2.sig Normal file

Binary file not shown.

2
SRC/patches/README Normal file
View File

@@ -0,0 +1,2 @@
Place any patch files here and preface each with a number indicating
the order of execution. Patch files are expected to use a .patch extension.

View File

@@ -0,0 +1,240 @@
diff -rupN a/gcc/cp/decl.c b/gcc/cp/decl.c
--- a/gcc/cp/decl.c 2014-06-09 19:29:17.000000000 +0000
+++ b/gcc/cp/decl.c 2015-03-12 03:53:10.876000000 +0000
@@ -2185,6 +2185,7 @@ duplicate_decls (tree newdecl, tree oldd
olddecl);
SET_DECL_TEMPLATE_SPECIALIZATION (olddecl);
+ DECL_COMDAT (newdecl) = DECL_DECLARED_INLINE_P (newdecl);
/* Don't propagate visibility from the template to the
specialization here. We'll do that in determine_visibility if
@@ -4638,6 +4639,8 @@ start_decl (const cp_declarator *declara
if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
{
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ DECL_COMDAT (decl) = DECL_DECLARED_INLINE_P (decl);
/* [temp.expl.spec] An explicit specialization of a static data
member of a template is a definition if the declaration
@@ -7602,7 +7605,10 @@ grokfndecl (tree ctype,
/* If the declaration was declared inline, mark it as such. */
if (inlinep)
- DECL_DECLARED_INLINE_P (decl) = 1;
+ {
+ DECL_DECLARED_INLINE_P (decl) = 1;
+ DECL_COMDAT (decl) = 1;
+ }
if (inlinep & 2)
DECL_DECLARED_CONSTEXPR_P (decl) = true;
@@ -14147,6 +14153,7 @@ grokmethod (cp_decl_specifier_seq *decls
check_template_shadow (fndecl);
+ DECL_COMDAT (fndecl) = 1;
DECL_DECLARED_INLINE_P (fndecl) = 1;
DECL_NO_INLINE_WARNING_P (fndecl) = 1;
diff -rupN a/gcc/cp/decl2.c b/gcc/cp/decl2.c
--- a/gcc/cp/decl2.c 2014-04-01 17:49:38.000000000 +0000
+++ b/gcc/cp/decl2.c 2015-03-12 03:53:10.876000000 +0000
@@ -1896,6 +1896,12 @@ mark_needed (tree decl)
definition. */
struct cgraph_node *node = cgraph_get_create_node (decl);
node->forced_by_abi = true;
+
+ /* #pragma interface and -frepo code can call mark_needed for
+ maybe-in-charge 'tors; mark the clones as well. */
+ tree clone;
+ FOR_EACH_CLONE (clone, decl)
+ mark_needed (clone);
}
else if (TREE_CODE (decl) == VAR_DECL)
{
@@ -2678,17 +2684,7 @@ import_export_decl (tree decl)
{
/* The repository indicates that this entity should be defined
here. Make sure the back end honors that request. */
- if (VAR_P (decl))
- mark_needed (decl);
- else if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
- || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
- {
- tree clone;
- FOR_EACH_CLONE (clone, decl)
- mark_needed (clone);
- }
- else
- mark_needed (decl);
+ mark_needed (decl);
/* Output the definition as an ordinary strong definition. */
DECL_EXTERNAL (decl) = 0;
DECL_INTERFACE_KNOWN (decl) = 1;
diff -rupN a/gcc/cp/method.c b/gcc/cp/method.c
--- a/gcc/cp/method.c 2014-03-26 21:33:28.000000000 +0000
+++ b/gcc/cp/method.c 2015-03-12 03:53:10.876000000 +0000
@@ -1760,8 +1760,6 @@ implicitly_declare_fn (special_function_
DECL_ARGUMENTS (fn) = this_parm;
grokclassfn (type, fn, kind == sfk_destructor ? DTOR_FLAG : NO_SPECIAL);
- set_linkage_according_to_type (type, fn);
- rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
DECL_IN_AGGR_P (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
DECL_DEFAULTED_FN (fn) = 1;
@@ -1773,6 +1771,9 @@ implicitly_declare_fn (special_function_
DECL_EXTERNAL (fn) = true;
DECL_NOT_REALLY_EXTERN (fn) = 1;
DECL_DECLARED_INLINE_P (fn) = 1;
+ DECL_COMDAT (fn) = 1;
+ set_linkage_according_to_type (type, fn);
+ rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
gcc_assert (!TREE_USED (fn));
/* Restore PROCESSING_TEMPLATE_DECL. */
diff -rupN a/gcc/cp/pt.c b/gcc/cp/pt.c
--- a/gcc/cp/pt.c 2014-06-30 18:52:45.000000000 +0000
+++ b/gcc/cp/pt.c 2015-03-12 03:53:10.880000000 +0000
@@ -2783,6 +2783,9 @@ check_explicit_specialization (tree decl
It's just the name of an instantiation. But, it's not
a request for an instantiation, either. */
SET_DECL_IMPLICIT_INSTANTIATION (decl);
+ else
+ /* A specialization is not necessarily COMDAT. */
+ DECL_COMDAT (decl) = DECL_DECLARED_INLINE_P (decl);
/* Register this specialization so that we can find it
again. */
@@ -5022,6 +5025,14 @@ template arguments to %qD do not match o
DECL_TEMPLATE_INFO (decl) = info;
}
+ if (flag_implicit_templates
+ && !is_friend
+ && TREE_CODE (decl) == FUNCTION_DECL)
+ /* Set DECL_COMDAT on template instantiations; if we force
+ them to be emitted by explicit instantiation or -frepo,
+ mark_needed will tell cgraph to do the right thing. */
+ DECL_COMDAT (decl) = true;
+
return DECL_TEMPLATE_RESULT (tmpl);
}
diff -rupN a/gcc/cp/tree.c b/gcc/cp/tree.c
--- a/gcc/cp/tree.c 2014-06-30 14:25:21.000000000 +0000
+++ b/gcc/cp/tree.c 2015-03-12 03:53:10.880000000 +0000
@@ -3716,23 +3716,15 @@ decl_linkage (tree decl)
if (TREE_CODE (decl) == CONST_DECL)
return decl_linkage (TYPE_NAME (DECL_CONTEXT (decl)));
- /* Some things that are not TREE_PUBLIC have external linkage, too.
- For example, on targets that don't have weak symbols, we make all
- template instantiations have internal linkage (in the object
- file), but the symbols should still be treated as having external
- linkage from the point of view of the language. */
- if (VAR_OR_FUNCTION_DECL_P (decl)
- && DECL_COMDAT (decl))
- return lk_external;
-
/* Things in local scope do not have linkage, if they don't have
TREE_PUBLIC set. */
if (decl_function_context (decl))
return lk_none;
/* Members of the anonymous namespace also have TREE_PUBLIC unset, but
- are considered to have external linkage for language purposes. DECLs
- really meant to have internal linkage have DECL_THIS_STATIC set. */
+ are considered to have external linkage for language purposes, as do
+ template instantiations on targets without weak symbols. DECLs really
+ meant to have internal linkage have DECL_THIS_STATIC set. */
if (TREE_CODE (decl) == TYPE_DECL)
return lk_external;
if (VAR_OR_FUNCTION_DECL_P (decl))
diff -rupN a/gcc/sched-deps.c b/gcc/sched-deps.c
--- a/gcc/sched-deps.c 2014-02-05 18:42:19.000000000 +0000
+++ b/gcc/sched-deps.c 2015-03-12 03:51:08.500000000 +0000
@@ -2750,7 +2750,7 @@ sched_analyze_2 (struct deps_desc *deps,
Consider for instance a volatile asm that changes the fpu rounding
mode. An insn should not be moved across this even if it only uses
pseudo-regs because it might give an incorrectly rounded result. */
- if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
+ if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x)) && !DEBUG_INSN_P (insn))
reg_pending_barrier = TRUE_BARRIER;
/* For all ASM_OPERANDS, we must traverse the vector of input operands.
diff -rupN a/gcc/testsuite/g++.dg/abi/spec1.C b/gcc/testsuite/g++.dg/abi/spec1.C
--- a/gcc/testsuite/g++.dg/abi/spec1.C 1970-01-01 00:00:00.000000000 +0000
+++ b/gcc/testsuite/g++.dg/abi/spec1.C 2015-03-12 03:53:10.880000000 +0000
@@ -0,0 +1,4 @@
+// { dg-final { scan-assembler-not "weak" } }
+
+template <class T> struct A { static int i; };
+template<> int A<int>::i = 42;
diff -rupN a/gcc/testsuite/g++.dg/opt/devirt4.C b/gcc/testsuite/g++.dg/opt/devirt4.C
--- a/gcc/testsuite/g++.dg/opt/devirt4.C 2014-02-25 18:54:48.000000000 +0000
+++ b/gcc/testsuite/g++.dg/opt/devirt4.C 2015-03-12 03:53:10.880000000 +0000
@@ -1,8 +1,7 @@
// PR lto/53808
-// Devirtualization + inlining should produce a non-virtual
-// call to ~foo.
-// { dg-options "-O -fdevirtualize" }
-// { dg-final { scan-assembler "_ZN3fooD2Ev" } }
+// Devirtualization should not produce an external ref to ~bar.
+// { dg-options "-O2" }
+// { dg-final { scan-assembler-not "_ZN3barD0Ev" } }
struct foo {
virtual ~foo();
diff -rupN a/gcc/testsuite/g++.dg/opt/devirt5.C b/gcc/testsuite/g++.dg/opt/devirt5.C
--- a/gcc/testsuite/g++.dg/opt/devirt5.C 1970-01-01 00:00:00.000000000 +0000
+++ b/gcc/testsuite/g++.dg/opt/devirt5.C 2015-03-12 03:53:10.880000000 +0000
@@ -0,0 +1,19 @@
+// PR c++/61659
+// { dg-options "-O3" }
+// { dg-final { scan-assembler-not "_ZN6parserIiE9getOptionEv" } }
+
+struct generic_parser_base {
+ virtual void getOption();
+ void getExtraOptionNames() { getOption(); }
+};
+template <class DataType> struct parser : public generic_parser_base {
+ virtual void getOption() {}
+};
+struct PassNameParser : public parser<int> {
+ PassNameParser();
+};
+struct list {
+ PassNameParser Parser;
+ virtual void getExtraOptionNames() { return Parser.getExtraOptionNames(); }
+};
+list PassList;
diff -rupN a/gcc/testsuite/g++.dg/template/friend56.C b/gcc/testsuite/g++.dg/template/friend56.C
--- a/gcc/testsuite/g++.dg/template/friend56.C 1970-01-01 00:00:00.000000000 +0000
+++ b/gcc/testsuite/g++.dg/template/friend56.C 2015-03-12 03:53:10.880000000 +0000
@@ -0,0 +1,13 @@
+// Make sure we don't mistakenly mark f as DECL_COMDAT.
+// { dg-final { scan-assembler "_Z1fv" } }
+
+void f();
+
+template <class T> struct A
+{
+ friend void f();
+};
+
+A<int> a;
+
+void f() { }
diff -rupN a/gcc/testsuite/g++.dg/template/spec38.C b/gcc/testsuite/g++.dg/template/spec38.C
--- a/gcc/testsuite/g++.dg/template/spec38.C 1970-01-01 00:00:00.000000000 +0000
+++ b/gcc/testsuite/g++.dg/template/spec38.C 2015-03-12 03:53:10.880000000 +0000
@@ -0,0 +1,6 @@
+// PR ipa/61659
+
+// { dg-final { scan-assembler "_Z1fIiEvPT_" } }
+
+template <typename T> inline void f (T *);
+template <> void f (int *) { }