gcc

~vcs-imports/gcc/+git/gcc:hjl/pr65846/master

Last commit made on 2015-10-20
Get this branch:
git clone -b hjl/pr65846/master https://git.launchpad.net/~vcs-imports/gcc/+git/gcc

Branch merges

Branch information

Name:
hjl/pr65846/master
Repository:
lp:~vcs-imports/gcc/+git/gcc

Recent commits

a703d25... by "H.J. Lu" <email address hidden>

Enable -fsymbolic in LTO if -Bsymbolic is used

When -Bsymbolic is passed to linker, references to global symbols
defined in the shared library are resolved locally. We should pass
-fsymbolic to GCC in this case.

 * collect2.c (main): Add -fsymbolic to COLLECT_GCC_OPTIONS if
 -Bsymbolic is used.
 * doc/invoke.texi: Updated.

91d29c5... by "H.J. Lu" <email address hidden>

X86: Optimize access to globals in PIE with copy reloc

Normally, with PIE, GCC accesses globals that are extern to the module
using GOT. This is two instructions, one to get the address of the global
from GOT and the other to get the value. Examples:

---
extern int a_glob;
int
main ()
{
  return a_glob;
}
---

With PIE, the generated code accesses global via GOT using two memory
loads:

 movq a_glob@GOTPCREL(%rip), %rax
 movl (%rax), %eax

for 64-bit or

 movl a_glob@GOT(%ecx), %eax
 movl (%eax), %eax

for 32-bit.

Some experiments on google and SPEC CPU benchmarks show that the extra
instruction affects performance by 1% to 5%.

Solution - Copy Relocations:

When the linker supports copy relocations, GCC can always assume that
the global will be defined in the executable. For globals that are
truly extern (come from shared objects), the linker will create copy
relocations and have them defined in the executable. Result is that
no global access needs to go through GOT and hence improves performance.
We can generate

 movl a_glob(%rip), %eax

for 64-bit and

 movl a_glob@GOTOFF(%eax), %eax

for 32-bit. This optimization only applies to undefined non-weak
non-TLS global data. Undefined weak global or TLS data access still
must go through GOT.

This patch reverts legitimate_pic_address_disp_p change made in revision
218397, which only applies to x86-64. Instead, this patch updates
targetm.binds_local_p to indicate if undefined non-weak non-TLS global
data is defined locally in PIE. It also introduces a new target hook,
binds_tls_local_p to distinguish TLS variable from non-TLS variable. By
default, binds_tls_local_p is the same as binds_local_p which assumes
TLS variable.

This patch checks if 32-bit and 64-bit linkers support PIE with copy
reloc at configure time. 64-bit linker is enabled in binutils 2.25
and 32-bit linker is enabled in binutils 2.26. This optimization
is enabled only if the linker support is available.

Since copy relocation in PIE is incompatible with DSO created by
-Wl,-Bsymbolic, this patch also adds a new option, -fsymbolic, which
controls how references to global symbols are bound. The -fsymbolic
option binds references to global symbols to the local definitions
and external references globally. It avoids copy relocations in PIE
and optimizes global symbol references in shared library created
by -Wl,-Bsymbolic.

gcc/

 PR target/65846
 PR target/65886
 * configure.ac (HAVE_LD_PIE_COPYRELOC): Renamed to ...
 (HAVE_LD_X86_64_PIE_COPYRELOC): This.
 (HAVE_LD_386_PIE_COPYRELOC): New. Defined to 1 if Linux/ia32
 linker supports PIE with copy reloc.
 * output.h (default_binds_tls_local_p): New.
 (default_binds_local_p_3): Add 2 bool arguments.
 * target.def (binds_tls_local_p): New target hook.
 * varasm.c (decl_default_tls_model): Replace targetm.binds_local_p
 with targetm.binds_tls_local_p.
 (default_binds_local_p_3): Add a bool argument to indicate TLS
 variable and a bool argument to indicate if an undefined non-TLS
 non-weak data is local. Double check TLS variable. If an
 undefined non-TLS non-weak data is local, treat it as defined
 locally.
 (default_binds_local_p): Pass true and false to
 default_binds_local_p_3.
 (default_binds_local_p_2): Likewise.
 (default_binds_local_p_1): Likewise.
 (default_binds_tls_local_p): New.
 * config.in: Regenerated.
 * configure: Likewise.
 * doc/tm.texi: Likewise.
 * config/i386/i386.c (legitimate_pic_address_disp_p): Don't
 check HAVE_LD_PIE_COPYRELOC here.
 (ix86_binds_local): New.
 (ix86_binds_tls_local_p): Likewise.
 (ix86_binds_local_p): Use it.
 (TARGET_BINDS_TLS_LOCAL_P): New.
 * doc/tm.texi.in (TARGET_BINDS_TLS_LOCAL_P): New hook.

gcc/testsuite/

 PR target/65846
 PR target/65886
 * gcc.target/i386/pie-copyrelocs-1.c: Updated for ia32.
 * gcc.target/i386/pie-copyrelocs-2.c: Likewise.
 * gcc.target/i386/pie-copyrelocs-3.c: Likewise.
 * gcc.target/i386/pie-copyrelocs-4.c: Likewise.
 * gcc.target/i386/pr32219-9.c: Likewise.
 * gcc.target/i386/pr32219-10.c: New file.
 * gcc.target/i386/pr65886-1.c: Likewise.
 * gcc.target/i386/pr65886-2.c: Likewise.
 * gcc.target/i386/pr65886-3.c: Likewise.
 * gcc.target/i386/pr65886-4.c: Likewise.
 * gcc.target/i386/pr65886-4.c: Likewise.
 * gcc.target/i386/pr65886-5.c: Likewise.

 * lib/target-supports.exp (check_effective_target_pie_copyreloc):
 Check HAVE_LD_X86_64_PIE_COPYRELOC and HAVE_LD_386_PIE_COPYRELOC
 instead of HAVE_LD_X86_64_PIE_COPYRELOC.

2f5441e... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Bob Duff <email address hidden>

 * a-coinve.adb, a-contai.adb: Update comments.
 * pprint.ads: Minor reformatting.

2015-10-20 Tristan Gingold <email address hidden>

 * env.c, init.c: Handle arm64-darwin like arm-darwin.
 * tracebak.c: Handle arm64-darwin.

2015-10-20 Bob Duff <email address hidden>

 * s-trasym.adb (Symbolic_Traceback): When giving the traceback
 as hexadecimal code addresses, separate by blanks instead of LF.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229039 138bc75d-0d04-0410-961f-82ee72b054a4

dc62fae... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Ed Schonberg <email address hidden>

 * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Generate freeze
 node for subprogram in Compile_Only mode.

2015-10-20 Dmitriy Anisimkov <email address hidden>

 * s-atocou.adb, s-atocou.ads, a-contai.adb, a-contai.ads,
 s-atocou-x86.adb, s-atocou-builtin.adb: Task safe over container
 iterations.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229037 138bc75d-0d04-0410-961f-82ee72b054a4

d3e59bb... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Philippe Gil <email address hidden>

 * g-debpoo.ads (Dump): NEW print Debug_Pool statistics & main
 contributors.
 (Dump_Stdout): NEW print to stdout Debug_Pool statistics &
 main contributors.
 (Reset): NEW reset counters to 0.
 (Get_Size): NEW return size allocated at parameter.
 (High_Water_Mark): NEW.
 (Current_Water_Mark): NEW.
 (System_Memory_Debug_Pool): NEW tell Debug_Pools that
 System.Memory uses it.
 * g-debpoo.adb (Traceback_Htable_Elem): add Frees, Total_Frees
 components.
 (Find_Or_Create_Traceback): don't manage in System.Memory
 Debug_Pool Deallocate Traceback's.
 (Validity): add optional Handled table when System.Memory asked
 for Allow_Unhandled_Memory.
 (Allocate): handle Allocate reentrancy occuring when System.Memory
 uses Debug_Pools.
 (Deallocate): handle when Allow_Unhandled_Memory
 is set deallocation of unhandled memory. Dont't check
 Size_In_Storage_Elements if equal to Storage_Count'Last. update
 Frees, Total_Frees new components.

2015-10-20 Eric Botcazou <email address hidden>

 * fe.h: Minor tweak.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229036 138bc75d-0d04-0410-961f-82ee72b054a4

0c0a0b2... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Vincent Celier <email address hidden>

 * sem_cat.adb (Check_Categorization_Dependencies): Do nothing
 when -gnatdu is specified.

2015-10-20 Ed Schonberg <email address hidden>

 * sem_ch8.adb (analyze_Subprogram_Renaming): The actual for a
 formal abstract subprogram must have a controlling type.
 * stand.ads: Minor whitespace cleanup.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229035 138bc75d-0d04-0410-961f-82ee72b054a4

55ab526... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Gary Dismukes <email address hidden>

 * sem_ch13.adb: Minor reference change (RM => AARM).

2015-10-20 Eric Botcazou <email address hidden>

 * make.adb (Check): Skip multilib switches reinstated by the
 compiler only when counting the number of switches, since it is
 what really matters in the regular operating mode.

2015-10-20 Arnaud Charlet <email address hidden>

 * einfo.adb: Add extra assertion for small clause.
 * cstand.adb: Minor style fix in comment.
 * debug.adb: Minor reformatting.
 * exp_util.adb: Fix minor typo.

2015-10-20 Ed Schonberg <email address hidden>

 * sem_ch12.adb (Same_Instantiated_Function): New predicate in
 Check_Formal_Package_Instance, used to verify that the formal
 and the actual of an actual package match when both are functions
 given as attribute references.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229034 138bc75d-0d04-0410-961f-82ee72b054a4

078a74b... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Bob Duff <email address hidden>

 * a-coinve.ads, a-coinve.adb: Do the same efficiency
 improvements that were already done in the definite case
 (Ada.Containers.Vectors, i.e. a-convec). This includes the
 ability to suppress checks, the fast path for Append, inlining
 as appropriate, and special-casing of "for ... of" loops. Reuse
 the tampering machinery that is now in Ada.Containers. Simplify
 many operations.
 * a-convec.ads, a-convec.adb: Change the code to be more similar
 to a-coinve.
 * a-finali.ads, a-finali.adb: Expose the "null"-ness of the
 operations. This may enable optimizations in the future, and
 seems cleaner anyway.

2015-10-20 Ed Schonberg <email address hidden>

 * sem_ch13.adb (Is_Operational_Item): Attributes related to
 Ada 2012 iterators are operational items, and can be specified
 on partial views.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229033 138bc75d-0d04-0410-961f-82ee72b054a4

f0a120e... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Hristian Kirtchev <email address hidden>

 * sem_prag.adb (Check_Usage): Update the calls to Usage_Error.
 (Usage_Error): Remove formal parameter Item. Emit a clearer message
 concerning a missing dependency item and place it on the related pragma.

2015-10-20 Bob Duff <email address hidden>

 * debug.adb, expander.adb: Implement -gnatd.B switch, which
 triggers a bug box when an abort_statement is seen. This is
 useful for testing Comperr.Compiler_Abort.
 * gnat1drv.adb: Trigger bug box on all exceptions other than
 Unrecoverable_Error.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229032 138bc75d-0d04-0410-961f-82ee72b054a4

d1cd139... by charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>

2015-10-20 Thomas Quinot <email address hidden>

 * Makefile.rtl: add the following...
 * g-binenv.ads, g-binenv.adb: New unit providing runtime access
 to bind time captured values ("bind environment")
 * init.c: declare new global variable __gl_bind_env_addr.
 * bindgen.ads, bindgen.adb (Set_Bind_Env): record a bind
 environment key=value pair.
 (Gen_Bind_Env_String): helper to produce the bind environment data
 called in the binder generated file.
 (Gen_Output_File_Ada): Call the above (Gen_Adainit): Set
 __gl_bind_env_addr accordingly.
 * switch-b.adb: Support for command line switch -V (user interface
 to set a build environment key=value pair)
 * bindusg.adb: Document the above

2015-10-20 Vincent Celier <email address hidden>

 * sem_prag.adb (Analyse_Pragma: Pragma Pure): Do not set the
 entity as Pure if Debug_Flag_U is set.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229031 138bc75d-0d04-0410-961f-82ee72b054a4