Commit Graph

139 Commits

Author SHA1 Message Date
Pedro F. Giffuni
8bc5011859 Align text correctly by using tabs instead of spaces.
The text was copy-pasted from the lines that carry the bogus spaces.
This is a non-functional change.
2017-05-27 20:01:50 +00:00
Pedro F. Giffuni
3a17f73727 Bring some rough support for FreeBSD S/390 to the GNU toolchain.
This is no-op and only for reference: the S/390 port seems to be elusive
in the BSDs so it is convenient to keep some trace from past efforts.
It is likely newer attempts will focus on a newer toolchain using clang
instead.

Obtained from:	Perforce depot/projects/s390
2017-05-23 16:38:10 +00:00
Ed Maste
bd4e40546c use INT3 instead of NOP for x86 binary padding
We should never end up executing the inter-function padding, so we
are better off faulting than silently carrying on to whatever function
happens to be next.

Note that LLD will soon do this by default (although it currently pads
with zeros).

Reviewed by:	dim, kib
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10047
2017-03-19 00:22:13 +00:00
Baptiste Daroussin
1d0f6813ac Remove pregenerated text version of the texinfo documentation 2015-03-02 17:25:03 +00:00
Baptiste Daroussin
7bb36fb551 Generate manpage out of the texinfo files using texi2mdoc 2015-03-02 17:20:34 +00:00
Tijl Coosemans
99e1a2bc3a Fix ldscripts such that ld(1) collects the .fini_array section in the same
order as the .init_array section.  Finalisation routines need to be called
in the opposite order as their corresponding initialisation routines but
rtld(1) handles that by calling the function pointers in .fini_array in
reverse order.

Reviewed by:	kib
MFC after:	2 weeks
2015-02-11 17:25:23 +00:00
Baptiste Daroussin
bbb0fbde9a Add pregenerated documentation for as(1) and ld(1) 2015-01-04 00:58:30 +00:00
Baptiste Daroussin
4a3e081c7b Fix generating documentation with modern texinfo 2015-01-04 00:54:29 +00:00
Baptiste Daroussin
c04c768107 Implement --no-fatal-warning for compatibility with newer ld
what ever order the options are passed to ld(1) the --no-fatal-warning always
disable --fatal-warning
2014-11-29 11:50:19 +00:00
Baptiste Daroussin
66c8095956 Rename elf*-powerpc into elf*-powerpc-freebsd in binutils
The powerpc support was the only supported architecture not prepending the elf format name
with "-freebsd" in base this change makes it consistent with other architectures.
On newer version of binutils the powerpc format is also prepended with "-freebsd".

Also modify the kernel ldscripts in that regards.

As a result it is now possible cross build the kernel on powerpc using newer binutils

Differential Revision:	https://reviews.freebsd.org/D926
Differential Revision:	https://reviews.freebsd.org/D928
2014-10-10 06:24:09 +00:00
Tijl Coosemans
caf5f7a84c In r253839 the default behaviour of ld(1) was changed such that all
libraries that need to be linked into an executable or library have to be
listed on the command line explicitly.  This commit fixes a bug in ld(1)
where it would scan dependencies of the libraries on the command line and
link them if needed if they were also found in ld.so.cache.

The important bit of the patch is the initialisation of needed.by such that
libraries found by scanning dependencies are marked as such and not used in
the link.

The patch is a backport of binutils git commit
d5c8b1f8561426b41aa5330ed60f578178fe6be2

The author gave permission to use it under GPLv2 terms.

PR:		192062
Exp-run by:	antoine
MFC after:	1 week
2014-08-28 18:33:42 +00:00
Baptiste Daroussin
0fd8fddb96 Change default behaviour of ld(1) to not recursively copy DT_NEEDED
This is the default behaviour of the newer binutils as well as most alternative linkers.
All the ports tree has been fixed to be able to link properly with this new behaviour.
2013-07-31 12:35:06 +00:00
Jung-uk Kim
a7880d59c9 Improve compatibility with recent flex from flex.sourceforge.net. 2013-05-03 23:51:32 +00:00
Dimitry Andric
400b97c789 Revert r234656, and apply a proper fix for binutils PR 10474, which
caused linking clang on 32-bit PowerPC to fail with "relocation
truncated to fit: R_PPC_REL24" errors.

Original diffs (relicensed under GPLv2 with permission from author):
http://sourceware.org/git/?p=binutils.git;a=commit;h=1fd262ff7d7ea5adf4894c6b960e092e7e43e3cd
http://sourceware.org/git/?p=binutils.git;a=commit;h=053c49fbff58bd33bd0d12200ea61302f92caceb

Tested by:	andreast
MFC after:	1 week
2012-05-07 17:13:36 +00:00
Andreas Tobler
6bac4c3e6a Rename the linker emulation name for powerpc and powerc64. This is needed that
we can also use the upstream binutils linker where we have to have a unique
name for the FreeBSD emulation.
2011-11-19 19:25:57 +00:00
Ben Laurie
5f301949ef Fix clang warnings.
Approved by:	philip (mentor)
2011-06-18 13:56:33 +00:00
Jayachandran C.
d38ea3bc9e Add .interp back into INITIAL_READONLY_SECTIONS in MIPS n64 ABI.
The binutils update in r218822 caused the MIPS n64 dynamic binaries to
fail because the ".interp" section is not in the initial sections.
This happens because elf64bmip-defs.sh overrides INITIAL_READONLY_SECTIONS
to add ".MIPS.options" sections instead of the ".reginfo" section used
by n32.
This used to work fine, but after r218822, INITIAL_READONLY_SECTIONS also
contains the .interp section, so the override has to be done differently.

Reported by : aduane at juniper

Obtained from:	gonzo (Initial version)
2011-06-01 10:23:03 +00:00
Ben Laurie
4e85454a79 Fix clang warnings.
Approved by:	philip (mentor)
2011-05-22 22:16:19 +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
Konstantin Belousov
434efabd4c On PowerPC64, linker emits a fake object into each linked object,
'linker stubs'. Add .note.GNU-stack for the stubs objects. Without this,
final binary will have RWE mode for PT_GNU_STACK regardless of the
actual requirements.

Tested by:	nwhitehorn
Reviewed by:	dim, nwhitehorn
2011-01-14 11:28:34 +00:00
Konstantin Belousov
f1a143ca96 Add a workaround for the warnings and sometimes errors due to missed
forward-declaration.

Reviewed by:	dim
2011-01-14 11:25:11 +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
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
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
ae10dec363 Apply commit d3a5e914c6ff07c426b026b0cda8d044fd1cdabe from upstream
(still under GPLv2 at that time):

Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Aug 24 14:59:24 2006 +0000

* ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
  Adjust the current address of DEFAULT_MEMORY_REGION even when dot
  hasn't changed.

This is a prerequisite for the fix coming just after this.
2010-10-25 19:33:45 +00:00
Dimitry Andric
dc9aea6cc4 Reapply change from r210245. In binutils 2.17, the code in question has
moved from ld/emultempl/elf32.em to ld/ldlang.c, so apply approximately
the same change as upstream, which has description:

* ldlang.c (lang_insert_orphan): Add __start_<section> symbol assignment
  inside output section statement.  Ensure only one set of symbols per
  output section.
* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Add non-dollar
  sections before dollar sections.  Correct add_child list insertion.

Taken from upstream git commit 7e01d69a19a8fd079887f26853c8565da15ff340,
with permission to use it under GPLv2 from the author.
2010-10-21 19:27:27 +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
Andriy Gapon
517d9fc653 binutils/ld: fix incorrect placement of __start_SECNAME in some cases
__start_SECNAME and __stop_SECNAME symbols are automatically generated
by ld for orphan sections, i.e. those not explicitely referenced by a
linker script.  The symbols are supposed to be placed correspondingly
at the start and the end of the section in output file.  In some cases
__start_SECNAME may be placed at the address after the end of the
previous section (if any) and before the start the section.  This
happens when following conditions are met:
1. the orphan section is found in more than one input file
2. the orphan section has different alignment requirements across input
files
3. the first instance of the section encountered doesn't have the
greatest alignment requirement
In these conditions resulting output section will be placed at address
after the end of the previous section aligned to the greatest alignment
requirement in the inputs, but __start_SECNAME will be placed at address
after the end of the previous section aligned to the alignment
requirement of the first input in which the section is encountered.

See commit message of r196118 for a concrete example of problems caused
by this bug.

The fix is to place __start_SECNAME inside the section and use ABSOLUTE
directive, rather than placing __start_SECNAME outside the section and
trying to guess address alignment.

This fix is in line with upstream binutils change/fix made between
versions 2.19 and 2.20 in revision of 1.307 ldlang.c.

MFC after:	3 weeks
2010-07-19 18:20:44 +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
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
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
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
a7c7527613 Merge rev 1.2 (teach `ld' how to access FreeBSD's ld ELF hints) into
Binutils 2.15.
2004-06-16 06:09:06 +00:00
David E. O'Brien
56f1abf2e4 Merge rev 1.2 (FreeBSD a.out configuration support) into Binutils 2.15. 2004-06-16 06:03:34 +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
18dcca33ad Things that never should have been imported. 2003-03-02 19:10:30 +00:00
David E. O'Brien
78ffae804d This commit was generated by cvs2svn to compensate for changes in r111756,
which included commits to RCS files with non-trunk default branches.
2003-03-02 19:10:30 +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
fc91886f96 Merge rev 1.2 (teach `ld' how to access FreeBSD's ld ELF hints)
into the Binutils 2.13.2 20021128 snap.
2002-12-02 09:31:42 +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