binutils-gdb/gold
Cary Coutant 7c8b700c92 Fix incorrect x32 overflow checking for refs to weak undef symbols.
On x32, a pc-relative reference to an undef weak symbol (value 0)
with a negative addend (typically -4) generates a spurious overflow
error because Symbol_value::value() returns a 32-bit negative number
as an unsigned number, which gets zero-extended before subtracting
the PC value. This patch fixes the problem by special-casing the
negative addend, and adding it to the value after widening it to
64 bits. Symbol_value::value() does not need the addend if it's
negative, since it is only important when processing section
symbols for merge sections, where a positive addend provides the
input section offset of the merged constant.

gold/
	* x86_64.cc (X86_64_relocate_functions::pcrela32_check): Fix x32
	overflow checking when symbol value + addend < 0.
2016-02-07 07:49:34 -08:00
..
po Copyright update for binutils 2016-01-01 23:00:01 +10:30
testsuite Fix overflow checking for 32-bit pc-relative relocations on x32. 2016-02-06 14:47:05 -08:00
aarch64-reloc-property.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
aarch64-reloc-property.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
aarch64-reloc.def Copyright update for binutils 2016-01-01 23:00:01 +10:30
aarch64.cc [gold][aarch64] PR gold/19472 - DSOs need pc-relative stubs. 2016-01-15 17:10:04 -08:00
aclocal.m4
archive.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
archive.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
arm-reloc-property.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
arm-reloc-property.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
arm-reloc.def Copyright update for binutils 2016-01-01 23:00:01 +10:30
arm.cc Fix breakage for SHT_REL targets where get_r_addend() gives internal error. 2016-01-12 11:39:50 -08:00
attributes.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
attributes.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
binary.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
binary.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
ChangeLog Fix incorrect x32 overflow checking for refs to weak undef symbols. 2016-02-07 07:49:34 -08:00
ChangeLog-0815 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
common.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
common.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
compressed_output.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
compressed_output.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
config.in Regenerate configure in gold 2015-04-01 06:40:35 -07:00
configure Add s390 backend. 2015-10-28 16:47:27 -07:00
configure.ac Copyright update for binutils 2016-01-01 23:00:01 +10:30
configure.tgt Copyright update for binutils 2016-01-01 23:00:01 +10:30
copy-relocs.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
copy-relocs.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
cref.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
cref.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
debug.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
defstd.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
defstd.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
descriptors.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
descriptors.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
dirsearch.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
dirsearch.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
dwarf_reader.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
dwarf_reader.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
dwp.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
dwp.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
dynobj.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
dynobj.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
ehframe.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
ehframe.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
errors.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
errors.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
expression.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
ffsll.c Copyright update for binutils 2016-01-01 23:00:01 +10:30
fileread.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
fileread.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
freebsd.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
ftruncate.c Copyright update for binutils 2016-01-01 23:00:01 +10:30
gc.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
gc.h Refactor gold to enable support for MIPS-64 relocation format. 2016-01-11 18:51:18 -08:00
gdb-index.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
gdb-index.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
gold-threads.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
gold-threads.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
gold.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
gold.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
i386.cc gold: Add view and view_size parameters to is_call_to_non_split. 2016-02-06 01:52:00 +01:00
icf.cc 2016-02-05 Sriraman Tallam <tmsriram@google.com> 2016-02-05 15:07:45 -08:00
icf.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
incremental-dump.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
incremental.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
incremental.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
int_encoding.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
int_encoding.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
layout.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
layout.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
main.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
Makefile.am Copyright update for binutils 2016-01-01 23:00:01 +10:30
Makefile.in Copyright update for binutils 2016-01-01 23:00:01 +10:30
mapfile.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
mapfile.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
merge.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
merge.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
mips.cc Fix breakage for SHT_REL targets where get_r_addend() gives internal error. 2016-01-12 11:39:50 -08:00
mremap.c Copyright update for binutils 2016-01-01 23:00:01 +10:30
nacl.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
nacl.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
NEWS Copyright update for binutils 2016-01-01 23:00:01 +10:30
object.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
object.h Refactor gold to enable support for MIPS-64 relocation format. 2016-01-11 18:51:18 -08:00
options.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
options.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
output.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
output.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
parameters.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
parameters.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
plugin.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
plugin.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
powerpc.cc Fix "PowerPC64 ELFv2 entry code" for big-endian 2016-02-04 00:31:14 +10:30
pread.c Copyright update for binutils 2016-01-01 23:00:01 +10:30
README Copyright update for binutils 2016-01-01 23:00:01 +10:30
readsyms.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
readsyms.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
reduced_debug_output.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
reduced_debug_output.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
reloc-types.h Refactor gold to enable support for MIPS-64 relocation format. 2016-01-11 18:51:18 -08:00
reloc.cc gold: Add view and view_size parameters to is_call_to_non_split. 2016-02-06 01:52:00 +01:00
reloc.h Fix compile errors about shift counts too large. 2016-02-06 18:19:13 -08:00
resolve.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
s390.cc Refactor gold to enable support for MIPS-64 relocation format. 2016-01-11 18:51:18 -08:00
script-c.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
script-sections.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
script-sections.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
script.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
script.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
sparc.cc Refactor gold to enable support for MIPS-64 relocation format. 2016-01-11 18:51:18 -08:00
stringpool.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
stringpool.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
symtab.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
symtab.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
system.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
target-reloc.h Refactor gold to enable support for MIPS-64 relocation format. 2016-01-11 18:51:18 -08:00
target-select.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
target-select.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
target.cc gold: Add view and view_size parameters to is_call_to_non_split. 2016-02-06 01:52:00 +01:00
target.h gold: Add view and view_size parameters to is_call_to_non_split. 2016-02-06 01:52:00 +01:00
tilegx.cc Refactor gold to enable support for MIPS-64 relocation format. 2016-01-11 18:51:18 -08:00
timer.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
timer.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
tls.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
TODO
token.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
version.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
workqueue-internal.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
workqueue-threads.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
workqueue.cc Copyright update for binutils 2016-01-01 23:00:01 +10:30
workqueue.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
x86_64.cc Fix incorrect x32 overflow checking for refs to weak undef symbols. 2016-02-07 07:49:34 -08:00
yyscript.y Copyright update for binutils 2016-01-01 23:00:01 +10:30

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

gold is an ELF linker.  It is intended to have complete support for
ELF and to run as fast as possible on modern systems.  For normal use
it is a drop-in replacement for the older GNU linker.

gold is part of the GNU binutils.  See ../binutils/README for more
general notes, including where to send bug reports.

gold was originally developed at Google, and was contributed to the
Free Software Foundation in March 2008.  At Google it was designed by
Ian Lance Taylor, with major contributions by Cary Coutant, Craig
Silverstein, and Andrew Chatham.

The existing GNU linker manual is intended to be accurate
documentation for features which gold supports.  gold supports most of
the features of the GNU linker for ELF targets.  Notable
omissions--features of the GNU linker not currently supported in
gold--are:
  * MRI compatible linker scripts
  * cross-reference reports (--cref)
  * various other minor options


Notes on the code
=================

These are some notes which may be helpful to people working on the
source code of gold itself.

gold is written in C++.  It is a GNU program, and therefore follows
the GNU formatting standards as modified for C++.  Source documents in
order of decreasing precedence:
    http://www.gnu.org/prep/standards/
    http://gcc.gnu.org/onlinedocs/libstdc++/manual/source_code_style.html
    http://www.zembu.com/eng/procs/c++style.html

The linker is intended to have complete support for cross-compilation,
while still supporting the normal case of native linking as fast as
possible.  In order to do this, many classes are actually templates
whose parameter is the ELF file class (e.g., 32 bits or 64 bits).  The
C++ code is the same, but we don't pay the execution time cost of
always using 64-bit integers if the target is 32 bits.  Many of these
class templates also have an endianness parameter: true for
big-endian, false for little-endian.

The linker is multi-threaded.  The Task class represents a single unit
of work.  Task objects are stored on a single Workqueue object.  Tasks
communicate via Task_token objects.  Task_token objects are only
manipulated while holding the master Workqueue lock.  Relatively few
mutexes are used.


Build requirements
==================

The gold source code uses templates heavily.  Building it requires a
recent version of g++.  g++ 4.0.3 and 4.1.3 are known to work.  g++
3.2, 3.4.3, and 4.1.2 are known to fail.

The linker script parser uses features which are only in newer
versions of bison.  bison 2.3 is known to work.  bison 1.26 is known
to fail.  If you are building gold from an official binutils release,
the bison output should already be included.


Copyright (C) 2012-2016 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.