Commit Graph

143 Commits

Author SHA1 Message Date
Marius Strobl
b5eb05bb72 In the upstream rev. 1.61 of elf64-sparc.c the following bug was fixed:
* elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of
        dynamic relocs against section symbols for the output section vma.

However, with the addition of TLS support in the upstream rev. 1.104
this fix was essentially reverted. After factoring out the common parts
of elf32-sparc.c and elf64-sparc.c a comment was added to elfxx-sparc.c
in the upstream rev. 1.27 as part of unrelated changes, saying that the
fix from elf64-sparc.c rev. 1.61 indeed should be implemented, but given
that some unspecified OS has a broken ld.so expecting broken relocations
deliberately is omitted.
As the current behavior actually violates the SPARC ABI, FreeBSD never
had such a broken ld.so and this is actually causing problems with at
least kernel modules linked with binutils 2.17.50 committed in r218822
without the workaround committed in r219340 in place, re-implement the
above fix in a way so that is only applied if the output format is
ELFOSABI_FREEBSD. In the upstream version it probably would make sense
to invert this check and only skip adjusting the addend for the OS with
the broken ld.so, once it's determine which one that is.

Approved by:	dim
2011-03-11 20:00:38 +00:00
Dimitry Andric
ce8fb93178 Merge binutils 2.17.50 to head. This brings a number of improvements to
x86 CPU support, better support for powerpc64, some new directives, and
many other things.  Bump __FreeBSD_version, and add a note to UPDATING.

Thanks to the many people that have helped to test this.

Obtained from:	projects/binutils-2.17
2011-02-18 20:54:12 +00:00
Nathan Whitehorn
aa2526259b Try a more generic version of the last two fixes. Assuming this is correct,
it should also be MI. The problem here arises when ld ends up linking a
link-once section with relocations against sections that point back to it
that are as yet unresolved. Instead of piecemeal finding sections we
think are potentially subject to this issue, just defer processing for
sections that have yet to be relocated instead of immediately bailing.
2010-12-07 23:44:07 +00:00
Nathan Whitehorn
215d29a201 Fix another .got references-in-linkonce-sections issue with C++. There are
remaining issues here, and a more general solution is probably called for.

Submitted by:	Jakob van Santen <vansanten@wisc.edu>
2010-12-07 23:14:00 +00:00
Dimitry Andric
e3c77b8170 For ia64, add a proper 'elf64-ia64-freebsd' output format to BFD, so the
ELF branding for FreeBSD is done in the same way as amd64, i386 and
sparc.  Something similar should probably also be done for arm, mips and
powerpc.
2010-12-05 20:24:22 +00:00
Dimitry Andric
a35d3535ee Sync: merge r215464 through r215708 from ^/head. 2010-11-22 20:52:18 +00:00
Attilio Rao
7f08176ee8 Add the ability for GDB to printout the thread name along with other
thread specific informations.

In order to do that, and in order to avoid KBI breakage with existing
infrastructure the following semantic is implemented:
- For live programs, a new member to the PT_LWPINFO is added (pl_tdname)
- For cores, a new ELF note is added (NT_THRMISC) that can be used for
  storing thread specific, miscellaneous, informations. Right now it is
  just popluated with a thread name.

GDB, then, retrieves the correct informations from the corefile via the
BFD interface, as it groks the ELF notes and create appropriate
pseudo-sections.

Sponsored by:	Sandvine Incorporated
Tested by:	gianni
Discussed with:	dim, kan, kib
MFC after:	2 weeks
2010-11-22 14:42:13 +00:00
Dimitry Andric
c6d2d1b4ac Sync: merge r215189 through r215272 from ^/head. 2010-11-14 01:06:10 +00:00
Warner Losh
e07bbfac01 Default to little endian output when building for little endian. This
got lost as a result of a mismerge a few months back and I didn't
notice until I collapsed tbemd into -head.

Submitted by:	similar patch by kan@
2010-11-13 20:30:24 +00:00
Dimitry Andric
1170f3d12e Sync: merge r214895 through r215140 from ^/head. 2010-11-11 20:52:24 +00:00
Colin Percival
4a56bb2033 Zero the buffer containing the .gnu_debuglink section before writing
into it.  Prior to this commit the .gnu_debuglink section can have up
to 3 bytes of uninitialized garbage; as a result, .ko files could
change vary between builds.

Approved by:	dim
MFC after:	7 days
2010-11-11 00:29:19 +00:00
Oleksandr Tymoshenko
da6dbae49c Prevent endless loop by detecting broken MIPS.options 2010-11-07 20:44:46 +00:00
Dimitry Andric
8aa660204b Backport a fix for binutils PR7093, which caused segfaults in ld
targeting arm, when attempting to create object files from arbitrary
binary file (e.g. firmware blobs).
2010-11-03 16:46:05 +00:00
Dimitry Andric
97d40d3d4a Merge ^/vendor/binutils/dist@214571 into contrib/binutils, which brings
us up to version 2.17.50.20070703, at the last GPLv2 commit.

Amongst others, this added upstream support for some FreeBSD-specific
things that we previously had to manually hack in, such as the OSABI
label support, and so on.

There are also quite a number of new files, some for cpu's (e.g. SPU)
that we may or may not be interested in, but those can be cleaned up
later on, if needed.
2010-11-01 19:35:33 +00:00
Nathan Whitehorn
0a0025449d Fix a manifestation of GCC bug 16625 that caused ld >= 2.17 to fail on
64-bit PowerPC when linking multiple C++ files referencing the same
method, defined in a common header, when that method had a switch
statement with more than 4 cases. This change fixes compilation of LLVM
tblgen on 64-bit PPC with binutils 2.17.

Lots of help from:	dim
Upstream after:		more testing
2010-10-25 21:49:59 +00:00
Dimitry Andric
e208fc20ab Apply commit f6c8fecc6fe3d5532691867a7f27820bb1c426a9 from upstream
(still under GPLv2 at that time):

Author: H.J. Lu <hjl@lucon.org>
Date:   Wed Sep 27 04:18:16 2006 +0000

PR ld/3223
PR ld/3267
* bfd/elf.c (assign_file_positions_for_non_load_sections): Don't warn
  zero size allocated sections.
* ld/ldlang.h (lang_output_section_statement_type): Add
  section_relative_symbol.
* ld/ldlang.c (strip_excluded_output_sections): Don't strip a section
  with a symbol relative to it.
  (lang_size_sections_1): Mark if an output section has a symbol symbol
  relative to it.

This prevents warnings like the following during stripping of debug info
from kernel modules on i386:

===> zlib (all)
...
objcopy --only-keep-debug zlib.ko.debug zlib.ko.symbols
objcopy --strip-debug --add-gnu-debuglink=zlib.ko.symbols zlib.ko.debug zlib.ko
BFD: zlib.ko: warning: allocated section `.plt' not in segment
BFD: zlib.ko: warning: allocated section `.got' not in segment
2010-10-25 19:43:22 +00:00
Dimitry Andric
9be9d08fde Make contrib/binutils/bfd/coff-x86_64.c compile without warnings. 2010-10-22 18:06:58 +00:00
Dimitry Andric
dfd2f2d4bb Merge ^vendor/binutils/dist@214082 into contrib/binutils. 2010-10-21 19:11:14 +00:00
Dimitry Andric
c9a933bd0b Merge ^vendor/binutils/dist@214033 into contrib/binutils.
The change made to bfd/elf.c in upstream revision 1.217.4.3 (which was a
revert of an earlier change), caused objcopy on powerpc to fail to copy
debug info from kernel modules.  This had to be fixed by applying the
diff from upstream revision 1.243 on top of it.
2010-10-19 20:14:32 +00:00
Dimitry Andric
d1728c43cb Merge ^vendor/binutils/dist@213996 into contrib/binutils. Skip adding
any files we do not need, delete some files that were removed upstream,
but keep our own customizations and backports from later binutils.
2010-10-18 20:57:43 +00:00
Rui Paulo
c5c0eabc00 Add support for the BFD target efi-app-x86_64.
This uses only GPL2 source code and is a requirement for a 64 bit EFI
boot loader.
2010-09-29 14:41:03 +00:00
Nathan Whitehorn
2cf64c8006 Teach our toolchain how to generate 64-bit PowerPC binaries. This fixes
a variety of bugs in binutils related to handling of 64-bit PPC ELF,
provides a GCC configuration for 64-bit PowerPC on FreeBSD, and
associated build systems tweaks.

Obtained from:	projects/ppc64
2010-07-10 02:29:22 +00:00
Juli Mallett
5619a3e4bf Add/improve mips64r2, Octeon, n32 and n64 support in the toolchain.
o) Add TARGET_ABI to the MIPS toolchain build process.  This sets the default
   ABI to one of o32, n32 or n64.  If it is not set, o32 is assumed as that is
   the current default.
o) Set the default GCC cpu type to any specified TARGET_CPUTYPE.  This is
   necessary to have a working "cc" if e.g. mips64 is specified, as binutils
   will refuse to link objects using different ISAs in some cases.
o) Add support for n32 and n64 ABIs to binutils and GCC.
o) Add additional required libgcc2 stubs for n32 and n64.
o) Add support for the "mips64r2" architecture to GCC.  Add the "octeon"
o) When static linking, wrap default libraries in --start-group and
   --end-group.  This is required for static linking to work on n64 with the
   interdependencies between libraries there.  This is what other OSes that
   support n64 seem to do, as well.
o) Fix our GCC spec to define __mips64 for 64-bit targets, not __mips64__, the
   former being what libgcc, etc., check and the latter seemingly being a
   misspelling of a hand merge from a Linux spec.
o) When no TARGET_CPUTYPE is specified at build time, make GCC take the default
   ISA from the ABI.  Our old defaults were too liberal and assumed that 64-bit
   ABIs should default to the MIPS64 ISA and that 32-bit ABIs should default to
   the MIPS32 ISA, when we are supporting or will support some systems based on
   earlier 32-bit and 64-bit ISAs, most notably MIPS-III.
o) Merge a new opcode file (and support code) from a later version of binutils
   and add flags and code necessary to support Octeon-specific instructions.
   This should also make merging opcodes for other modern architectures easier.

Reviewed by:	imp
2010-06-02 11:06:03 +00:00
Warner Losh
8a07366ec2 Add armeb-*-freebsd* to the list of known architectures. This is like
arm-*-freebsd*, except it defaults to big endian builds instead of
little endian builds.
2010-04-14 19:03:27 +00:00
David E. O'Brien
f51ee0a16d Rename vendor/binutils/*/contrib to vendor/binutils/*/x
Binutils has a "contrib" subdirectory - thus flattening cannot happen
without renaming the upper level contrib directory in a first pass.

Also, don't record this move and remove any keyword expansion.
2009-01-19 17:25:17 +00:00
Warner Losh
d9964624bd Push mips support into the tree. 2008-12-11 08:22:20 +00:00
David E. O'Brien
bd7d47734a Bring these back to HEAD.
(I thought ncvs@ had rm'ed these MIPS files a long time ago... SVN had
better work out - else 7 more files off the vendor branch.)
2008-05-29 02:43:05 +00:00
David E. O'Brien
b7e4108c6b Import of Binutils from the FSF 2.15 branch (just post-.0 release).
These bits are taken from the FSF anoncvs repo on 23-May-2004 04:41:00 UTC.
2008-05-29 02:29:59 +00:00
David E. O'Brien
de582f44b4 This commit was generated by cvs2svn to compensate for changes in r179404,
which included commits to RCS files with non-trunk default branches.
2008-05-29 02:29:59 +00:00
Marius Strobl
2ce641c5c4 * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): When linking a
non-shared object, do not reserve space in .plt and .rela.plt
for regular symbols neither defined nor referenced in shared objects.

This is a backport of rev. 1.101 (sourceware.org repository) to
Binutils 2.15 which fixes the creation of bogus relocations in the
PLT of Firefox and Thunderbird binaries and which in turn caused
them to segfault in rtld(1). This is committed to the vendor branch
as it doesn't represent a local change but the original vendor fix
is from after elf_link_hash_flags was replaced with bitfields.

PR:		sparc64/89486
Approved by:	maintainer timeout
Obtained from:	NetBSD
MFC after:	1 week
2006-06-08 13:10:51 +00:00
Marius Strobl
ef75316994 This commit was generated by cvs2svn to compensate for changes in r159399,
which included commits to RCS files with non-trunk default branches.
2006-06-08 13:10:51 +00:00
David E. O'Brien
e74f71ff7f Import of Binutils from the FSF 2.15 branch (just post-.0 release).
These bits are taken from the FSF anoncvs repo on 23-May-2004 04:41:00 UTC.
2004-07-06 19:16:23 +00:00
David E. O'Brien
3cc52aa5e0 This commit was generated by cvs2svn to compensate for changes in r131722,
which included commits to RCS files with non-trunk default branches.
2004-07-06 19:16:23 +00:00
David E. O'Brien
6c81463f56 Update HEAD with the stock binutils_2_15_20040523 file. 2004-06-16 06:55:49 +00:00
David E. O'Brien
b543ed2b74 Merge rev 1.2 (configuration changes to support FreeBSD) into Binutils 2.15. 2004-06-16 06:13:06 +00:00
David E. O'Brien
3358ced985 Merge our ELF branding into Binutils 2.15. 2004-06-16 06:02:14 +00:00
David E. O'Brien
da03bc7002 Import of Binutils from the FSF 2.15 branch (just post-.0 release).
These bits are taken from the FSF anoncvs repo on 23-May-2004 04:41:00 UTC.
2004-06-16 05:45:41 +00:00
David E. O'Brien
ad6e3f2b73 This commit was generated by cvs2svn to compensate for changes in r130561,
which included commits to RCS files with non-trunk default branches.
2004-06-16 05:45:41 +00:00
David E. O'Brien
34d258e905 From FSF Binutils CVS repo:
2003-04-09  Richard Henderson  <rth@redhat.com>
	* elf64-alpha.c (elf64_alpha_relocate_section) <R_ALPHA_GPREL32>:
	Ignore relocations against r_symndx == 0.

Requested by:	kris,re(scottl)
2003-05-28 03:32:33 +00:00
David E. O'Brien
7f158db49d Junk that never should have gotten imported. 2003-03-02 19:01:31 +00:00
David E. O'Brien
a46000f2ca Update HEAD with the stock files. 2002-12-02 09:39:02 +00:00
David E. O'Brien
332649695e Remove our custom ELF branding -- we have moved to our own ELF vectors
that DTRT.
2002-12-02 09:22:58 +00:00
David E. O'Brien
702c8f15ef Merge our ELF branding into Binutils 2_13_2_20021127 snapshot. 2002-12-02 09:17:49 +00:00
David E. O'Brien
ca88f70eac GC some stuff I thought was long gone. 2002-12-02 09:14:25 +00:00
David E. O'Brien
898696a8b3 Import of Binutils from the FSF 2.13 branch (just pre-.2 release).
These bits are taken from the FSF anoncvs repo on 27-Oct-2002 21:12:00 EST.
2002-12-02 09:06:04 +00:00
David E. O'Brien
6c3a332e94 This commit was generated by cvs2svn to compensate for changes in r107492,
which included commits to RCS files with non-trunk default branches.
2002-12-02 09:06:04 +00:00
David E. O'Brien
e4c6a19966 Try to keep CVS from pissing over the next binutils import by returning
to purely stock files.
2002-12-02 08:42:08 +00:00
David E. O'Brien
0320623115 Import of Binutils from the FSF 2.13 branch (just pre-.1 release).
These bits are taken from the FSF anoncvs repo on 11-Oct-2002 22:39:35 PDT.
2002-10-11 09:15:11 +00:00
David E. O'Brien
a77c19c987 This commit was generated by cvs2svn to compensate for changes in r104871,
which included commits to RCS files with non-trunk default branches.
2002-10-11 09:15:11 +00:00
David E. O'Brien
a85f4d8e6e We use the stock version of this file. 2002-10-11 06:11:27 +00:00