native_client/nacl-binutils.git
12 days agonacl-binutils: Provide symbols for .note.gnu.build-id section bounds master
Roland McGrath [Fri, 7 Jun 2013 19:37:53 +0000 (12:37 -0700)]
nacl-binutils: Provide symbols for .note.gnu.build-id section bounds

This causes the linker to define (if referenced) symbols
__note_gnu_build_id_start and __note_gnu_build_id_end for the bounds
of the .note.gnu.build-id section.  This makes it possible for the
program to discover its own build ID, without having ELF program
headers accessible in the runtime memory image as they are with the
next-generation linkers.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3462
TEST= toolchain trybots
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/16331012

6 weeks agoMove .note.gnu.build-id to rodata segment
Victor Khimenko [Thu, 2 May 2013 20:45:24 +0000 (00:45 +0400)]
Move .note.gnu.build-id to rodata segment

We can not have .note.gnu.build-id at the start of code segment like
in normal Linux because code segment must be validateable and must
start at 128K border.

Ideally we would like to cleanup this file more radically (or perhaps
even rewrite it from scratch), but for now let's commit minimal change
needed to support build id in NaCl.

BUG = NONE
TEST = trybots && objdump -s -j .note.gnu.build-id minimal_test_guest.nexe
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/14718010

3 months agoUse enums rather than #define's for some constants in i386-dis.c
Roland McGrath [Fri, 22 Feb 2013 17:35:39 +0000 (09:35 -0800)]
Use enums rather than #define's for some constants in i386-dis.c

This makes the file compilable by Clang, which barfs on parentheses
nested deeper than 256.  It is consistent with how the upstream
binutils was changed in later versions.

BUG= none
TEST= local builds

R=bradnelson@google.com

Review URL: https://codereview.chromium.org/12313052

11 months agoPredefine 'naclret' macro in assembler 83/26483/1 master-backup
Roland McGrath [Fri, 29 Jun 2012 20:09:11 +0000 (13:09 -0700)]
Predefine 'naclret' macro in assembler

This is a hacky way to get the effect of:
.macro naclret
pop %ecx
nacljmp %ecx
.endm
without reading it from any input file.

This will let us change assembly code to use 'naclret' instead of
the pair of a pop and nacljmp.  In the next-generation x86 gcc,
this is defined as a normal macro and does the round-up version.

17 months agoSupport --without-zlib configuration so binaries don't require libz.so
Roland McGrath [Mon, 9 Jan 2012 21:33:21 +0000 (13:33 -0800)]
Support --without-zlib configuration so binaries don't require libz.so

This is a backport of upstream changes (some already in upstream, some
pending upstream review) to fully support the --without-zlib configure
switch when building binutils.  Using this prevents compiling in the
supported for compressed DWARF sections and so avoids producing binaries
that have a runtime dependency on a libz.so.1 being installed on the system.

BUG= none
TEST= toolchain trybots

R=bradnelson@google.com

Review URL: http://codereview.chromium.org/9149014

17 months agoBackport of upstream --enable-deterministic-archives, ar/ranlib -D/-U switches
Roland McGrath [Wed, 21 Dec 2011 21:13:27 +0000 (13:13 -0800)]
Backport of upstream --enable-deterministic-archives, ar/ranlib -D/-U switches

This is a backport of my recent changes on the upstream binutils trunk.
It adds the -D switch to ranlib, same as ar's D modifier.
Then it adds -U to ar and ranlib, the converse of -D.
Then it adds --enable-deterministic-archives support to configure,
making the -D behavior the default.

This is all in service of getting bit-identical reproducible builds.
These are currently hamstrung by timestamps in .a files.

BUG= none
TEST= toolchain trybot

R=mseaborn@chromium.org,eaeltsin@google.com,khim@google.com,pasko@google.com

Review URL: http://codereview.chromium.org/8999020

20 months agoFix p_filesz generation for PT_TLS
Roland McGrath [Tue, 11 Oct 2011 16:39:40 +0000 (09:39 -0700)]
Fix p_filesz generation for PT_TLS

This cherry-picks part of upstream commit 8382de8.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2343
TEST= glibc_static_hello.nexe comes out with correct p_filesz + toolchain trybots

R=eaeltsin@google.com

Review URL: http://codereview.chromium.org/8224018

20 months agoTLS rewrite for i386 NaCl
Evgeny Eltsin [Fri, 7 Oct 2011 16:50:29 +0000 (09:50 -0700)]
TLS rewrite for i386 NaCl

Implement GD->IE,GD->LE,LD->LE transitions.
IE->LE works as is.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=237

R=pasko@google.com,khim@chromium.org,halyavin@google.com,,mcgrathr@chromium.org
TEST=

Review URL: http://codereview.chromium.org/8186010

20 months agoTLS rewrite for x86_64 NaCl
Evgeny Eltsin [Thu, 6 Oct 2011 23:29:56 +0000 (16:29 -0700)]
TLS rewrite for x86_64 NaCl

Implement GD->IE, GD->LE, LD->LE transitions.
IE->LE works as is.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=237

R=pasko@google.com,khim@chromium.org,halyavin@google.com,mcgrathr@chromium.org
TEST=

Review URL: http://codereview.chromium.org/8161011

20 months agoFix wrong format specifier in *_bfd_error_handler call
Evgeny Eltsin [Wed, 5 Oct 2011 22:17:14 +0000 (15:17 -0700)]
Fix wrong format specifier in *_bfd_error_handler call

R=halyavin@google.com,mcgrathr@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/8159002

22 months agoPut rodata at a high address by default
Roland McGrath [Mon, 1 Aug 2011 18:19:57 +0000 (11:19 -0700)]
Put rodata at a high address by default

We're going to move to the presumption that an IRT will be used.
So all links should put rodata above a gap to allow for IRT loading.

For the benefit of potential special cases, the new default behavior is
conditionalized so that the old default prevails if the symbol
__nacl_rodata_after_text is present in the link.

BUG= none
TEST= did local scons build and test run with this toolchain

R=eaeltsin@google.com

Review URL: http://codereview.chromium.org/7518013

2 years agoEliminate 16byte alignment capabilities from binutils.
Egor Pasko [Thu, 9 Jun 2011 16:39:12 +0000 (20:39 +0400)]
Eliminate 16byte alignment capabilities from binutils.

The whole purpose is cleanup.  We no longer need 0mod16 alignments for function
entries.  This simplifies the code in binutils and in the NaCl toolchain
Makefile.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/7129038

2 years agoSet MAXPAGESIZE to 64k instead of 2MB on x86-64 NaCl
Mark Seaborn [Wed, 11 May 2011 19:51:48 +0000 (12:51 -0700)]
Set MAXPAGESIZE to 64k instead of 2MB on x86-64 NaCl

This brings x86-64 NaCl into line with x86-32 NaCl.

This reduces wastage of address space in dynamically-linked libraries
and executables.

It will also fix "strip" so that it can reduce x86-64 objects to
roughly the same size as x86-32 objects.  (This will reduce the size
of the IRT library shipped in Chromium.)

MAXPAGESIZE was set to 2MB on normal x86-64 ELF systems just in case
the ELF objects are used on a system that *only* supports large pages;
the resulting address space wastage is deemed acceptable because
normal x86-64 systems have address space to burn.

However, on NaCl, supporting 64k pages is part of our ABI, and since
the sandbox limits address space to 4GB, we do not have address space
to burn.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1073
TEST=
 1) check sizes of stripped IRT binaries
 2) check PT_LOAD addresses from "readelf -a" on libpthread.so

Review URL: http://codereview.chromium.org/6995023

2 years agoUpdate codereview.settings for gerrit hosting (binutils)
Roland McGrath [Wed, 4 May 2011 20:20:42 +0000 (13:20 -0700)]
Update codereview.settings for gerrit hosting (binutils)

Fiddle the magic codereview.settings file for the new git hosting locations.

BUG=infrastructure
TEST=git cl upload working for this change!

R=khim@google.com,mseaborn@chromium.org,pasko@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/6929017

2 years agoConditionalize linker scripts for .rodata placement
Roland McGrath [Tue, 3 May 2011 16:21:56 +0000 (09:21 -0700)]
Conditionalize linker scripts for .rodata placement

Change the linker scripts for linking so that if the symbol
__nacl_rodata_start is defined, that sets the address at which the .rodata
section starts.  This lets a one-line linker script be included in the link
to specify the fixed placement needed to work with a blob library.

BUG=none
TEST=none

R=pasko@google.com,khim@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/6893163

2 years agoFix i386-tbl.h generation from within NaCl sandbox.
Egor Pasko [Wed, 23 Mar 2011 09:03:40 +0000 (12:03 +0300)]
Fix i386-tbl.h generation from within NaCl sandbox.

We fake the linux environment in the binutils build by replacing the ld
command (to produce shell scripts that run .nexe using sel_ldr).

See http://naclports.googlecode.com/svn/trunk/src/packages/scripts/ld

i386-gen.nexe fails to chdir() during the build process, so we help it by doing
chdir() in shell.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1362
TEST=none, will appear with pairing Makefile change

R=khim@google.com,eaeltsin@google.com

Review URL: http://codereview.chromium.org/6711003

2 years ago[noupstream] allow git-cl to push from readonly sources
Egor Pasko [Mon, 28 Feb 2011 12:53:54 +0000 (15:53 +0300)]
[noupstream] allow git-cl to push from readonly sources

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/6591041

2 years ago[noupstream] Add codereview.settings for binutils repo
Egor Pasko [Mon, 28 Feb 2011 09:40:21 +0000 (12:40 +0300)]
[noupstream] Add codereview.settings for binutils repo

BUG=none
TEST=git clone http://git.chromium.org/git/nacl-binutils.git && cd nacl-binutils && ... && git-cl upload # in your branch

Review URL: http://codereview.chromium.org/6594040

2 years agoRemove obsolete linker script features, NACL_MASK and CEILP2
Mark Seaborn [Thu, 17 Feb 2011 19:53:32 +0000 (11:53 -0800)]
Remove obsolete linker script features, NACL_MASK and CEILP2

Remove the definition of the symbol __nacl_and_mask.  This was left
over from an earlier SFI model.

This reduces our changes from upstream binutils.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1453
TEST=to be done

Review URL: http://codereview.chromium.org/6538029

2 years ago[binutils] Fix tls transition check from R_X86_64_GOTTPOFF
Evgeny Eltsin [Wed, 29 Dec 2010 16:12:56 +0000 (19:12 +0300)]
[binutils] Fix tls transition check from R_X86_64_GOTTPOFF

x86_64 linker expects either movq or addq there, while for NaCl we generate movl or addl.
Fixed the check to accept movl and addl, the rewrite itself seems to work as is.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1278
TEST=

Review URL: http://codereview.chromium.org/6025010

2 years ago[binutils] Force assembler to align code section size
Evgeny Eltsin [Tue, 21 Dec 2010 18:06:19 +0000 (21:06 +0300)]
[binutils] Force assembler to align code section size

Assembler pads code sections with NOPs, which is exactly what we need for NaCl.

This change introduces NOP padding at the end of the code section. Whitout this change, linker may add zero padding to code sections, which does not validate.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=499
TEST=code sections in object files should be padded with NOPs at the end when needed

Review URL: http://codereview.chromium.org/6001005

2 years ago[binutils] allow immediates in naclrest{bp,sp}
Egor Pasko [Wed, 8 Dec 2010 16:02:41 +0000 (19:02 +0300)]
[binutils] allow immediates in naclrest{bp,sp}

Originally these commands would have produced an error in nacl64-as:
  naclrestbp $0, %r15
  naclrestsp $0, %r15
Error: suffix or operands invalid for `naclrestbp'

8bit immediates would be extended to 32bit.

BUG=
TEST=

Review URL: http://codereview.chromium.org/5648005

2 years ago[binutils] Move .got.plt section to the data segment.
Andrey Khalyavin [Tue, 23 Nov 2010 12:57:01 +0000 (15:57 +0300)]
[binutils] Move .got.plt section to the data segment.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=960

I do nothing in case of DATA_GOT, RELRO_NOW and GOTPLT variables exist during linker script generation from linker script template. The reason is that $RELRO_NOW undefines $SEPARATE_GOTPLT in the template. Case when someone sets $GOTPLT by other means is not supported. Also, we don't have $RELRO_NOW defined now.

TEST=#in /native_client/tools
make SDKLOC=/path_to_new_toolchain

./scons MODE=nacl,dbg-linux platform=x86-64 sdl=none naclsdk_mode=custom:/path_to_new_toolchain thread_test.nexe
objdump -ph ./scons-out/nacl-x86-64/staging/thread_test.nexe >~/thread_test_dump.txt

Review URL: http://codereview.chromium.org/5115005

2 years ago[binutils] Special processing of R_X86_64_32 relocations
Evgeny Eltsin [Tue, 2 Nov 2010 12:56:56 +0000 (15:56 +0300)]
[binutils] Special processing of R_X86_64_32 relocations

R_X86_64_32 relocations in NaCl64 play the same role as R_X86_64_64 in native x86_64. They should be rewritten in case relocated symbol is hidden and will not exist in statically linked binary.

R_X86_64_64 are rewritten into R_X86_64_RELATIVE using the absolute value of the symbol. Unfortunately we don't have 32-bit alternative, thus we change relocation to use section instead of symbol. Usually this rewrite produces buggy relocations (why? there is corresponding comment in bfd, but it does not explain much), but in our special case we just create valid relocations.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1095
TEST=

Review URL: http://codereview.chromium.org/4128004

2 years ago[binutils] fix x86-64 PLT entries
Egor Pasko [Fri, 24 Sep 2010 18:03:59 +0000 (20:03 +0200)]
[binutils] fix x86-64 PLT entries

BUG=
TEST=

Review URL: http://codereview.chromium.org/3505001

2 years ago[binutils] Prevent ld from rewriting tls access sequences with calls
Evgeny Eltsin [Wed, 22 Sep 2010 14:14:07 +0000 (18:14 +0400)]
[binutils] Prevent ld from rewriting tls access sequences with calls

NaCl assembler inserts nops in front of a call for proper bundling. When linker tries to rewrite a code sequence that consists of something followed by a call, it complains about these nops.

At the moment, simply disable rewriting these sequences.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=237
TEST=

Review URL: http://codereview.chromium.org/3467009

2 years ago[binutils] Pad PLT entries with NOPs instead of HLTs
Mark Seaborn [Tue, 17 Aug 2010 09:59:03 +0000 (10:59 +0100)]
[binutils] Pad PLT entries with NOPs instead of HLTs

nacl_dyncode_copy() now rejects instruction bundles that contain only
HLTs, so we need to change at least the 0th PLT entries.

Also fix the i386 PIC PLT entry so that it pads to the full 64 bytes.
Before, the last 4 bytes were zeroes.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=820
TEST=Tested 32-bit with nacl-glibc's nacl/test.py

Review URL: http://codereview.chromium.org/3177017

2 years ago[binutils] Allow "scasb %nacl:(%rdi),%al,%r15" command
Victor Khimenko [Fri, 30 Jul 2010 16:59:45 +0000 (20:59 +0400)]
[binutils] Allow "scasb %nacl:(%rdi),%al,%r15" command

Review URL: http://codereview.chromium.org/3061037

2 years ago[binutils] Stop using 2MiB pages for x86-64.
Egor Pasko [Wed, 21 Jul 2010 16:27:32 +0000 (18:27 +0200)]
[binutils] Stop using 2MiB pages for x86-64.

Stop using 2MiB pages for x86-64. This finalizes the ABI so now we are using
version 8 for both IA32 and x86-64.

original change made by Victor at: http://codereview.chromium.org/2107008/show
and was lost during transition to Git

Made DATA_SEGMENT_RELRO_END macro non-empty (as in elf.sc), which is required by
glibc configure. This requires extra alignment, so be it.

Review URL: http://codereview.chromium.org/2834056

2 years ago[binutils] add naclrestsp_noflags (lea instead of add)
Jan Voung [Mon, 19 Jul 2010 23:33:18 +0000 (16:33 -0700)]
[binutils] add naclrestsp_noflags (lea instead of add)

Review URL: http://codereview.chromium.org/2858055/show

2 years ago[binutils] NaCl binutils bulk
Egor Pasko [Tue, 18 May 2010 13:26:49 +0000 (15:26 +0200)]
[binutils] NaCl binutils bulk

2 years ago[binutils] Bump binutils to 2.20.1
Victor Khimenko [Sat, 31 Jul 2010 21:18:15 +0000 (01:18 +0400)]
[binutils] Bump binutils to 2.20.1

Review URL: http://codereview.chromium.org/3018030

2 years ago[noupstream] Removed some files regenerated during the build
Egor Pasko [Tue, 1 Jun 2010 12:37:37 +0000 (14:37 +0200)]
[noupstream] Removed some files regenerated during the build

3 years agoInitial commit of toolchain sources
Egor Pasko [Tue, 18 May 2010 12:26:51 +0000 (14:26 +0200)]
Initial commit of toolchain sources

  binutils-2.20
  gcc-4.4.3
  gdb-6.8
  newlib-1.18.0