Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src Pull up following revision(s) (requested by joerg in tick...



details:   https://anonhg.NetBSD.org/src/rev/77783eb1bb8b
branches:  netbsd-8
changeset: 434235:77783eb1bb8b
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Aug 29 09:10:35 2017 +0000

description:
Pull up following revision(s) (requested by joerg in ticket #240):
        external/gpl3/binutils/dist/gas/config/tc-mips.h: revision 1.7
        external/gpl3/gcc/dist/gcc/configure: revision 1.16
        external/gpl3/gcc/dist/gcc/varasm.c: revision 1.2
        external/gpl3/gcc/dist/gcc/varasm.c: revision 1.3
        external/gpl3/gcc/dist/gcc/config/mips/netbsd.h: revision 1.10
        lib/csu/arch/mips/crtend.S: revision 1.4
        share/mk/bsd.own.mk: revision 1.1011
        lib/csu/common/crtbegin.c: revision 1.14
        external/gpl3/binutils/dist/bfd/elfxx-mips.c: revision 1.11
        external/gpl3/gcc/dist/gcc/configure.ac: revision 1.14
        external/gpl3/binutils/dist/bfd/elfxx-sparc.c: revision 1.12
        external/gpl3/gcc/dist/gcc/config/arm/arm.h: revision 1.14
Create references as absolute pointers internally for .cfi*.
Do not warn for anonymous relocations in read-only .eh_frame,
they will be turned into relative entries afterwards.
A const declaration with explicit section attribute should create a
read-only section, whether it is initialized or not.
Use read-only .eh_frame.
Detect advance_loc support with readelf, not objdump. The latter is
broken in some situations before binutils 2.28.
.eh_frame should be read-only on MIPS too.
Build PIC libs on MIPS and PPC64. While the normal calling convention is
position-independent, real PIC defaults to Global Dynamic as TLS model,
while non-PIC and PIE code can use more restrictive models like Initial
Exec. This is most visible with the thread_local destructor code now
using TLS in libc as it would be clobbered by any other shared library
with TLS due to static offset assignment by ld.
Fix encoding of LSDA entries. .eh_frame references in non-PIC mode can
use plain pointers. For PIC, any references to global objects must be
indirect, but the .eh_frame entries themselve should be pcrel.
One more missing check for DECL_INITIAL being non-NULL.
TLS relocations for PIE and non-PIE main executable work the same, so
apply the same relaxation rules and the same static binding rules.

diffstat:

 external/gpl3/binutils/dist/bfd/elfxx-mips.c     |  10 ++++++-
 external/gpl3/binutils/dist/bfd/elfxx-sparc.c    |  28 ++++++++++++------------
 external/gpl3/binutils/dist/gas/config/tc-mips.h |   2 +-
 external/gpl3/gcc/dist/gcc/config/arm/arm.h      |   6 +---
 external/gpl3/gcc/dist/gcc/config/mips/netbsd.h  |   2 +-
 external/gpl3/gcc/dist/gcc/configure             |   2 +-
 external/gpl3/gcc/dist/gcc/configure.ac          |   2 +-
 external/gpl3/gcc/dist/gcc/varasm.c              |  14 +++++++++--
 lib/csu/arch/mips/crtend.S                       |   6 ++--
 lib/csu/common/crtbegin.c                        |   8 +-----
 share/mk/bsd.own.mk                              |  19 ++-------------
 11 files changed, 47 insertions(+), 52 deletions(-)

diffs (truncated from 342 to 300 lines):

diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/binutils/dist/bfd/elfxx-mips.c
--- a/external/gpl3/binutils/dist/bfd/elfxx-mips.c      Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/binutils/dist/bfd/elfxx-mips.c      Tue Aug 29 09:10:35 2017 +0000
@@ -8596,12 +8596,18 @@
                  /* In the N32 and 64-bit ABIs there may be multiple
                     consecutive relocations for the same offset.  If we have
                     a R_MIPS_GPREL32 followed by a R_MIPS_64 then that
-                    relocation is complete and needs no futher adjustment.  */
+                    relocation is complete and needs no futher adjustment.
+                    
+                    Silently ignore absolute relocations in the .eh_frame
+                    section, they will be dropped latter.
+                  */
                  if ((rel == relocs
                      || rel[-1].r_offset != rel->r_offset
                      || r_type != R_MIPS_64
                      || ELF_R_TYPE(abfd, rel[-1].r_info) != R_MIPS_GPREL32)
-                     && MIPS_ELF_READONLY_SECTION (sec))
+                     && MIPS_ELF_READONLY_SECTION (sec)
+                     && !((r_type == R_MIPS_32 || r_type == R_MIPS_64)
+                          && strcmp(sec->name, ".eh_frame") == 0))
                    {
                      /* We tell the dynamic linker that there are
                         relocations against the text segment.  */
diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/binutils/dist/bfd/elfxx-sparc.c
--- a/external/gpl3/binutils/dist/bfd/elfxx-sparc.c     Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/binutils/dist/bfd/elfxx-sparc.c     Tue Aug 29 09:10:35 2017 +0000
@@ -1330,7 +1330,7 @@
       && ! _bfd_sparc_elf_tdata (abfd)->has_tlsgd)
     r_type = R_SPARC_REV32;
 
-  if (bfd_link_pic (info))
+  if (bfd_link_dll (info))
     return r_type;
 
   switch (r_type)
@@ -1501,13 +1501,13 @@
 
        case R_SPARC_TLS_LE_HIX22:
        case R_SPARC_TLS_LE_LOX10:
-         if (bfd_link_pic (info))
+         if (bfd_link_dll (info))
            goto r_sparc_plt32;
          break;
 
        case R_SPARC_TLS_IE_HI22:
        case R_SPARC_TLS_IE_LO10:
-         if (bfd_link_pic (info))
+         if (bfd_link_dll (info))
            info->flags |= DF_STATIC_TLS;
          /* Fall through */
 
@@ -2334,7 +2334,7 @@
   /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
      make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry.  */
   if (h->got.refcount > 0
-      && !bfd_link_pic (info)
+      && !bfd_link_dll (info)
       && h->dynindx == -1
       && _bfd_sparc_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
     h->got.offset = (bfd_vma) -1;
@@ -3582,7 +3582,7 @@
          else if (h != NULL)
            {
              tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
-             if (!bfd_link_pic (info)
+             if (!bfd_link_dll (info)
                  && h->dynindx == -1
                  && tls_type == GOT_TLS_IE)
                switch (SPARC_ELF_R_TYPE (rel->r_info))
@@ -3706,7 +3706,7 @@
 
        case R_SPARC_TLS_LDM_HI22:
        case R_SPARC_TLS_LDM_LO10:
-         if (! bfd_link_pic (info))
+         if (! bfd_link_dll (info))
            {
              bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
              continue;
@@ -3717,7 +3717,7 @@
 
        case R_SPARC_TLS_LDO_HIX22:
        case R_SPARC_TLS_LDO_LOX10:
-         if (bfd_link_pic (info))
+         if (bfd_link_dll (info))
            {
              relocation -= dtpoff_base (info);
              break;
@@ -3729,7 +3729,7 @@
 
        case R_SPARC_TLS_LE_HIX22:
        case R_SPARC_TLS_LE_LOX10:
-         if (bfd_link_pic (info))
+         if (bfd_link_dll (info))
            {
              Elf_Internal_Rela outrel;
              bfd_boolean skip;
@@ -3761,7 +3761,7 @@
          break;
 
        case R_SPARC_TLS_LDM_CALL:
-         if (! bfd_link_pic (info))
+         if (! bfd_link_dll (info))
            {
              /* mov %g0, %o0 */
              bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset);
@@ -3775,13 +3775,13 @@
            tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
          else if (h != NULL)
            tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
-         if (! bfd_link_pic (info)
+         if (! bfd_link_dll (info)
              || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE))
            {
              Elf_Internal_Rela *rel2;
              bfd_vma insn;
 
-             if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
+             if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
                {
                  /* GD -> LE */
                  bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
@@ -3868,12 +3868,12 @@
          continue;
 
        case R_SPARC_TLS_LDM_ADD:
-         if (! bfd_link_pic (info))
+         if (! bfd_link_dll (info))
            bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
          continue;
 
        case R_SPARC_TLS_LDO_ADD:
-         if (! bfd_link_pic (info))
+         if (! bfd_link_dll (info))
            {
              /* Change rs1 into %g7.  */
              bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
@@ -3884,7 +3884,7 @@
 
        case R_SPARC_TLS_IE_LD:
        case R_SPARC_TLS_IE_LDX:
-         if (! bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
+         if (! bfd_link_dll (info) && (h == NULL || h->dynindx == -1))
            {
              bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
              int rs2 = insn & 0x1f;
diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/binutils/dist/gas/config/tc-mips.h
--- a/external/gpl3/binutils/dist/gas/config/tc-mips.h  Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/binutils/dist/gas/config/tc-mips.h  Tue Aug 29 09:10:35 2017 +0000
@@ -178,7 +178,7 @@
 #define DWARF2_ADDR_SIZE(bfd) mips_dwarf2_addr_size ()
 #define DWARF2_FDE_RELOC_SIZE (compact_eh ? 4 : mips_dwarf2_addr_size ())
 #define DWARF2_FDE_RELOC_ENCODING(enc) \
-  (enc | (compact_eh ? DW_EH_PE_pcrel : 0))
+  (compact_eh ? (enc)|DW_EH_PE_pcrel : DW_EH_PE_absptr)
 
 #define TARGET_USE_CFIPOP 1
 
diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/gcc/dist/gcc/config/arm/arm.h
--- a/external/gpl3/gcc/dist/gcc/config/arm/arm.h       Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/arm/arm.h       Tue Aug 29 09:10:35 2017 +0000
@@ -964,10 +964,8 @@
 /* DWARF unwinding uses the normal indirect/pcrel vs absptr format
    for 32bit platforms. */
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
-    ((flag_pic \
-     && ((GLOBAL) || (CODE))) \
-     ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
-     : DW_EH_PE_absptr)
+  (flag_pic ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
+            : DW_EH_PE_absptr)
 #else
 /* ttype entries (the only interesting data references used)
    use TARGET2 relocations.  */
diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/gcc/dist/gcc/config/mips/netbsd.h
--- a/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h   Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h   Tue Aug 29 09:10:35 2017 +0000
@@ -228,4 +228,4 @@
 #define WINT_TYPE "int"
 
 #undef TARGET_WRITABLE_EH_FRAME
-#define TARGET_WRITABLE_EH_FRAME (flag_pic && TARGET_SHARED)
+#define TARGET_WRITABLE_EH_FRAME 0
diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/gcc/dist/gcc/configure
--- a/external/gpl3/gcc/dist/gcc/configure      Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/gcc/dist/gcc/configure      Tue Aug 29 09:10:35 2017 +0000
@@ -22891,7 +22891,7 @@
   test $ac_status = 0; }; }
     then
 
-if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \
+if $gcc_cv_readelf --debug-dump=frames conftest.o 2>/dev/null \
     | grep 'DW_CFA_advance_loc[24]:[   ][      ]*75040[        ]' >/dev/null; then
    gcc_cv_as_cfi_advance_working=yes
 fi
diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/gcc/dist/gcc/configure.ac
--- a/external/gpl3/gcc/dist/gcc/configure.ac   Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/gcc/dist/gcc/configure.ac   Tue Aug 29 09:10:35 2017 +0000
@@ -2693,7 +2693,7 @@
        .cfi_adjust_cfa_offset 128
        .cfi_endproc],
 [[
-if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \
+if $gcc_cv_readelf --debug-dump=frames conftest.o 2>/dev/null \
     | grep 'DW_CFA_advance_loc[24]:[   ][      ]*75040[        ]' >/dev/null; then
    gcc_cv_as_cfi_advance_working=yes
 fi
diff -r 66da2698ad54 -r 77783eb1bb8b external/gpl3/gcc/dist/gcc/varasm.c
--- a/external/gpl3/gcc/dist/gcc/varasm.c       Sat Aug 26 03:55:04 2017 +0000
+++ b/external/gpl3/gcc/dist/gcc/varasm.c       Tue Aug 29 09:10:35 2017 +0000
@@ -978,11 +978,17 @@
 }
 
 
-/* Return true if DECL's initializer is suitable for a BSS section.  */
+/*
+ * Return true if DECL's initializer is suitable for a BSS section.
+ * If there is an explicit section name attribute, assume that it is not
+ * for a BSS section, independent of the name.
+ */
 
 bool
 bss_initializer_p (const_tree decl)
 {
+  if (DECL_SECTION_NAME (decl) != NULL)
+    return false;
   return (DECL_INITIAL (decl) == NULL
          /* In LTO we have no errors in program; error_mark_node is used
             to mark offlined constructors.  */
@@ -6402,7 +6408,7 @@
        ret = SECCAT_BSS;
       else if (! TREE_READONLY (decl)
               || TREE_SIDE_EFFECTS (decl)
-              || ! TREE_CONSTANT (DECL_INITIAL (decl)))
+              || (DECL_INITIAL(decl) != NULL && ! TREE_CONSTANT (DECL_INITIAL (decl))))
        {
          /* Here the reloc_rw_mask is not testing whether the section should
             be read-only or not, but whether the dynamic link will have to
@@ -6422,7 +6428,8 @@
           location.  -fmerge-all-constants allows even that (at the
           expense of not conforming).  */
        ret = SECCAT_RODATA;
-      else if (TREE_CODE (DECL_INITIAL (decl)) == STRING_CST)
+      else if (DECL_INITIAL (decl) != NULL
+               && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST)
        ret = SECCAT_RODATA_MERGE_STR_INIT;
       else
        ret = SECCAT_RODATA_MERGE_CONST;
@@ -6446,6 +6453,7 @@
         no concept of a read-only thread-local-data section.  */
       if (ret == SECCAT_BSS
               || (flag_zero_initialized_in_bss
+                  && DECL_INITIAL(decl) != NULL
                   && initializer_zerop (DECL_INITIAL (decl))))
        ret = SECCAT_TBSS;
       else
diff -r 66da2698ad54 -r 77783eb1bb8b lib/csu/arch/mips/crtend.S
--- a/lib/csu/arch/mips/crtend.S        Sat Aug 26 03:55:04 2017 +0000
+++ b/lib/csu/arch/mips/crtend.S        Tue Aug 29 09:10:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $  */
+/*     $NetBSD: crtend.S,v 1.3.22.1 2017/08/29 09:10:36 bouyer Exp $   */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include <mips/asm.h>
 
-RCSID("$NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $")
+RCSID("$NetBSD: crtend.S,v 1.3.22.1 2017/08/29 09:10:36 bouyer Exp $")
 
        .section        .ctors, "aw", @progbits
        .p2align        PTR_SCALESHIFT
@@ -46,7 +46,7 @@
 __DTOR_LIST_END__:
        .word           0
 
-       .section        .eh_frame, "aw", @progbits
+       .section        .eh_frame, "a", @progbits
        .p2align         PTR_SCALESHIFT
        .space          _MIPS_SZPTR / 8
 
diff -r 66da2698ad54 -r 77783eb1bb8b lib/csu/common/crtbegin.c
--- a/lib/csu/common/crtbegin.c Sat Aug 26 03:55:04 2017 +0000
+++ b/lib/csu/common/crtbegin.c Tue Aug 29 09:10:35 2017 +0000
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: crtbegin.c,v 1.13 2016/06/29 11:16:47 joerg Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.13.8.1 2017/08/29 09:10:36 bouyer Exp $");
 
 #include "crtbegin.h"
 
@@ -57,11 +57,7 @@
 #endif
 
 #if !defined(__ARM_EABI__) || defined(__ARM_DWARF_EH__)
-__dso_hidden



Home | Main Index | Thread Index | Old Index