Commit Graph

102 Commits

Author SHA1 Message Date
H.J. Lu ad961eab9a gold: Support x86-64 TLS code sequences without PLT
There are extensions to x86-64 psABI:

https://groups.google.com/forum/#!topic/x86-64-abi/de5_KnLHxtI

to call tls_get_addr via GOT:

call *__tls_get_addr@GOTPCREL(%rip)

Since direct call is 4-byte long and indirect call, is 5-byte long, the
extra one byte must be handled properly.

For general dynamic model, one 0x66 prefix before call instruction is
removed to make room for indirect call.  For local dynamic model, we
simply use 5-byte indirect call.

TLS linker optimization is updated to recognize new instruction
patterns.  For local dynamic model to local exec model transition, we
generate 4 0x66 prefixes, instead of 3, before mov instruction in 64-bit
and generate a 5-byte nop, instead of 4-byte, before mov instruction in
32-bit.

	PR gold/20216
	* configure.ac (DEFAULT_TARGET_X86_64_OR_X32): New
	AM_CONDITIONAL.
	* configure: Regenerated.
	* x86_64.cc (Target_x86_64<size>::Relocate::relocate): Allow
	R_X86_64_GOTPCRELX relocation against __tls_get_addr.
	(Target_x86_64<size>::Relocate::tls_gd_to_ie): Support indirect
	call to __tls_get_addr.
	(Target_x86_64<size>::Relocate::tls_gd_to_le): Likewise.
	(Target_x86_64<size>::Relocate::tls_ld_to_le): Likewise.
	* testsuite/Makefile.am (check_PROGRAMS): Add pr20216a_test,
	pr20216b_test, pr20216c_test, pr20216d_test, pr20216e_test.
	(pr20216a_test_SOURCES): New.
	(pr20216a_test_DEPENDENCIES): Likewise.
	(pr20216a_test_CFLAGS): Likewise.
	(pr20216a_test_LDFLAGS): Likewise.
	(pr20216a_test_LDADD): Likewise.
	(pr20216b_test_SOURCES): Likewise.
	(pr20216b_test_DEPENDENCIES): Likewise.
	(pr20216b_test_CFLAGS): Likewise.
	(pr20216b_test_LDFLAGS): Likewise.
	(pr20216b_test_LDADD): Likewise.
	(pr20216c_test_SOURCES): Likewise.
	(pr20216c_test_DEPENDENCIES): Likewise.
	(pr20216c_test_CFLAGS): Likewise.
	(pr20216c_test_LDFLAGS): Likewise.
	(pr20216c_test_LDADD): Likewise.
	(pr20216d_test_SOURCES): Likewise.
	(pr20216d_test_DEPENDENCIES): Likewise.
	(pr20216d_test_CFLAGS): Likewise.
	(pr20216d_test_LDFLAGS): Likewise.
	(pr20216d_test_LDADD): Likewise.
	(pr20216e_test_SOURCES): Likewise.
	(pr20216e_test_DEPENDENCIES): Likewise.
	(pr20216e_test_CFLAGS): Likewise.
	(pr20216e_test_LDFLAGS): Likewise.
	(pr20216e_test_LDADD): Likewise.
	(pr20216a.so): Likewise.
	(pr20216b.so): Likewise.
	(pr20216_gd.o): Likewise.
	(pr20216_ld.o): Likewise.
	(MOSTLYCLEANFILES): Add pr20216a.so pr20216b.so.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/pr20216_def.c: New file.
	* testsuite/pr20216_gd.S: Likewise.
	* testsuite/pr20216_ld.S: Likewise.
	* testsuite/pr20216_main.c: Likewise.
2016-06-29 08:37:42 -07:00
H.J. Lu 6b1edb94fe gold: Add a linker configure option --enable-relro
Add a configure option --enable-relro to decide whether -z relro should
be enabled by default.  Default to yes.

	PR ld/20283
	* NEWS: Mention --enable-relro.
	* configure.ac: Add --enable-relro.
	(DEFAULT_LD_Z_RELRO): New.  Set by --enable-relro and default
	to 1.
	* config.in: Regenerated.
	* configure: Likewise.
	* options.h (General_options::relro): Default to
	DEFAULT_LD_Z_RELRO.
2016-06-22 05:39:39 -07:00
Alan Modra 6f2750feaf Copyright update for binutils 2016-01-01 23:00:01 +10:30
Marcin Kościelnicki e79a4bad70 Add s390 backend.
elfcpp/
	* s390.h: New file.

gold/
	* s390.cc: New file.
	* Makefile.am (TARGETSOURCES): Add s390.cc.
	(ALL_TARGETOBJS): Add s390.o.
	* Makefile.in: Regenerate.
	* configure.ac: Add s390 support.
	* configure: Regenerate.
	* configure.tgt: Add s390-*-* and s390x-*-*.
	* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
	support.
2015-10-28 16:47:27 -07:00
H.J. Lu 918357b955 Regenerate configure in gold
Regenerate configure for zlib.m4 change, which adds --with-system-zlib and
removes --with-zlib in gold.  zlib is enabled unconditionally with builtin
zlib imported from GCC.

	* Makefile.am (ZLIB): New.
	(ZLIBINC): Likewise.
	(AM_CFLAGS): Add $(ZLIBINC).
	(AM_CXXFLAGS): Likewise.
	(ldadd_varldadd_var): Add $(ZLIB).
	(incremental_dump_LDADD): Likewise.
	(dwp_LDADD): Likewise.
	* compressed_output.cc: Don't check HAVE_ZLIB_H to include
	<zlib.h>.
	(zlib_compress): Don't check HAVE_ZLIB_H.
	(zlib_decompress): Likewise.
	* options.h (compress_debug_sections): Likewise.
	* configure.ac (AM_CONDITIONAL): Removed.
	* testsuite/Makefile.am (ZLIB): New.
	(LDADD): Add $(ZLIB).
	Don't check HAVE_ZLIB.
	* Makefile.in: Regenerated.
	* config.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.
2015-04-01 06:40:35 -07:00
H.J. Lu be66981e16 Set GOLD_DEFAULT_SIZE to 32 for x32
* configure.ac (default_size): Set to 32 for x32.
	* configure: Regenerated.
2015-02-22 12:26:27 -08:00
H.J. Lu 4fc1b9d43c Handle stack split for x32
X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
This patch handles it.

	PR gold/17729
	* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
	(DEFAULT_TARGET_X32): Set for x32.
	* x86_64.cc (cmp_insn_32): New.
	(lea_r10_insn_32): Likewise.
	(lea_r11_insn_32): Likewise.
	(cmp_insn_64): Likewise.
	(lea_r10_insn_64): Likewise.
	(lea_r11_insn_64): Likewise.
	(Target_x86_64<size>::do_calls_non_split): Handle x32.
	* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
	(check_DATA): Add split_x32 files.
	(split_x32_[1234n].o): New targets.
	(split_x32_[124]): New targets.
	(split_x32_[1234r].stdout): New targets.
	* testsuite/split_x32.sh: New file.
	* testsuite/split_x32_1.s: Likewise.
	* testsuite/split_x32_2.s: Likewise.
	* testsuite/split_x32_3.s: Likewise.
	* testsuite/split_x32_4.s: Likewise.
	* testsuite/split_x32_n.s: Likewise.
	* configure: Regenerated.
	* testsuite/Makefile.in: Likewise.
2015-01-06 15:38:25 -08:00
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Jing Yu 053a4d680b 2014-07-02 Jing Yu <jingyu@google.com>
Initial patch to enable gold aarch64 backend.

    This patch is just a skeleton which almost does nothing.
    It does not support ILP32 now.

    gold/ChangeLog:
	* aarch64.cc: New file
	* Makefile.am (TARGETSOURCES): Add aarch64.cc
	(ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
	* Makefile.in: Regenerate.
	* configure.tgt: Add entries for aarch64*.
	* configure.ac:  Likewise.
	* configure: Likewise.

    elfcpp/ChangeLog:
	* aarch64.h: New file. New enums for aarch64-elf64 relocations.
	* elfcpp.h (EM_AARCH64, SHT_AARCH64_ATTRIBUTES, PT_AARCH64_ARCHEXT,
	PT_AARCH64_UNWIND): New enum constant.
2014-07-02 16:21:23 -07:00
Sasa Stankovic 9810d34d76 gold/
* mips.cc: New file.
	* Makefile.am (TARGETSOURCES): Add mips.cc
	(ALL_TARGETOBJS): Add mips.$(OBJEXT)
	* configure.tgt: Add entries for mips*.
	* configure.ac: Likewise.
	* Makefile.in: Regenerate.
	* configure: Likewise.
2014-06-23 12:02:10 -07:00
Cary Coutant ae447ddd12 Modify gold testsuite to disable plugins added by GCC driver.
GCC 4.8 now adds linker plugin options by default, which conflict with the
--incremental tests in the testsuite. This patch checks whether the compiler
supports the -fno-use-linker-plugin option, and adds it to all link
commands.

2014-04-02  Cary Coutant  <ccoutant@google.com>

	* configure.ac (HAVE_PUBNAMES): Use C instead of C++.
	(HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
	* configure: Regenerate.
	* testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
	-fno-use-linker-plugin.
	(LINK1, CXXLINK1): Add it to the link command.
	* testsuite/Makefile.in: Regenerate.
2014-04-02 15:04:36 -07:00
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Cary Coutant 8356f2d009 Add configure checks for <unordered_set> and <unordered_map>.
gold/
	* configure.ac: Check for <unordered_set> and <unordered_map>.
	* config.in: Regenerate.
	* configure: Regenerate.
	* system.h: Use <unordered_set> and <unordered_map> if available.
2013-12-18 15:53:31 -08:00
Cary Coutant 6632e8ccec Add check for which library is needed for dlopen.
gold/
	PR gold/16203
	* configure.ac: Add check for which library is needed for
	dlopen.
	* configure: Regenerate.
2013-11-22 15:47:18 -08:00
Cary Coutant 2500c0173e gold/
* configure.ac: Fix check for -fmerge-constants.
	* configure.ac: Regenerate.
2013-10-31 11:36:32 -07:00
Roland McGrath 13323c494d gold/
* configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
	(HAVE_PUBNAMES): Likewise.
	* configure: Regenerate.
2013-10-11 22:07:40 +00:00
Roland McGrath 2b64b5511a gold/
* configure.ac (MERGE_CONSTANTS_FLAG): New check.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
	* testsuite/merge_string_literals_2.c: Likewise.
	* testsuite/Makefile.am
	(merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
	(AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
	literal -fmerge-constants.
	* testsuite/Makefile.in: Regenerate.
2013-10-11 21:56:16 +00:00
Cary Coutant 9df9de2cca gold/
* configure.ac: Export DEFAULT_TARGET.
    	* configure: Regenerate.
    	* Makefile.in: Regenerate.
    	* testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
    	* testsuite/Makefile.in: Regenerate.
    	* testsuite/debug_msg.sh: Delete duplicate tests.
    	Don't check undef_int error message match for powerpc where the
    	source file and line number aren't available.
2013-05-13 17:35:22 +00:00
Ian Lance Taylor 0bf402d505 Fix mingw gold build with plugins enabled
* Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
	* configure.ac: Export DLOPEN_LIBS and add headers check.
	* plugin.cc: Handle non-dlfcn case.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2013-01-11 14:36:36 +00:00
H.J. Lu f2a6224b9c Properly install gold as default linker
PR gold/14897
	* configure.ac (--enable-ld): Removed.
	(install_as_default): Set to yes only for --enable-gold=default
	or --disable-ld.
	* configure: Regenerated.
2013-01-07 19:55:41 +00:00
Cary Coutant 26e4ef59d6 gold/
* configure.ac: Fix typo restoring CXXFLAGS.
	* configure: Regenerate.
2013-01-05 00:00:51 +00:00
Nick Clifton 5bf135a788 Add copyright notices 2012-12-17 16:56:12 +00:00
Ian Lance Taylor ae2eea65c6 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2012-12-07 04:28:52 +00:00
Alan Modra 0a6f1bf2f9 * configure.ac: Apply 2012-09-10 change to config.in here.
* configure: Regenerate.
2012-11-05 12:26:55 +00:00
Walter Lee 5c0b3823c6 Add support for tilegx in gold.
* configure.ac (ENABLE_GOLD): support tilegx*
	* configure: rebuild
elfcpp:
	* tilegx.h: New file.
	* elfcpp.h: add EM_TILEGX.
gold:
	* tilegx.cc: New file.
	* Makefile.am (TARGETSOURCES): Add tilegx.cc
	(ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
	* configure.tgt: Add entries for tilegx*.
	* configure.ac: Likewise.
	* Makefile.in: Rebuild.
	* configure: Likewise.
	* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
	tilegx.
2012-09-15 17:11:28 +00:00
Alan Modra 864a1b5697 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
* configure: Regenerate.
	* testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
	(plugin_final_layout.stdout): Likewise.
	(memory_test): Set page sizes to 0x1000.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/discard_locals_test.sh: Add FIXME comment.
	* testsuite/justsyms_exec.c: Disable function test for powerpc64.
	* testsuite/pr14265.t: Add .got output section statement.
	* testsuite/script_test_2.t: Likewise.
	* testsuite/script_test_3.t: Likewise.
	* testsuite/script_test_4.t: Likewise.
	* testsuite/script_test_5.t: Likewise.
	* testsuite/script_test_6.t: Likewise.
	* testsuite/script_test_7.t: Likewise.
	* testsuite/script_test_9.t: Likewise.
2012-09-05 11:01:43 +00:00
Cary Coutant f1415016b6 2012-07-18 Cary Coutant <ccoutant@google.com>
PR gold/14344
	* configure.ac: Add check for -gpubnames support.
	* configure: Regenerate.
	* testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
	support; force -gno-pubnames.
	(gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
	support.
	(gdb_index_test_4): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gdb_index_test_1.sh: Refactor code into common file.
	* testsuite/gdb_index_test_2.sh: Likewise.
	* testsuite/gdb_index_test_3.sh: Don't look for space after colon.
	* testsuite/gdb_index_test_4.sh: New script.
	* testsuite/gdb_index_test_comm.sh: New script with common code;
	don't look for space after colon.
2012-07-19 00:19:35 +00:00
Ian Lance Taylor 81c82a68dc PR gold/14309
* configure.ac: Test whether std::tr1::hash<off_t> works.
	* gold.h: Add a specialization for std::tr1::hash<off_t> if
	needed.
	* output.h (class Output_fill): Add virtual destructor.
	* configure, config.in: Rebuild.
2012-07-10 14:54:29 +00:00
Cary Coutant 7c0640fa36 gold/
* configure.ac: Add check for fallocate.
	* configure: Regenerate.
	* config.in: Regenerate.

	* options.h (class General_options): Add --mmap-output-file and
	--posix-fallocate options.
	* output.cc: (posix_fallocate): Remove; replace with...
	(gold_fallocate): New function.
	(Output_file::map_no_anonymous): Call gold_fallocate.
	(Output_file::map): Check --mmap-output-file option.
2012-06-06 22:12:47 +00:00
Nick Clifton df7b86aa4c PR 14072
* configure.in: Add check that sysdep.h has been included before
	any system header files.
	* configure: Regenerate.
	* config.in: Regenerate.
	* sysdep.h: Generate an error if included before config.h.
	* alpha-opc.c: Include sysdep.h before any other header file.
	* alpha-dis.c: Likewise.
	* avr-dis.c: Likewise.
	* cgen-opc.c: Likewise.
	* cr16-dis.c: Likewise.
	* cris-dis.c: Likewise.
	* crx-dis.c: Likewise.
	* d10v-dis.c: Likewise.
	* d10v-opc.c: Likewise.
	* d30v-dis.c: Likewise.
	* d30v-opc.c: Likewise.
	* h8500-dis.c: Likewise.
	* i370-dis.c: Likewise.
	* i370-opc.c: Likewise.
	* m10200-dis.c: Likewise.
	* m10300-dis.c: Likewise.
	* micromips-opc.c: Likewise.
	* mips-opc.c: Likewise.
	* mips61-opc.c: Likewise.
	* moxie-dis.c: Likewise.
	* or32-opc.c: Likewise.
	* pj-dis.c: Likewise.
	* ppc-dis.c: Likewise.
	* ppc-opc.c: Likewise.
	* s390-dis.c: Likewise.
	* sh-dis.c: Likewise.
	* sh64-dis.c: Likewise.
	* sparc-dis.c: Likewise.
	* sparc-opc.c: Likewise.
	* spu-dis.c: Likewise.
	* tic30-dis.c: Likewise.
	* tic54x-dis.c: Likewise.
	* tic80-dis.c: Likewise.
	* tic80-opc.c: Likewise.
	* tilegx-dis.c: Likewise.
	* tilepro-dis.c: Likewise.
	* v850-dis.c: Likewise.
	* v850-opc.c: Likewise.
	* vax-dis.c: Likewise.
	* w65-dis.c: Likewise.
	* xgate-dis.c: Likewise.
	* xtensa-dis.c: Likewise.
	* rl78-decode.opc: Likewise.
	* rl78-decode.c: Regenerate.
	* rx-decode.opc: Likewise.
	* rx-decode.c: Regenerate.

	* configure.in: Add check that sysdep.h has been included before
	any system header files.
	* configure: Regenerate.
	* config.in: Regenerate.
	* sysdep.h: Generate an error if included before config.h.

	* configure.in: Add check that sysdep.h has been included before
	any system header files.
	* configure: Regenerate.
	* config.in: Regenerate.
	* aclocal.m4: Regenerate.
	* bfd-in.h: Generate an error if included before config.h.
	* sysdep.h: Likewise.
	* bfd-in2.h: Regenerate.
	* compress.c: Remove #include "config.h".
	* plugin.c: Likewise.
	* elf32-m68hc1x.c: Include sysdep.h before alloca-conf.h.
	* elf64-hppa.c: Likewise.
	* som.c: Likewise.
	* xsymc.c: Likewise.

	* configure.in: Add check that sysdep.h has been included before
	any system header files.
	* configure: Regenerate.
	* config.in: Regenerate.

	* configure.in: Add check that sysdep.h has been included before
	any system header files.
	* configure: Regenerate.
	* config.in: Regenerate.
	* aclocal.m4: Regenerate.
	* Makefile.am: Use wrappers around C files generated by flex.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* itbl-lex-wrapper.c: New file.
	* config/bfin-lex-wrapper.c: New file.
	* cgen.c: Include as.h before setjmp.h.
	* config/tc-dlx.c: Include as.h before any other header.
	* config/tc-h8300.c: Likewise.
	* config/tc-lm32.c: Likewise.
	* config/tc-mep.c: Likewise.
	* config/tc-microblaze.c: Likewise.
	* config/tc-mmix.c: Likewise.
	* config/tc-msp430.c: Likewise.
	* config/tc-or32.c: Likewise.
	* config/tc-tic4x.c: Likewise.
	* config/tc-tic54x.c: Likewise.
	* config/tc-xtensa.c: Likewise.

	* configure.in: Add check that sysdep.h has been included before
	any system header files.
	* configure: Regenerate.
	* config.in: Regenerate.
	* unwind-ia64.h: Include config.h.
2012-05-17 15:13:28 +00:00
Roland McGrath 5879767462 binutils/
2012-04-06  Roland McGrath  <mcgrathr@google.com>

	* configure.in (AC_CHECK_HEADERS): Add locale.h.
	* config.in: Regenerate.
	* configure: Regenerate.

gas/
2012-04-06  Roland McGrath  <mcgrathr@google.com>

	* configure.in (AC_CHECK_HEADERS): Add locale.h.
	* config.in: Regenerate.
	* configure: Regenerate.

gold/
2012-04-06  Roland McGrath  <mcgrathr@google.com>

	* configure.in (AC_CHECK_HEADERS): Add locale.h.
	* config.in: Regenerate.
	* configure: Regenerate.

ld/
2012-04-06  Roland McGrath  <mcgrathr@google.com>

	* configure.in (AC_CHECK_HEADERS): Add locale.h.
	* config.in: Regenerate.
	* configure: Regenerate.
2012-04-06 16:49:02 +00:00
Nick Clifton 443507505d * configure.in (AC_CHECK_FUNCS): Add setlocale.
(AM_LC_MESSAGES): Add.
	* aclocal.m4: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
2012-04-05 08:43:41 +00:00
H.J. Lu 63887f3df5 Check if -fpic -mtls-dialect=gnu2 works
2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>

	* configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
	* configure: Regenerated.
2012-01-30 21:13:30 +00:00
H.J. Lu 24482ca057 Check if -mcmodel=medium works
2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>

	* configure.ac: Check if -mcmodel=medium works.
	* configure: Regenerated.
2012-01-27 23:23:37 +00:00
Ian Lance Taylor 3f3cddf146 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
NATIVE_LINKER.
	* Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
	* options.cc (General_options::finalize): Use library search path
	from configure script if specified.  If not native and no sysroot,
	only search TOOLLIBDIR.
	* options.h (Search_directory::Search_directory): Change name to
	const std::string&.
	(General_options::add_to_library_path_with_sysroot): Change arg to
	const std::string&.
	* configure, Makefile.in, config.in: Rebuild.
2011-11-03 04:32:01 +00:00
Ian Lance Taylor dc87f62014 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
configuration options.
	* configure: Regenerate.
	* Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2011-09-23 15:02:32 +00:00
Cary Coutant ebb300b244 * configure.ac: Check for glibc support for gnu_indirect_function
support with static linking, setting automake conditional
	IFUNC_STATIC.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

	* testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
	(ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
	for IFUNC_STATIC.
	* testsuite/Makefile.in: Regenerate.
2011-09-14 01:29:01 +00:00
Ian Lance Taylor dd7af07463 Correct last commit. 2011-07-02 00:31:35 +00:00
Ian Lance Taylor 328c7c2f68 PR gold/12525
* configure.ac: Test whether static linking works, setting
	the automake conditional HAVE_STATIC.
	* testsuite/Makefile.am: Disable tests using -static if
	HAVE_STATIC is not true.
	* configure, testsuite/Makefile.in: Rebuild.
2011-07-02 00:19:04 +00:00
Ian Lance Taylor 5393d7415a PR gold/12910
* options.h (class General_options): Add --ctors-in-init-array.
	* layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
	friends as SHT_PROGBITS for merging sections.
	(Layout::layout): Remove special handling of .init_array and
	friends.  Don't sort if doing relocatable link.  Sort for .ctors
	and .dtors if ctors_in_init_array.
	(Layout::make_output_section): Force correct section types for
	.init_array and friends.  Don't sort if doing relocatable link,
	Don't sort .ctors and .dtors if ctors_in_init_array.
	(Layout::section_name_mapping): Remove .ctors. and .dtorso.
	(Layout::output_section_name): Add relobj parameter.  Change all
	callers.  Handle .ctors. and .dtors. in code rather than table.
	Handle .ctors and .dtors if ctors_in_init_array.
	(Layout::match_file_name): New function, moved from output.cc.
	* layout.h (class Layout): Update declarations.
	* output.cc: Include "layout.h".
	(Input_section_sort_entry::get_priority): New function.
	(Input_section_sort_entry::match_file_name): Just call
	Layout::match_file_name.
	(Output_section::Input_section_sort_init_fini_compare::operator()):
	Handle .ctors and .dtors.  Sort by explicit priority rather than
	by name.
	* configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
	* testsuite/initpri2.c: New test.
	* testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
	(check_PROGRAMS): Add initpri2.
	(initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
	(initpri2_LDFLAGS, initpri2_LDADD): New variables.
	* configure, testsuite/Makefile.in: Rebuild.
2011-06-23 00:46:14 +00:00
Ian Lance Taylor 88597d3422 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
with MREMAP_MAYMOVE.
	* output.h (class Output_file): Add map_is_allocated_ field.
	* output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
	not available, provide stubs.  If mremap is not available, #define
	it to gold_mremap.
	(MREMAP_MAYMOVE): Define if not defined.
	(Output_file::Output_file): Initialize map_is_allocated_.
	(Output_file::resize): Check map_is_allocated_.
	(Output_file::map_anonymous): If mmap fails, use malloc.
	(Output_file::unmap): Don't do anything for an anonymous map.
	* fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
	is not available, provide stubs.
	(File_read::View::~View): Use free rather than delete[].
	(File_read::make_view): Use malloc rather than new[].  If mmap
	fails, use malloc.
	(File_read::find_or_make_view): Use malloc rather than new[].
	* gold.h: Remove HAVE_REMAP code.
	* mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
	exists.  Rename mremap to gold_mremap.  If mmap is not available
	don't do anything.
	* configure, config.in: Rebuild.
2011-04-12 18:06:16 +00:00
Ian Lance Taylor d0773f31b4 * configure.ac: Add check for gnu_indirect_function support in
the toolchain building binutils.
	* configure: Rebuild.
2011-03-02 14:51:42 +00:00
Nick Clifton c77912127f * configure.ac: For --enable-gold, handle value `default' instead of
`both*'.   New configure option --{en,dis}able-ld.

ld, gold/
	* configure.ac: For --enable-gold, handle value `default' instead of
	`both*'. Always install ld as ld.gold, install as ld if gold is
	the default.
2010-11-23 13:39:57 +00:00
Ian Lance Taylor eb3730490e * script-sections.h (class Script_sections): Make
Sections_elements typedef public.
	* script-sections.cc (class Sort_output_sections): Add elements_
	field.  Add constructor which sets it; change all callers.
	(Sort_output_sections::is_before): New function.
	(Sort_output_sections::operator()): Call is_before.
	* configure.ac (NATIVE_OR_CROSS_LINKER): New automake
	conditional.
	* testsuite/script_test_10.sh: New test. Test script section
	order.
	* testsuite/script_test_10.t: Likewise.
	* testsuite/script_test_10.s: Likewise.
	* testsuite/Makefile.am: Wrap the cross linker tests and the
	common tests into NATIVE_OR_CROSS_LINKER.
	(check_SCRIPTS): Add script_test_10.sh.
	(check_DATA): Add script_test_10.stdout.
	(script_test_10.o, script_test_10): New targets.
	(script_test_10.stdout): New target.
	* configure, testsuite/Makefile.in: Regenerate.
2010-10-12 19:21:41 +00:00
Ian Lance Taylor 7223e9ca5a PR 10893
* i386.cc (class Output_data_plt_i386): Update declarations.
	Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
	local_ifuncs_ fields.
	(Target_i386::do_plt_section_for_global): New function.
	(Target_i386::do_plt_section_for_local): New function.
	(Output_data_plt_i386::Output_data_plt_i386): Add symtab
	parameter; change all callers.  Initialize global_ifuncs_ and
	local_ifuncs_.  If doing a static link define __rel_iplt_start and
	__rel_iplt_end.
	(Output_data_plt_i386::add_entry): Handle IFUNC symbols.
	(Output_data_plt_i386::add_local_ifunc_entry): New function.
	(Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
	symbols.
	(Target_i386::make_plt_section): New function, broken out of
	make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
	(Target_i386::make_plt_entry): Call make_plt_section.
	(Target_i386::make_local_ifunc_plt_entry): New function.
	(Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
	(Target_i386::Scan::local): Handle IFUNC symbols.  Add
	R_386_IRELATIVE to switch.
	(Target_i386::Scan::global): Likewise.
	(Target_i386::Relocate::relocate): Likewise.
	(Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
	switch.
	* x86_64.cc (class Output_data_plt_x86_64): Update declarations.
	(Target_x86_64::do_plt_section_for_global): New function.
	(Target_x86_64::do_plt_section_for_local): New function.
	(Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
	parameter; change all callers.  If doing a static link define
	__rela_iplt_start and __rela_iplt_end.
	(Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
	(Output_data_plt_x86_64::add_local_ifunc_entry): New function.
	(Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
	to point to .plt.
	(Target_x86_64::make_local_ifunc_plt_entry): New function.
	(Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
	switch.
	(Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
	(Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
	R_X86_64_IRELATIVE to switch.
	(Target_x86_64::Scan::global): Likewise.
	(Target_x86_64::Relocate::relocate): Likewise.
	(Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
	switch.
	* target.h (class Target): Add plt_section_for_global and
	plt_section_for_local functions.  Add do_plt_section_for_global
	and do_plt_section_for_local virtual functions.
	* symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
	clarifying comments.
	(Symbol::use_plt_offset): Handle IFUNC symbol.
	* object.cc (Sized_relobj::Sized_relobj): Initialize
	local_plt_offsets_.
	(Sized_relobj::local_has_plt_offset): New function.
	(Sized_relobj::local_plt_offset): New function.
	(Sized_relobj::set_local_plt_offset): New function.
	(Sized_relobj::do_count): Handle IFUNC symbol.
	* object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
	a bit away from input_shndx_ field.  Add set_is_func_symbol and
	is_ifunc_symbol functions.
	(class Sized_relobj): Update declarations.  Remove Tls_got_entry
	and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
	local_plt_offsets_ field.
	(Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
	* output.h (class Output_section_data): Add non-const
	output_section function.
	(class Output_data_got): Update declarations.
	(class Output_data_got::Got_entry): Add use_plt_offset_ field.
	Add use_plt_offset parameter to global and local constructors.
	Change all callers.  Change local_sym_index_ field to 31 bits.
	Change GSYM_CODE and CONSTANT_CODE accordingly.
	* output.cc (Output_data_reloc_base::do_adjust_output_section): If
	doing a static link don't set sh_link field.
	(Output_data_got::Got_entry::write): Use PLT offset if
	appropriate.
	(Output_data_got::add_global_plt): New function.
	(Output_data_got::add_local_plt): New function.
	* target-reloc.h (relocate_section): Handle IFUNC symbol.
	* defstd.cc (in_section): Remove entries for __rel_iplt_start,
	__rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
	* configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
	* testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
	IFUNC conditional.
	* testsuite/ifunc-sel.h: New file.
	* testsuite/ifuncmain1.c: New file.
	* testsuite/ifuncmain1vis.c: New file.
	* testsuite/ifuncmod1.c: New file.
	* testsuite/ifuncdep2.c: New file.
	* testsuite/ifuncmain2.c: New file.
	* testsuite/ifuncmain3.c: New file.
	* testsuite/ifuncmod3.c: New file.
	* testsuite/ifuncmain4.c: New file.
	* testsuite/ifuncmain5.c: New file.
	* testsuite/ifuncmod5.c: New file.
	* testsuite/ifuncmain6pie.c: New file.
	* testsuite/ifuncmod6.c: New file.
	* testsuite/ifuncmain7.c: New file.
	* configure, testsuite/Makefile.in: Rebuild.
2010-08-19 22:50:16 +00:00
Ralf Wildenhues 6ea55b821c gold: running tests in parallel.
gold/:
* configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
2010-07-28 21:30:13 +00:00
Nick Clifton 4fda8867e9 gold:
* configure.ac (install_as_default): Define and set to false
        unless --enable-gold or --enable-gold=both/gold has been
        specified.
        * configure: Regenerate.

        * Makefile.am (install-exec-local): Install the executable as
        'ld.gold'.  If install_as_default is true then also install it as
        'ld'.
        * Makefile.in: Regenerated.
ld:
        * configure.in (install_as_default): Define and set to true
        unless --enable-gold=both/gold has been specified.
        * configure: Regenerate.

        * Makefile.am (transform): Use ld.bfd as the default name of
        the linker.
        (install-exec-local): Also install the executable as a binary
        named 'ld' if install_as_default is true.
        * Makefile.in: Regenerate.
2010-04-27 14:12:32 +00:00
Ralf Wildenhues efc8d4f25f Use Automake option no-dist in gold.
gold/:
	* configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2010-04-07 21:08:01 +00:00
Ian Lance Taylor 9109c078e3 * configure.ac: Rewrite targetobjs duplicate removal code to use
only shell constructs.
	* configure: Rebuild.
2010-02-06 20:14:01 +00:00
Doug Kwan 6cfaf60bc2 2010-02-04 Doug Kwan <dougkwan@google.com>
PR 11247
	* arm-reloc-property.cc (cstdio): Include.
	* configure.ac (targetobjs): Remove duplicates.
	* configure: Regenerate.
	* resolve.cc (Symbol_table::resolve): Explicit instantiate both
	big and little endian version for a given address size.
2010-02-05 00:30:35 +00:00