many_sections_r_test: many_sections_r_test.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
+check_SCRIPTS += file_in_many_sections_test.sh
+check_DATA += file_in_many_sections.stdout
+MOSTLYCLEANFILES += file_in_many_sections
+file_in_many_sections.o: file_in_many_sections.c many_sections_define.h
+ $(COMPILE) -c -fdata-sections -o $@ $(srcdir)/file_in_many_sections.c
+file_in_many_sections: file_in_many_sections.o gcctestdir/ld
+ $(LINK) -Bgcctestdir/ file_in_many_sections.o -Wl,--gc-sections
+file_in_many_sections.stdout: file_in_many_sections
+ $(TEST_READELF) -s $< > $@
+
check_PROGRAMS += initpri1
initpri1_SOURCES = initpri1.c
initpri1_DEPENDENCIES = gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_check.h
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_41 = many_sections_define.h \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_check.h \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ file_in_many_sections \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ missing_key_func.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ alt/thin_archive_test_2.o \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ alt/thin_archive_test_4.o \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ alt/libthin2.a alt/libthin4.a
-@GCC_FALSE@initpri1_DEPENDENCIES =
-@NATIVE_LINKER_FALSE@initpri1_DEPENDENCIES =
-@GCC_FALSE@initpri2_DEPENDENCIES =
-@NATIVE_LINKER_FALSE@initpri2_DEPENDENCIES =
-@GCC_FALSE@initpri3a_DEPENDENCIES =
-@NATIVE_LINKER_FALSE@initpri3a_DEPENDENCIES =
# This test fails on targets not using .ctors and .dtors sections (e.g. ARM
# EABI). Given that gcc is moving towards using .init_array in all cases,
# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
# and --dynamic-list-cpp-typeinfo
-@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_42 = debug_msg.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ missing_key_func.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_42 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ file_in_many_sections_test.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg.sh missing_key_func.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.sh pr18689.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_1.sh ver_test_2.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.sh ver_test_5.sh \
# This version won't be runnable, because there is no way to put the
# PT_PHDR segment at file offset 0. We just make sure that we can
# build it without error.
-@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_43 = debug_msg.err \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_43 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ file_in_many_sections.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ missing_key_func.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug_gabi.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_9.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_14.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ dynamic_list.stdout
+@GCC_FALSE@initpri1_DEPENDENCIES =
+@NATIVE_LINKER_FALSE@initpri1_DEPENDENCIES =
+@GCC_FALSE@initpri2_DEPENDENCIES =
+@NATIVE_LINKER_FALSE@initpri2_DEPENDENCIES =
+@GCC_FALSE@initpri3a_DEPENDENCIES =
+@NATIVE_LINKER_FALSE@initpri3a_DEPENDENCIES =
@GCC_FALSE@script_test_1_DEPENDENCIES =
@NATIVE_LINKER_FALSE@script_test_1_DEPENDENCIES =
@GCC_FALSE@script_test_2_DEPENDENCIES =
@p='x32_overflow_pc32.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
i386_mov_to_lea.sh.log: i386_mov_to_lea.sh
@p='i386_mov_to_lea.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+file_in_many_sections_test.sh.log: file_in_many_sections_test.sh
+ @p='file_in_many_sections_test.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
debug_msg.sh.log: debug_msg.sh
@p='debug_msg.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
missing_key_func.sh.log: missing_key_func.sh
@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -r -o $@ many_sections_test.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@many_sections_r_test: many_sections_r_test.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@file_in_many_sections.o: file_in_many_sections.c many_sections_define.h
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -fdata-sections -o $@ $(srcdir)/file_in_many_sections.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@file_in_many_sections: file_in_many_sections.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ file_in_many_sections.o -Wl,--gc-sections
+@GCC_TRUE@@NATIVE_LINKER_TRUE@file_in_many_sections.stdout: file_in_many_sections
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -s $< > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@debug_msg.o: debug_msg.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@odr_violation1.o: odr_violation1.cc
--- /dev/null
+// file_in_many_sections.c -- test STT_FILE when more than 64k sections
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+// Written by Tristan Gingold <gingold@adacore.com>
+
+// This file is part of gold.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+
+// 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.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+// MA 02110-1301, USA.
+
+// This program tests having many sections. It uses a generated .h
+// files to define 70,000 variables, each in a different section. It
+// uses another generated .h file to verify that they all have the
+// right value.
+
+#include "many_sections_define.h"
+
+int
+main (void)
+{
+ return 0;
+}
--- /dev/null
+#!/bin/sh
+
+# file_in_many_sections.sh -- test
+
+# Copyright (C) 2016 Free Software Foundation, Inc.
+# Written by Tristan Gingold <gingold@adacore.com>
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# The goal of this program is to verify if .text sections are grouped
+# according to prefix. .text.unlikely, .text.startup and .text.hot should
+# be grouped and placed together.
+
+set -e
+
+grep file_in_many_sections.c file_in_many_sections.stdout