Import rpm: c8s
This commit is contained in:
		
							parent
							
								
									acde2bccaa
								
							
						
					
					
						commit
						fead72df51
					
				
							
								
								
									
										8
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,8 +1,4 @@
 | 
			
		||||
SOURCES/binutils-2.30.tar.xz
 | 
			
		||||
SOURCES/standards.info.gz
 | 
			
		||||
/binutils-2.30.tar.xz
 | 
			
		||||
/binutils-gas-build-notes.patch
 | 
			
		||||
/binutils-ifunc-relocs-in-notes.patch
 | 
			
		||||
/binutils-improved-note-merging.patch
 | 
			
		||||
/binutils-linkonce-notes.patch
 | 
			
		||||
/binutils-missing-notes.patch
 | 
			
		||||
/standards.info.gz
 | 
			
		||||
/binutils-nfp.patch
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										555
									
								
								binutils-gas-build-notes.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										555
									
								
								binutils-gas-build-notes.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,555 @@
 | 
			
		||||
diff -rup binutils.orig/binutils/readelf.c binutils-2.30/binutils/readelf.c
 | 
			
		||||
--- binutils.orig/binutils/readelf.c	2018-04-26 15:14:17.220464639 +0100
 | 
			
		||||
+++ binutils-2.30/binutils/readelf.c	2018-04-26 15:14:31.927287474 +0100
 | 
			
		||||
@@ -12294,7 +12294,8 @@ is_32bit_abs_reloc (Filedata * filedata,
 | 
			
		||||
     case EM_OR1K:
 | 
			
		||||
       return reloc_type == 1; /* R_OR1K_32.  */
 | 
			
		||||
     case EM_PARISC:
 | 
			
		||||
-      return (reloc_type == 1 /* R_PARISC_DIR32.  */
 | 
			
		||||
+      return (reloc_type == 1 /* R_PARISC_DIR32.  */	      
 | 
			
		||||
+	      || reloc_type == 2 /* R_PARISC_DIR21L.  */
 | 
			
		||||
 	      || reloc_type == 41); /* R_PARISC_SECREL32.  */
 | 
			
		||||
     case EM_PJ:
 | 
			
		||||
     case EM_PJ_OLD:
 | 
			
		||||
Only in binutils-2.30/binutils: readelf.c.orig
 | 
			
		||||
diff -rup binutils.orig/binutils/testsuite/binutils-all/objcopy.exp binutils-2.30/binutils/testsuite/binutils-all/objcopy.exp
 | 
			
		||||
--- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp	2018-04-26 15:14:17.215464699 +0100
 | 
			
		||||
+++ binutils-2.30/binutils/testsuite/binutils-all/objcopy.exp	2018-04-26 15:14:31.927287474 +0100
 | 
			
		||||
@@ -1062,6 +1062,7 @@ if [is_elf_format] {
 | 
			
		||||
 	run_dump_test "note-3-32"
 | 
			
		||||
 	run_dump_test "note-4-32"
 | 
			
		||||
     }
 | 
			
		||||
+    run_dump_test "note-5"
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 run_dump_test "copy-2"
 | 
			
		||||
Only in binutils-2.30/binutils/testsuite/binutils-all: objcopy.exp.orig
 | 
			
		||||
diff -rup binutils.orig/gas/as.c binutils-2.30/gas/as.c
 | 
			
		||||
--- binutils.orig/gas/as.c	2018-04-26 15:14:17.646459507 +0100
 | 
			
		||||
+++ binutils-2.30/gas/as.c	2018-04-26 15:14:31.927287474 +0100
 | 
			
		||||
@@ -97,6 +97,7 @@ int verbose = 0;
 | 
			
		||||
 
 | 
			
		||||
 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
 | 
			
		||||
 int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON;
 | 
			
		||||
+bfd_boolean flag_generate_build_notes = DEFAULT_GENERATE_BUILD_NOTES;
 | 
			
		||||
 #endif
 | 
			
		||||
 
 | 
			
		||||
 /* Keep the output file.  */
 | 
			
		||||
@@ -304,8 +305,19 @@ Options:\n\
 | 
			
		||||
                           generate ELF common symbols with STT_COMMON type\n"));
 | 
			
		||||
   fprintf (stream, _("\
 | 
			
		||||
   --sectname-subst        enable section name substitution sequences\n"));
 | 
			
		||||
+
 | 
			
		||||
+  fprintf (stream, _("\
 | 
			
		||||
+  --generate-missing-build-notes=[no|yes] "));
 | 
			
		||||
+#if DEFAULT_GENERATE_BUILD_NOTES
 | 
			
		||||
+  fprintf (stream, _("(default: yes)\n"));
 | 
			
		||||
+#else
 | 
			
		||||
+  fprintf (stream, _("(default: no)\n"));
 | 
			
		||||
 #endif
 | 
			
		||||
   fprintf (stream, _("\
 | 
			
		||||
+                          generate GNU Build notes if none are present in the input\n"));
 | 
			
		||||
+#endif /* OBJ_ELF */
 | 
			
		||||
+
 | 
			
		||||
+  fprintf (stream, _("\
 | 
			
		||||
   -f                      skip whitespace and comment preprocessing\n"));
 | 
			
		||||
   fprintf (stream, _("\
 | 
			
		||||
   -g --gen-debug          generate debugging information\n"));
 | 
			
		||||
@@ -470,6 +482,7 @@ parse_args (int * pargc, char *** pargv)
 | 
			
		||||
       OPTION_NOEXECSTACK,
 | 
			
		||||
       OPTION_SIZE_CHECK,
 | 
			
		||||
       OPTION_ELF_STT_COMMON,
 | 
			
		||||
+      OPTION_ELF_BUILD_NOTES,
 | 
			
		||||
       OPTION_SECTNAME_SUBST,
 | 
			
		||||
       OPTION_ALTERNATE,
 | 
			
		||||
       OPTION_AL,
 | 
			
		||||
@@ -508,6 +521,7 @@ parse_args (int * pargc, char *** pargv)
 | 
			
		||||
     ,{"size-check", required_argument, NULL, OPTION_SIZE_CHECK}
 | 
			
		||||
     ,{"elf-stt-common", required_argument, NULL, OPTION_ELF_STT_COMMON}
 | 
			
		||||
     ,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST}
 | 
			
		||||
+    ,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES}
 | 
			
		||||
 #endif
 | 
			
		||||
     ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
 | 
			
		||||
     ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2}
 | 
			
		||||
@@ -900,7 +914,19 @@ This program has absolutely no warranty.
 | 
			
		||||
 	case OPTION_SECTNAME_SUBST:
 | 
			
		||||
 	  flag_sectname_subst = 1;
 | 
			
		||||
 	  break;
 | 
			
		||||
-#endif
 | 
			
		||||
+
 | 
			
		||||
+	case OPTION_ELF_BUILD_NOTES:
 | 
			
		||||
+	  if (strcasecmp (optarg, "no") == 0)
 | 
			
		||||
+	    flag_generate_build_notes = FALSE;
 | 
			
		||||
+	  else if (strcasecmp (optarg, "yes") == 0)
 | 
			
		||||
+	    flag_generate_build_notes = TRUE;
 | 
			
		||||
+	  else
 | 
			
		||||
+	    as_fatal (_("Invalid --generate-missing-build-notes option: `%s'"),
 | 
			
		||||
+		      optarg);
 | 
			
		||||
+	  break;
 | 
			
		||||
+
 | 
			
		||||
+#endif /* OBJ_ELF */
 | 
			
		||||
+
 | 
			
		||||
 	case 'Z':
 | 
			
		||||
 	  flag_always_generate_output = 1;
 | 
			
		||||
 	  break;
 | 
			
		||||
diff -rup binutils.orig/gas/as.h binutils-2.30/gas/as.h
 | 
			
		||||
--- binutils.orig/gas/as.h	2018-04-26 15:14:17.654459410 +0100
 | 
			
		||||
+++ binutils-2.30/gas/as.h	2018-04-26 15:14:31.927287474 +0100
 | 
			
		||||
@@ -585,6 +585,10 @@ COMMON int flag_allow_nonconst_size;
 | 
			
		||||
 /* If we should generate ELF common symbols with the STT_COMMON type.  */
 | 
			
		||||
 extern int flag_use_elf_stt_common;
 | 
			
		||||
 
 | 
			
		||||
+/* TRUE iff GNU Build attribute notes should
 | 
			
		||||
+   be generated if none are in the input files.  */
 | 
			
		||||
+extern bfd_boolean flag_generate_build_notes;
 | 
			
		||||
+
 | 
			
		||||
 /* If section name substitution sequences should be honored */
 | 
			
		||||
 COMMON int flag_sectname_subst;
 | 
			
		||||
 #endif
 | 
			
		||||
Only in binutils-2.30/gas: as.h.orig
 | 
			
		||||
diff -rup binutils.orig/gas/config.in binutils-2.30/gas/config.in
 | 
			
		||||
--- binutils.orig/gas/config.in	2018-04-26 15:14:17.645459519 +0100
 | 
			
		||||
+++ binutils-2.30/gas/config.in	2018-04-26 15:14:31.927287474 +0100
 | 
			
		||||
@@ -39,6 +39,10 @@
 | 
			
		||||
 /* Define if you want compressed debug sections by default. */
 | 
			
		||||
 #undef DEFAULT_FLAG_COMPRESS_DEBUG
 | 
			
		||||
 
 | 
			
		||||
+/* Define to 1 if you want to generate GNU Build attribute notes by default,
 | 
			
		||||
+   if none are contained in the input. */
 | 
			
		||||
+#undef DEFAULT_GENERATE_BUILD_NOTES
 | 
			
		||||
+
 | 
			
		||||
 /* Define to 1 if you want to generate ELF common symbols with the STT_COMMON
 | 
			
		||||
    type by default. */
 | 
			
		||||
 #undef DEFAULT_GENERATE_ELF_STT_COMMON
 | 
			
		||||
diff -rup binutils.orig/gas/configure binutils-2.30/gas/configure
 | 
			
		||||
--- binutils.orig/gas/configure	2018-04-26 15:14:17.645459519 +0100
 | 
			
		||||
+++ binutils-2.30/gas/configure	2018-04-26 15:14:31.928287462 +0100
 | 
			
		||||
@@ -771,6 +771,7 @@ enable_checking
 | 
			
		||||
 enable_compressed_debug_sections
 | 
			
		||||
 enable_x86_relax_relocations
 | 
			
		||||
 enable_elf_stt_common
 | 
			
		||||
+enable_generate_build_notes
 | 
			
		||||
 enable_werror
 | 
			
		||||
 enable_build_warnings
 | 
			
		||||
 with_cpu
 | 
			
		||||
@@ -1426,6 +1427,9 @@ Optional Features:
 | 
			
		||||
                           generate x86 relax relocations by default
 | 
			
		||||
   --enable-elf-stt-common generate ELF common symbols with STT_COMMON type by
 | 
			
		||||
                           default
 | 
			
		||||
+  --enable-generate-build-notes
 | 
			
		||||
+                          generate GNU Build notes if none are provided by the
 | 
			
		||||
+                          input
 | 
			
		||||
   --enable-werror         treat compile warnings as errors
 | 
			
		||||
   --enable-build-warnings enable build-time compiler warnings
 | 
			
		||||
   --disable-nls           do not use Native Language Support
 | 
			
		||||
@@ -11011,7 +11015,7 @@ else
 | 
			
		||||
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 | 
			
		||||
   lt_status=$lt_dlunknown
 | 
			
		||||
   cat > conftest.$ac_ext <<_LT_EOF
 | 
			
		||||
-#line 10990 "configure"
 | 
			
		||||
+#line 10994 "configure"
 | 
			
		||||
 #include "confdefs.h"
 | 
			
		||||
 
 | 
			
		||||
 #if HAVE_DLFCN_H
 | 
			
		||||
@@ -11117,7 +11121,7 @@ else
 | 
			
		||||
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 | 
			
		||||
   lt_status=$lt_dlunknown
 | 
			
		||||
   cat > conftest.$ac_ext <<_LT_EOF
 | 
			
		||||
-#line 11096 "configure"
 | 
			
		||||
+#line 11100 "configure"
 | 
			
		||||
 #include "confdefs.h"
 | 
			
		||||
 
 | 
			
		||||
 #if HAVE_DLFCN_H
 | 
			
		||||
@@ -11771,6 +11775,20 @@ if test "${enable_elf_stt_common+set}" =
 | 
			
		||||
 esac
 | 
			
		||||
 fi
 | 
			
		||||
 
 | 
			
		||||
+
 | 
			
		||||
+# Decide if the ELF assembler should default to generating
 | 
			
		||||
+# GNU Build notes if none are provided by the input.
 | 
			
		||||
+ac_default_generate_build_notes=0
 | 
			
		||||
+# Provide a configuration option to override the default.
 | 
			
		||||
+# Check whether --enable-generate_build_notes was given.
 | 
			
		||||
+if test "${enable_generate_build_notes+set}" = set; then :
 | 
			
		||||
+  enableval=$enable_generate_build_notes; case "${enableval}" in
 | 
			
		||||
+  yes)  ac_default_generate_build_notes=1 ;;
 | 
			
		||||
+  no)   ac_default_generate_build_notes=0 ;;
 | 
			
		||||
+esac
 | 
			
		||||
+fi
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
 using_cgen=no
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
@@ -12713,6 +12731,12 @@ cat >>confdefs.h <<_ACEOF
 | 
			
		||||
 _ACEOF
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
+
 | 
			
		||||
+cat >>confdefs.h <<_ACEOF
 | 
			
		||||
+#define DEFAULT_GENERATE_BUILD_NOTES $ac_default_generate_build_notes
 | 
			
		||||
+_ACEOF
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
 if test x$ac_default_compressed_debug_sections = xyes ; then
 | 
			
		||||
 
 | 
			
		||||
 $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h
 | 
			
		||||
diff -rup binutils.orig/gas/configure.ac binutils-2.30/gas/configure.ac
 | 
			
		||||
--- binutils.orig/gas/configure.ac	2018-04-26 15:14:17.645459519 +0100
 | 
			
		||||
+++ binutils-2.30/gas/configure.ac	2018-04-26 15:14:31.928287462 +0100
 | 
			
		||||
@@ -100,6 +100,20 @@ AC_ARG_ENABLE(elf_stt_common,
 | 
			
		||||
   yes)  ac_default_elf_stt_common=1 ;;
 | 
			
		||||
 esac])dnl
 | 
			
		||||
 
 | 
			
		||||
+
 | 
			
		||||
+# Decide if the ELF assembler should default to generating
 | 
			
		||||
+# GNU Build notes if none are provided by the input.
 | 
			
		||||
+ac_default_generate_build_notes=0
 | 
			
		||||
+# Provide a configuration option to override the default.
 | 
			
		||||
+AC_ARG_ENABLE(generate_build_notes,
 | 
			
		||||
+	      AS_HELP_STRING([--enable-generate-build-notes],
 | 
			
		||||
+	      [generate GNU Build notes if none are provided by the input]),
 | 
			
		||||
+[case "${enableval}" in
 | 
			
		||||
+  yes)  ac_default_generate_build_notes=1 ;;
 | 
			
		||||
+  no)   ac_default_generate_build_notes=0 ;;
 | 
			
		||||
+esac])dnl
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
 using_cgen=no
 | 
			
		||||
 
 | 
			
		||||
 AM_BINUTILS_WARNINGS
 | 
			
		||||
@@ -610,6 +624,11 @@ AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_ELF_
 | 
			
		||||
   [Define to 1 if you want to generate ELF common symbols with the
 | 
			
		||||
    STT_COMMON type by default.])
 | 
			
		||||
 
 | 
			
		||||
+AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_BUILD_NOTES,
 | 
			
		||||
+  $ac_default_generate_build_notes,
 | 
			
		||||
+  [Define to 1 if you want to generate GNU Build attribute notes
 | 
			
		||||
+   by default, if none are contained in the input.])
 | 
			
		||||
+
 | 
			
		||||
 if test x$ac_default_compressed_debug_sections = xyes ; then
 | 
			
		||||
   AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
 | 
			
		||||
 fi
 | 
			
		||||
Only in binutils-2.30/gas: configure.ac.orig
 | 
			
		||||
Only in binutils-2.30/gas: configure.orig
 | 
			
		||||
diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo
 | 
			
		||||
--- binutils.orig/gas/doc/as.texinfo	2018-04-26 15:14:17.665459278 +0100
 | 
			
		||||
+++ binutils-2.30/gas/doc/as.texinfo	2018-04-26 15:14:31.929287450 +0100
 | 
			
		||||
@@ -244,6 +244,7 @@ gcc(1), ld(1), and the Info entries for
 | 
			
		||||
  [@b{-Z}] [@b{@@@var{FILE}}]
 | 
			
		||||
  [@b{--sectname-subst}] [@b{--size-check=[error|warning]}]
 | 
			
		||||
  [@b{--elf-stt-common=[no|yes]}]
 | 
			
		||||
+ [@b{--generate-missing-build-notes=[no|yes]}]
 | 
			
		||||
  [@b{--target-help}] [@var{target-options}]
 | 
			
		||||
  [@b{--}|@var{files} @dots{}]
 | 
			
		||||
 @c
 | 
			
		||||
@@ -754,6 +755,14 @@ Issue an error or warning for invalid EL
 | 
			
		||||
 These options control whether the ELF assembler should generate common
 | 
			
		||||
 symbols with the @code{STT_COMMON} type.  The default can be controlled
 | 
			
		||||
 by a configure option @option{--enable-elf-stt-common}.
 | 
			
		||||
+
 | 
			
		||||
+@item --generate-missing-build-notes=yes
 | 
			
		||||
+@itemx --generate-missing-build-notes=no
 | 
			
		||||
+These options control whether the ELF assembler should generate GNU Build
 | 
			
		||||
+attribute notes if none are present in the input sources.
 | 
			
		||||
+The default can be controlled by the @option{--enable-generate-build-notes}
 | 
			
		||||
+configure option.
 | 
			
		||||
+
 | 
			
		||||
 @end ifset
 | 
			
		||||
 
 | 
			
		||||
 @item --help
 | 
			
		||||
Only in binutils-2.30/gas/doc: as.texinfo.orig
 | 
			
		||||
diff -rup binutils.orig/gas/NEWS binutils-2.30/gas/NEWS
 | 
			
		||||
--- binutils.orig/gas/NEWS	2018-04-26 15:14:17.646459507 +0100
 | 
			
		||||
+++ binutils-2.30/gas/NEWS	2018-04-26 15:15:32.276560482 +0100
 | 
			
		||||
@@ -1,5 +1,11 @@
 | 
			
		||||
 -*- text -*-
 | 
			
		||||
 
 | 
			
		||||
+* Add --generate-missing-build-notes=[yes|no] option to create (or not) GNU
 | 
			
		||||
+  Build Attribute notes if none are present in the input sources.  Add a
 | 
			
		||||
+  --enable-generate-build-notes=[yes|no] configure time option to set the
 | 
			
		||||
+  default behaviour.  Set the default if the configure option is not used
 | 
			
		||||
+  to "no".
 | 
			
		||||
+
 | 
			
		||||
 Changes in 2.30:
 | 
			
		||||
 
 | 
			
		||||
 * Add support for loaction views in DWARF debug line information.
 | 
			
		||||
Only in binutils-2.30/gas: NEWS.orig
 | 
			
		||||
Only in binutils-2.30/gas: NEWS.rej
 | 
			
		||||
diff -rup binutils.orig/gas/symbols.c binutils-2.30/gas/symbols.c
 | 
			
		||||
--- binutils.orig/gas/symbols.c	2018-04-26 15:14:17.667459254 +0100
 | 
			
		||||
+++ binutils-2.30/gas/symbols.c	2018-04-26 15:14:31.929287450 +0100
 | 
			
		||||
@@ -108,6 +108,7 @@ save_symbol_name (const char *name)
 | 
			
		||||
   size_t name_length;
 | 
			
		||||
   char *ret;
 | 
			
		||||
 
 | 
			
		||||
+  gas_assert (name != NULL);
 | 
			
		||||
   name_length = strlen (name) + 1;	/* +1 for \0.  */
 | 
			
		||||
   obstack_grow (¬es, name, name_length);
 | 
			
		||||
   ret = (char *) obstack_finish (¬es);
 | 
			
		||||
diff -rup binutils.orig/gas/write.c binutils-2.30/gas/write.c
 | 
			
		||||
--- binutils.orig/gas/write.c	2018-04-26 15:14:18.296451677 +0100
 | 
			
		||||
+++ binutils-2.30/gas/write.c	2018-04-26 15:14:31.929287450 +0100
 | 
			
		||||
@@ -1822,25 +1822,200 @@ create_obj_attrs_section (void)
 | 
			
		||||
   const char *name;
 | 
			
		||||
 
 | 
			
		||||
   size = bfd_elf_obj_attr_size (stdoutput);
 | 
			
		||||
-  if (size)
 | 
			
		||||
+  if (size == 0)
 | 
			
		||||
+    return;
 | 
			
		||||
+
 | 
			
		||||
+  name = get_elf_backend_data (stdoutput)->obj_attrs_section;
 | 
			
		||||
+  if (!name)
 | 
			
		||||
+    name = ".gnu.attributes";
 | 
			
		||||
+  s = subseg_new (name, 0);
 | 
			
		||||
+  elf_section_type (s)
 | 
			
		||||
+    = get_elf_backend_data (stdoutput)->obj_attrs_section_type;
 | 
			
		||||
+  bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA);
 | 
			
		||||
+  frag_now_fix ();
 | 
			
		||||
+  p = frag_more (size);
 | 
			
		||||
+  bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size);
 | 
			
		||||
+
 | 
			
		||||
+  subsegs_finish_section (s);
 | 
			
		||||
+  relax_segment (seg_info (s)->frchainP->frch_root, s, 0);
 | 
			
		||||
+  size_seg (stdoutput, s, NULL);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+#include "struc-symbol.h"
 | 
			
		||||
+
 | 
			
		||||
+/* Create a relocation against an entry in a GNU Build attribute section.  */
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+create_note_reloc (segT           sec,
 | 
			
		||||
+		   symbolS *      sym,
 | 
			
		||||
+		   bfd_size_type  offset,
 | 
			
		||||
+		   int            reloc_type,
 | 
			
		||||
+		   bfd_vma        addend,
 | 
			
		||||
+		   char *         note)
 | 
			
		||||
+{
 | 
			
		||||
+  struct reloc_list * reloc;
 | 
			
		||||
+
 | 
			
		||||
+  reloc = XNEW (struct reloc_list);
 | 
			
		||||
+
 | 
			
		||||
+  /* We create a .b type reloc as resolve_reloc_expr_symbols() has already been called.  */
 | 
			
		||||
+  reloc->u.b.sec   = sec;
 | 
			
		||||
+  reloc->u.b.s     = sym->bsym;
 | 
			
		||||
+  reloc->u.b.r.sym_ptr_ptr = & reloc->u.b.s;
 | 
			
		||||
+  reloc->u.b.r.address     = offset;
 | 
			
		||||
+  reloc->u.b.r.addend      = addend;
 | 
			
		||||
+  reloc->u.b.r.howto       = bfd_reloc_type_lookup (stdoutput, reloc_type);
 | 
			
		||||
+
 | 
			
		||||
+  if (reloc->u.b.r.howto == NULL)
 | 
			
		||||
     {
 | 
			
		||||
-      name = get_elf_backend_data (stdoutput)->obj_attrs_section;
 | 
			
		||||
-      if (!name)
 | 
			
		||||
-	name = ".gnu.attributes";
 | 
			
		||||
-      s = subseg_new (name, 0);
 | 
			
		||||
-      elf_section_type (s)
 | 
			
		||||
-	= get_elf_backend_data (stdoutput)->obj_attrs_section_type;
 | 
			
		||||
-      bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA);
 | 
			
		||||
-      frag_now_fix ();
 | 
			
		||||
-      p = frag_more (size);
 | 
			
		||||
-      bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size);
 | 
			
		||||
-
 | 
			
		||||
-      subsegs_finish_section (s);
 | 
			
		||||
-      relax_segment (seg_info (s)->frchainP->frch_root, s, 0);
 | 
			
		||||
-      size_seg (stdoutput, s, NULL);
 | 
			
		||||
+      as_bad (_("unable to create reloc for build note"));
 | 
			
		||||
+      return;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+  reloc->file = N_("<gnu build note>");
 | 
			
		||||
+  reloc->line = 0;
 | 
			
		||||
+
 | 
			
		||||
+  reloc->next = reloc_list;
 | 
			
		||||
+  reloc_list = reloc;
 | 
			
		||||
+
 | 
			
		||||
+  /* For REL relocs, store the addend in the section.  */
 | 
			
		||||
+  if (! sec->use_rela_p
 | 
			
		||||
+      /* The SH target is a special case that uses RELA relocs
 | 
			
		||||
+	 but still stores the addend in the word being relocated.  */
 | 
			
		||||
+      || strstr (bfd_get_target (stdoutput), "-sh") != NULL)
 | 
			
		||||
+    {
 | 
			
		||||
+      if (target_big_endian)
 | 
			
		||||
+	{
 | 
			
		||||
+	  if (bfd_arch_bits_per_address (stdoutput) <= 32)
 | 
			
		||||
+	    note[offset + 3] = addend;
 | 
			
		||||
+	  else
 | 
			
		||||
+	    note[offset + 7] = addend;
 | 
			
		||||
+	}
 | 
			
		||||
+      else
 | 
			
		||||
+	note[offset] = addend;
 | 
			
		||||
     }
 | 
			
		||||
 }
 | 
			
		||||
-#endif
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+maybe_generate_build_notes (void)
 | 
			
		||||
+{
 | 
			
		||||
+  segT      sec;
 | 
			
		||||
+  char *    note;
 | 
			
		||||
+  offsetT   note_size;
 | 
			
		||||
+  offsetT   desc_size;
 | 
			
		||||
+  offsetT   desc2_offset;
 | 
			
		||||
+  int       desc_reloc;
 | 
			
		||||
+  symbolS * sym;
 | 
			
		||||
+
 | 
			
		||||
+  if (! flag_generate_build_notes
 | 
			
		||||
+      || bfd_get_section_by_name (stdoutput,
 | 
			
		||||
+				  GNU_BUILD_ATTRS_SECTION_NAME) != NULL)
 | 
			
		||||
+    return;
 | 
			
		||||
+
 | 
			
		||||
+  /* Create a GNU Build Attribute section.  */
 | 
			
		||||
+  sec = subseg_new (GNU_BUILD_ATTRS_SECTION_NAME, FALSE);
 | 
			
		||||
+  elf_section_type (sec) = SHT_NOTE;
 | 
			
		||||
+  bfd_set_section_flags (stdoutput, sec,
 | 
			
		||||
+			 SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA);
 | 
			
		||||
+  bfd_set_section_alignment (stdoutput, sec, 2);
 | 
			
		||||
+
 | 
			
		||||
+  /* Create a version note.  */
 | 
			
		||||
+  if (bfd_arch_bits_per_address (stdoutput) <= 32)
 | 
			
		||||
+    {
 | 
			
		||||
+      note_size = 28;
 | 
			
		||||
+      desc_size = 8; /* Two 4-byte offsets.  */
 | 
			
		||||
+      desc2_offset = 24;
 | 
			
		||||
+
 | 
			
		||||
+      /* FIXME: The BFD backend for the CRX target does not support the
 | 
			
		||||
+	 BFD_RELOC_32, even though it really should.  Likewise for the
 | 
			
		||||
+	 CR16 target.  So we have special case code here...  */
 | 
			
		||||
+      if (strstr (bfd_get_target (stdoutput), "-crx") != NULL)
 | 
			
		||||
+	desc_reloc = BFD_RELOC_CRX_NUM32;
 | 
			
		||||
+      else if (strstr (bfd_get_target (stdoutput), "-cr16") != NULL)
 | 
			
		||||
+	desc_reloc = BFD_RELOC_CR16_NUM32;
 | 
			
		||||
+      else
 | 
			
		||||
+	desc_reloc = BFD_RELOC_32;
 | 
			
		||||
+    }
 | 
			
		||||
+  else
 | 
			
		||||
+    {
 | 
			
		||||
+      note_size = 36;
 | 
			
		||||
+      desc_size = 16; /* Two  8-byte offsets.  */
 | 
			
		||||
+      desc2_offset = 28;
 | 
			
		||||
+      /* FIXME: The BFD backend for the IA64 target does not support the
 | 
			
		||||
+	 BFD_RELOC_64, even though it really should.  The HPPA backend
 | 
			
		||||
+	 has a similar issue, although it does not support BFD_RELOCs at
 | 
			
		||||
+	 all!  So we have special case code to handle these targets.  */
 | 
			
		||||
+      if (strstr (bfd_get_target (stdoutput), "-ia64") != NULL)
 | 
			
		||||
+	desc_reloc = target_big_endian ? BFD_RELOC_IA64_DIR32MSB : BFD_RELOC_IA64_DIR32LSB;
 | 
			
		||||
+      else if (strstr (bfd_get_target (stdoutput), "-hppa") != NULL)
 | 
			
		||||
+	desc_reloc = 80; /* R_PARISC_DIR64.  */
 | 
			
		||||
+      else
 | 
			
		||||
+	desc_reloc = BFD_RELOC_64;
 | 
			
		||||
+    }
 | 
			
		||||
+  
 | 
			
		||||
+  frag_now_fix ();
 | 
			
		||||
+  note = frag_more (note_size);
 | 
			
		||||
+  memset (note, 0, note_size);
 | 
			
		||||
+
 | 
			
		||||
+  if (target_big_endian)
 | 
			
		||||
+    {
 | 
			
		||||
+      note[3] = 8; /* strlen (name) + 1.  */
 | 
			
		||||
+      note[7] = desc_size; /* Two 8-byte offsets.  */
 | 
			
		||||
+      note[10] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8;
 | 
			
		||||
+      note[11] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff;
 | 
			
		||||
+    }
 | 
			
		||||
+  else
 | 
			
		||||
+    {
 | 
			
		||||
+      note[0] = 8; /* strlen (name) + 1.  */
 | 
			
		||||
+      note[4] = desc_size; /* Two 8-byte offsets.  */
 | 
			
		||||
+      note[8] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff;
 | 
			
		||||
+      note[9] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+  /* The a1 version number indicates that this note was
 | 
			
		||||
+     generated by the assembler and not the gcc annobin plugin.  */
 | 
			
		||||
+  memcpy (note + 12, "GA$3a1", 8);
 | 
			
		||||
+
 | 
			
		||||
+  /* Find the first code section symbol.  */
 | 
			
		||||
+  for (sym = symbol_rootP; sym != NULL; sym = sym->sy_next)
 | 
			
		||||
+    if (sym->bsym != NULL
 | 
			
		||||
+	&& sym->bsym->flags & BSF_SECTION_SYM
 | 
			
		||||
+	&& sym->bsym->section != NULL
 | 
			
		||||
+	&& sym->bsym->section->flags & SEC_CODE)
 | 
			
		||||
+      {
 | 
			
		||||
+	/* Found one - now create a relocation against this symbol.  */
 | 
			
		||||
+	create_note_reloc (sec, sym, 20, desc_reloc, 0, note);
 | 
			
		||||
+	break;
 | 
			
		||||
+      }
 | 
			
		||||
+
 | 
			
		||||
+  /* Find the last code section symbol.  */
 | 
			
		||||
+  if (sym)
 | 
			
		||||
+    {
 | 
			
		||||
+      for (sym = symbol_lastP; sym != NULL; sym = sym->sy_previous)
 | 
			
		||||
+	if (sym->bsym != NULL
 | 
			
		||||
+	    && sym->bsym->flags & BSF_SECTION_SYM
 | 
			
		||||
+	    && sym->bsym->section != NULL
 | 
			
		||||
+	    && sym->bsym->section->flags & SEC_CODE)
 | 
			
		||||
+	  {
 | 
			
		||||
+	    /* Create a relocation against the end of this symbol.  */
 | 
			
		||||
+	    create_note_reloc (sec, sym, desc2_offset, desc_reloc,
 | 
			
		||||
+			       bfd_get_section_size (sym->bsym->section),
 | 
			
		||||
+			       note);
 | 
			
		||||
+	    break;
 | 
			
		||||
+	  }
 | 
			
		||||
+    }
 | 
			
		||||
+  /* else - if we were unable to find any code section symbols then
 | 
			
		||||
+     probably there is no code in the output.  So leaving the start
 | 
			
		||||
+     and end values as zero in the note is OK.  */
 | 
			
		||||
+
 | 
			
		||||
+  /* FIXME: Maybe add a note recording the assembler command line and version ?  */
 | 
			
		||||
+
 | 
			
		||||
+  /* Install the note(s) into the section.  */
 | 
			
		||||
+  bfd_set_section_contents (stdoutput, sec, (bfd_byte *) note, 0, note_size);
 | 
			
		||||
+  subsegs_finish_section (sec);
 | 
			
		||||
+  relax_segment (seg_info (sec)->frchainP->frch_root, sec, 0);
 | 
			
		||||
+  size_seg (stdoutput, sec, NULL);
 | 
			
		||||
+}
 | 
			
		||||
+#endif /* OBJ_ELF */
 | 
			
		||||
 
 | 
			
		||||
 /* Write the object file.  */
 | 
			
		||||
 
 | 
			
		||||
@@ -2052,6 +2227,11 @@ write_object_file (void)
 | 
			
		||||
   resolve_local_symbol_values ();
 | 
			
		||||
   resolve_reloc_expr_symbols ();
 | 
			
		||||
 
 | 
			
		||||
+#ifdef OBJ_ELF
 | 
			
		||||
+  if (IS_ELF)
 | 
			
		||||
+    maybe_generate_build_notes ();
 | 
			
		||||
+#endif
 | 
			
		||||
+  
 | 
			
		||||
   PROGRESS (1);
 | 
			
		||||
 
 | 
			
		||||
 #ifdef tc_frob_file_before_adjust
 | 
			
		||||
Only in binutils-2.30/gas: write.c.orig
 | 
			
		||||
Only in binutils-2.30: testsuite
 | 
			
		||||
--- /dev/null	2018-04-26 08:07:19.307057583 +0100
 | 
			
		||||
+++ binutils-2.30/binutils/testsuite/binutils-all/note-5.d	2018-04-26 15:17:06.318427614 +0100
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
+#PROG: objcopy
 | 
			
		||||
+#as: --generate-missing-build-notes=yes
 | 
			
		||||
+#readelf: --notes --wide
 | 
			
		||||
+#name: assembler generated build notes
 | 
			
		||||
+#source: note-5.s
 | 
			
		||||
+
 | 
			
		||||
+#...
 | 
			
		||||
+Displaying notes found in: .gnu.build.attributes
 | 
			
		||||
+[ 	]+Owner[ 	]+Data size[ 	]+Description
 | 
			
		||||
+[ 	]+GA\$<version>3a1[ 	]+0x000000(08|10)[ 	]+OPEN[ 	]+Applies to region from 0 to 0x.. \(note_5.s\)
 | 
			
		||||
+#...
 | 
			
		||||
--- /dev/null	2018-04-26 08:07:19.307057583 +0100
 | 
			
		||||
+++ binutils-2.30/binutils/testsuite/binutils-all/note-5.s	2018-04-26 15:17:06.318427614 +0100
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
+	.text
 | 
			
		||||
+	.global note_5.s
 | 
			
		||||
+note_5.s:
 | 
			
		||||
+	.dc.l	2
 | 
			
		||||
+	.dc.l	4
 | 
			
		||||
+	.dc.l	6
 | 
			
		||||
+	.dc.l	8
 | 
			
		||||
+	.dc.l	8
 | 
			
		||||
+	.dc.l	8
 | 
			
		||||
+	.dc.l	8
 | 
			
		||||
+	.dc.l	8
 | 
			
		||||
+	.dc.l	8
 | 
			
		||||
+	.dc.l	8
 | 
			
		||||
+	
 | 
			
		||||
\ No newline at end of file
 | 
			
		||||
							
								
								
									
										296
									
								
								binutils-ifunc-relocs-in-notes.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										296
									
								
								binutils-ifunc-relocs-in-notes.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,296 @@
 | 
			
		||||
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c
 | 
			
		||||
--- binutils.orig/bfd/elf32-i386.c	2018-03-09 14:43:05.324208873 +0000
 | 
			
		||||
+++ binutils-2.30/bfd/elf32-i386.c	2018-03-09 14:43:23.158000456 +0000
 | 
			
		||||
@@ -2202,12 +2202,19 @@ elf_i386_relocate_section (bfd *output_b
 | 
			
		||||
 
 | 
			
		||||
 	  if ((input_section->flags & SEC_ALLOC) == 0)
 | 
			
		||||
 	    {
 | 
			
		||||
+	      /* If this is a SHT_NOTE section without SHF_ALLOC, treat
 | 
			
		||||
+	         STT_GNU_IFUNC symbol as STT_FUNC.  */
 | 
			
		||||
+	      if (elf_section_type (input_section) == SHT_NOTE)
 | 
			
		||||
+		goto skip_ifunc;
 | 
			
		||||
 	      /* Dynamic relocs are not propagated for SEC_DEBUGGING
 | 
			
		||||
 		 sections because such sections are not SEC_ALLOC and
 | 
			
		||||
 		 thus ld.so will not process them.  */
 | 
			
		||||
 	      if ((input_section->flags & SEC_DEBUGGING) != 0)
 | 
			
		||||
 		continue;
 | 
			
		||||
-	      abort ();
 | 
			
		||||
+	      _bfd_error_handler (_("%B: error: relocation againt ifunc symbol in non-alloc section %A"),
 | 
			
		||||
+				  input_bfd, input_section);
 | 
			
		||||
+	      bfd_set_error (bfd_error_invalid_operation);
 | 
			
		||||
+	      return FALSE;
 | 
			
		||||
 	    }
 | 
			
		||||
 
 | 
			
		||||
 	  /* STT_GNU_IFUNC symbol must go through PLT.  */
 | 
			
		||||
@@ -2421,6 +2428,7 @@ do_ifunc_pointer:
 | 
			
		||||
 	    }
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+    skip_ifunc:
 | 
			
		||||
       resolved_to_zero = (eh != NULL
 | 
			
		||||
 			  && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh));
 | 
			
		||||
 
 | 
			
		||||
diff -rup binutils.orig/bfd/elf32-s390.c binutils-2.30/bfd/elf32-s390.c
 | 
			
		||||
--- binutils.orig/bfd/elf32-s390.c	2018-03-09 14:43:05.325208861 +0000
 | 
			
		||||
+++ binutils-2.30/bfd/elf32-s390.c	2018-03-09 14:43:31.353904647 +0000
 | 
			
		||||
@@ -2601,6 +2601,9 @@ elf_s390_relocate_section (bfd *output_b
 | 
			
		||||
 	case R_390_8:
 | 
			
		||||
 	case R_390_16:
 | 
			
		||||
 	case R_390_32:
 | 
			
		||||
+	  if ((input_section->flags & SEC_ALLOC) == 0)
 | 
			
		||||
+	    break;
 | 
			
		||||
+
 | 
			
		||||
 	  if (h != NULL
 | 
			
		||||
 	      && s390_is_ifunc_symbol_p (h)
 | 
			
		||||
 	      && h->def_regular)
 | 
			
		||||
@@ -2662,9 +2665,6 @@ elf_s390_relocate_section (bfd *output_b
 | 
			
		||||
 		}
 | 
			
		||||
 	    }
 | 
			
		||||
 
 | 
			
		||||
-	  if ((input_section->flags & SEC_ALLOC) == 0)
 | 
			
		||||
-	    break;
 | 
			
		||||
-
 | 
			
		||||
 	  if ((bfd_link_pic (info)
 | 
			
		||||
 	       && (h == NULL
 | 
			
		||||
 		   || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 | 
			
		||||
Only in binutils-2.30/bfd: elf32-s390.c.orig
 | 
			
		||||
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c
 | 
			
		||||
--- binutils.orig/bfd/elf64-s390.c	2018-03-09 14:43:05.341208674 +0000
 | 
			
		||||
+++ binutils-2.30/bfd/elf64-s390.c	2018-03-09 14:43:31.354904635 +0000
 | 
			
		||||
@@ -2559,6 +2559,9 @@ elf_s390_relocate_section (bfd *output_b
 | 
			
		||||
 	case R_390_32:
 | 
			
		||||
 	case R_390_64:
 | 
			
		||||
 
 | 
			
		||||
+	  if ((input_section->flags & SEC_ALLOC) == 0)
 | 
			
		||||
+	    break;
 | 
			
		||||
+
 | 
			
		||||
 	  if (h != NULL
 | 
			
		||||
 	      && s390_is_ifunc_symbol_p (h)
 | 
			
		||||
 	      && h->def_regular)
 | 
			
		||||
@@ -2621,9 +2624,6 @@ elf_s390_relocate_section (bfd *output_b
 | 
			
		||||
 		}
 | 
			
		||||
 	    }
 | 
			
		||||
 
 | 
			
		||||
-	  if ((input_section->flags & SEC_ALLOC) == 0)
 | 
			
		||||
-	    break;
 | 
			
		||||
-
 | 
			
		||||
 	  if ((bfd_link_pic (info)
 | 
			
		||||
 	       && (h == NULL
 | 
			
		||||
 		   || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 | 
			
		||||
Only in binutils-2.30/bfd: elf64-s390.c.orig
 | 
			
		||||
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c
 | 
			
		||||
--- binutils.orig/bfd/elf64-x86-64.c	2018-03-09 14:43:05.344208639 +0000
 | 
			
		||||
+++ binutils-2.30/bfd/elf64-x86-64.c	2018-03-09 14:43:23.161000420 +0000
 | 
			
		||||
@@ -2499,12 +2499,19 @@ elf_x86_64_relocate_section (bfd *output
 | 
			
		||||
 
 | 
			
		||||
 	  if ((input_section->flags & SEC_ALLOC) == 0)
 | 
			
		||||
 	    {
 | 
			
		||||
+	      /* If this is a SHT_NOTE section without SHF_ALLOC, treat
 | 
			
		||||
+	         STT_GNU_IFUNC symbol as STT_FUNC.  */
 | 
			
		||||
+	      if (elf_section_type (input_section) == SHT_NOTE)
 | 
			
		||||
+		goto skip_ifunc;
 | 
			
		||||
 	      /* Dynamic relocs are not propagated for SEC_DEBUGGING
 | 
			
		||||
 		 sections because such sections are not SEC_ALLOC and
 | 
			
		||||
 		 thus ld.so will not process them.  */
 | 
			
		||||
 	      if ((input_section->flags & SEC_DEBUGGING) != 0)
 | 
			
		||||
 		continue;
 | 
			
		||||
-	      abort ();
 | 
			
		||||
+	      _bfd_error_handler (_("%B: error: relocation againt ifunc symbol in non-alloc section %A"),
 | 
			
		||||
+				  input_bfd, input_section);
 | 
			
		||||
+	      bfd_set_error (bfd_error_invalid_operation);
 | 
			
		||||
+	      return FALSE;
 | 
			
		||||
 	    }
 | 
			
		||||
 
 | 
			
		||||
 	  switch (r_type)
 | 
			
		||||
@@ -2722,6 +2729,7 @@ do_ifunc_pointer:
 | 
			
		||||
 	    }
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+    skip_ifunc:
 | 
			
		||||
       resolved_to_zero = (eh != NULL
 | 
			
		||||
 			  && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh));
 | 
			
		||||
 
 | 
			
		||||
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
 | 
			
		||||
--- binutils.orig/bfd/elfnn-aarch64.c	2018-03-09 14:43:05.337208721 +0000
 | 
			
		||||
+++ binutils-2.30/bfd/elfnn-aarch64.c	2018-03-09 14:43:31.355904624 +0000
 | 
			
		||||
@@ -4987,6 +4987,11 @@ elfNN_aarch64_final_link_relocate (reloc
 | 
			
		||||
 
 | 
			
		||||
       if ((input_section->flags & SEC_ALLOC) == 0)
 | 
			
		||||
 	{
 | 
			
		||||
+	  /* If this is a SHT_NOTE section without SHF_ALLOC, treat
 | 
			
		||||
+	     STT_GNU_IFUNC symbol as STT_FUNC.  */
 | 
			
		||||
+	  if (elf_section_type (input_section) == SHT_NOTE)
 | 
			
		||||
+	    goto skip_ifunc;
 | 
			
		||||
+
 | 
			
		||||
 	  /* Dynamic relocs are not propagated for SEC_DEBUGGING
 | 
			
		||||
 	     sections because such sections are not SEC_ALLOC and
 | 
			
		||||
 	     thus ld.so will not process them.  */
 | 
			
		||||
@@ -5180,6 +5185,7 @@ bad_ifunc_reloc:
 | 
			
		||||
 	}
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
+ skip_ifunc:
 | 
			
		||||
   resolved_to_zero = (h != NULL
 | 
			
		||||
 		      && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
 | 
			
		||||
 
 | 
			
		||||
Only in binutils-2.30/bfd: elfnn-aarch64.c.orig
 | 
			
		||||
diff -rup binutils.orig/bfd/elfxx-sparc.c binutils-2.30/bfd/elfxx-sparc.c
 | 
			
		||||
--- binutils.orig/bfd/elfxx-sparc.c	2018-03-09 14:43:05.333208768 +0000
 | 
			
		||||
+++ binutils-2.30/bfd/elfxx-sparc.c	2018-03-09 14:43:31.355904624 +0000
 | 
			
		||||
@@ -3026,7 +3026,13 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 | 
			
		||||
 
 | 
			
		||||
 	  if ((input_section->flags & SEC_ALLOC) == 0
 | 
			
		||||
 	      || h->plt.offset == (bfd_vma) -1)
 | 
			
		||||
-	    abort ();
 | 
			
		||||
+	    {
 | 
			
		||||
+	      /* If this is a SHT_NOTE section without SHF_ALLOC, treat
 | 
			
		||||
+	         STT_GNU_IFUNC symbol as STT_FUNC.  */
 | 
			
		||||
+	      if (elf_section_type (input_section) == SHT_NOTE)
 | 
			
		||||
+		goto skip_ifunc;
 | 
			
		||||
+	      abort ();
 | 
			
		||||
+	    }
 | 
			
		||||
 
 | 
			
		||||
 	  plt_sec = htab->elf.splt;
 | 
			
		||||
 	  if (! plt_sec)
 | 
			
		||||
@@ -3130,6 +3136,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 | 
			
		||||
 	    }
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+    skip_ifunc:
 | 
			
		||||
       eh = (struct _bfd_sparc_elf_link_hash_entry *) h;
 | 
			
		||||
       resolved_to_zero = (eh != NULL
 | 
			
		||||
 			  && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh));
 | 
			
		||||
Only in binutils-2.30/bfd: elfxx-sparc.c.orig
 | 
			
		||||
diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp
 | 
			
		||||
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp	2018-03-09 14:43:04.844214486 +0000
 | 
			
		||||
+++ binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp	2018-03-09 14:43:31.355904624 +0000
 | 
			
		||||
@@ -47,6 +47,9 @@ if ![check_shared_lib_support] {
 | 
			
		||||
     return
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+# This test does not need a compiler...
 | 
			
		||||
+run_dump_test "ifuncmod5"
 | 
			
		||||
+
 | 
			
		||||
 # We need a working compiler.  (Strictly speaking this is
 | 
			
		||||
 # not true, we could use target specific assembler files).
 | 
			
		||||
 if { [which $CC] == 0 } {
 | 
			
		||||
Only in binutils-2.30: testsuite
 | 
			
		||||
--- /dev/null	2018-03-09 07:59:09.608015200 +0000
 | 
			
		||||
+++ binutils-2.30/ld/testsuite/ld-ifunc/ifuncmod5.s	2018-03-09 14:45:45.698334500 +0000
 | 
			
		||||
@@ -0,0 +1,105 @@
 | 
			
		||||
+	.file	"ifuncmod5.c"
 | 
			
		||||
+
 | 
			
		||||
+	.text
 | 
			
		||||
+	.type ifuncmod5.c, STT_NOTYPE
 | 
			
		||||
+ifuncmod5.c:
 | 
			
		||||
+	.size ifuncmod5.c, 0
 | 
			
		||||
+
 | 
			
		||||
+	.pushsection .gnu.build.attributes, "", %note
 | 
			
		||||
+	.balign 4
 | 
			
		||||
+	.dc.l 8 	
 | 
			
		||||
+	.dc.l 16	
 | 
			
		||||
+	.dc.l 0x100	
 | 
			
		||||
+	.asciz "GA$3p4"	
 | 
			
		||||
+	.dc.a ifuncmod5.c
 | 
			
		||||
+	.dc.a ifuncmod5.c_end	
 | 
			
		||||
+	.popsection
 | 
			
		||||
+
 | 
			
		||||
+.Ltext0:
 | 
			
		||||
+#APP
 | 
			
		||||
+	.protected global
 | 
			
		||||
+	.type foo, %gnu_indirect_function
 | 
			
		||||
+	.type foo_hidden, %gnu_indirect_function
 | 
			
		||||
+	.type foo_protected, %gnu_indirect_function
 | 
			
		||||
+	.hidden foo_hidden
 | 
			
		||||
+	.protected foo_protected
 | 
			
		||||
+#NO_APP
 | 
			
		||||
+	.align	8
 | 
			
		||||
+	.type	one, %function
 | 
			
		||||
+one:
 | 
			
		||||
+	.dc.l 0
 | 
			
		||||
+	.size	one, .-one
 | 
			
		||||
+	.align	8
 | 
			
		||||
+
 | 
			
		||||
+.globl foo
 | 
			
		||||
+	.type	foo, %function
 | 
			
		||||
+foo:
 | 
			
		||||
+	.dc.l	0
 | 
			
		||||
+	.size	foo, .-foo
 | 
			
		||||
+
 | 
			
		||||
+	.pushsection .gnu.build.attributes
 | 
			
		||||
+	.dc.l 6		
 | 
			
		||||
+	.dc.l 16	
 | 
			
		||||
+	.dc.l 0x101	
 | 
			
		||||
+	.dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 	
 | 
			
		||||
+	.dc.b 0, 0 	
 | 
			
		||||
+	.dc.a foo
 | 
			
		||||
+	.dc.a foo_end	
 | 
			
		||||
+	.popsection
 | 
			
		||||
+
 | 
			
		||||
+foo_end:
 | 
			
		||||
+	.align	8
 | 
			
		||||
+.globl foo_hidden
 | 
			
		||||
+	.type	foo_hidden, %function
 | 
			
		||||
+foo_hidden:
 | 
			
		||||
+	.dc.l	0
 | 
			
		||||
+	.size	foo_hidden, .-foo_hidden
 | 
			
		||||
+
 | 
			
		||||
+	.pushsection .gnu.build.attributes
 | 
			
		||||
+	.dc.l 6		
 | 
			
		||||
+	.dc.l 16	
 | 
			
		||||
+	.dc.l 0x101	
 | 
			
		||||
+	.dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 	
 | 
			
		||||
+	.dc.b 0, 0 	
 | 
			
		||||
+	.dc.a foo_hidden
 | 
			
		||||
+	.dc.a foo_hidden_end	
 | 
			
		||||
+	.popsection
 | 
			
		||||
+
 | 
			
		||||
+foo_hidden_end:
 | 
			
		||||
+	.align	8
 | 
			
		||||
+
 | 
			
		||||
+	.globl foo_protected
 | 
			
		||||
+	.type	foo_protected, %function
 | 
			
		||||
+foo_protected:
 | 
			
		||||
+	.dc.l	0
 | 
			
		||||
+
 | 
			
		||||
+	.size	foo_protected, .-foo_protected
 | 
			
		||||
+
 | 
			
		||||
+	.pushsection .gnu.build.attributes
 | 
			
		||||
+	.dc.l 6		
 | 
			
		||||
+	.dc.l 16	
 | 
			
		||||
+	.dc.l 0x101	
 | 
			
		||||
+	.dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 	
 | 
			
		||||
+	.dc.b 0, 0 	
 | 
			
		||||
+	.dc.a foo_protected
 | 
			
		||||
+	.dc.a foo_protected_end	
 | 
			
		||||
+	.popsection
 | 
			
		||||
+
 | 
			
		||||
+foo_protected_end:
 | 
			
		||||
+	.globl global
 | 
			
		||||
+
 | 
			
		||||
+	.data
 | 
			
		||||
+	.align	4
 | 
			
		||||
+	.type	global, %object
 | 
			
		||||
+	.size	global, 4
 | 
			
		||||
+global:
 | 
			
		||||
+	.long	-1
 | 
			
		||||
+
 | 
			
		||||
+	.text
 | 
			
		||||
+	.Letext0:
 | 
			
		||||
+
 | 
			
		||||
+ifuncmod5.c_end:
 | 
			
		||||
+	.type ifuncmod5.c_end, STT_NOTYPE
 | 
			
		||||
+	.size ifuncmod5.c_end, 0
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
--- /dev/null	2018-03-09 07:59:09.608015200 +0000
 | 
			
		||||
+++ binutils-2.30/ld/testsuite/ld-ifunc/ifuncmod5.d	2018-03-09 14:45:45.698334500 +0000
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
+# name: Reloc against IFUNC symbol in NOTE section
 | 
			
		||||
+# ld: -shared
 | 
			
		||||
+# nm: -p
 | 
			
		||||
+
 | 
			
		||||
+# We do not actually care about the notes at the moment.
 | 
			
		||||
+# The purpose of this test is to make sure that the link completes successfully.
 | 
			
		||||
+#pass
 | 
			
		||||
+
 | 
			
		||||
							
								
								
									
										2075
									
								
								binutils-improved-note-merging.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2075
									
								
								binutils-improved-note-merging.patch
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										127
									
								
								binutils-linkonce-notes.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								binutils-linkonce-notes.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,127 @@
 | 
			
		||||
--- binutils.orig/gas/write.c	2018-05-14 12:22:27.893671804 +0100
 | 
			
		||||
+++ binutils-2.30/gas/write.c	2018-05-14 15:39:03.900509629 +0100
 | 
			
		||||
@@ -1901,6 +1901,7 @@ maybe_generate_build_notes (void)
 | 
			
		||||
   segT      sec;
 | 
			
		||||
   char *    note;
 | 
			
		||||
   offsetT   note_size;
 | 
			
		||||
+  offsetT   total_size;
 | 
			
		||||
   offsetT   desc_size;
 | 
			
		||||
   offsetT   desc2_offset;
 | 
			
		||||
   int       desc_reloc;
 | 
			
		||||
@@ -1918,7 +1919,8 @@ maybe_generate_build_notes (void)
 | 
			
		||||
 			 SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA);
 | 
			
		||||
   bfd_set_section_alignment (stdoutput, sec, 2);
 | 
			
		||||
 
 | 
			
		||||
-  /* Create a version note.  */
 | 
			
		||||
+  /* Work out the size of the notes that we will create,
 | 
			
		||||
+     and the relocation we should use.  */
 | 
			
		||||
   if (bfd_arch_bits_per_address (stdoutput) <= 32)
 | 
			
		||||
     {
 | 
			
		||||
       note_size = 28;
 | 
			
		||||
@@ -1952,65 +1954,59 @@ maybe_generate_build_notes (void)
 | 
			
		||||
 	desc_reloc = BFD_RELOC_64;
 | 
			
		||||
     }
 | 
			
		||||
   
 | 
			
		||||
-  frag_now_fix ();
 | 
			
		||||
-  note = frag_more (note_size);
 | 
			
		||||
-  memset (note, 0, note_size);
 | 
			
		||||
+  /* We have to create a note for *each* code section.
 | 
			
		||||
+     Linker garbage collection might discard some.  */
 | 
			
		||||
+  total_size = 0;
 | 
			
		||||
+  note = NULL;
 | 
			
		||||
 
 | 
			
		||||
-  if (target_big_endian)
 | 
			
		||||
-    {
 | 
			
		||||
-      note[3] = 8; /* strlen (name) + 1.  */
 | 
			
		||||
-      note[7] = desc_size; /* Two 8-byte offsets.  */
 | 
			
		||||
-      note[10] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8;
 | 
			
		||||
-      note[11] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff;
 | 
			
		||||
-    }
 | 
			
		||||
-  else
 | 
			
		||||
-    {
 | 
			
		||||
-      note[0] = 8; /* strlen (name) + 1.  */
 | 
			
		||||
-      note[4] = desc_size; /* Two 8-byte offsets.  */
 | 
			
		||||
-      note[8] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff;
 | 
			
		||||
-      note[9] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8;
 | 
			
		||||
-    }
 | 
			
		||||
-
 | 
			
		||||
-  /* The a1 version number indicates that this note was
 | 
			
		||||
-     generated by the assembler and not the gcc annobin plugin.  */
 | 
			
		||||
-  memcpy (note + 12, "GA$3a1", 8);
 | 
			
		||||
-
 | 
			
		||||
-  /* Find the first code section symbol.  */
 | 
			
		||||
   for (sym = symbol_rootP; sym != NULL; sym = sym->sy_next)
 | 
			
		||||
     if (sym->bsym != NULL
 | 
			
		||||
 	&& sym->bsym->flags & BSF_SECTION_SYM
 | 
			
		||||
 	&& sym->bsym->section != NULL
 | 
			
		||||
-	&& sym->bsym->section->flags & SEC_CODE)
 | 
			
		||||
+	/* Skip linkonce sections - we cannot these section symbols as they may disappear.  */
 | 
			
		||||
+	&& (sym->bsym->section->flags & (SEC_CODE | SEC_LINK_ONCE)) == SEC_CODE
 | 
			
		||||
+	/* Not all linkonce sections are flagged...  */
 | 
			
		||||
+	&& strncmp (S_GET_NAME (sym), ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) != 0)
 | 
			
		||||
       {
 | 
			
		||||
-	/* Found one - now create a relocation against this symbol.  */
 | 
			
		||||
-	create_note_reloc (sec, sym, 20, desc_reloc, 0, note);
 | 
			
		||||
-	break;
 | 
			
		||||
-      }
 | 
			
		||||
+	/* Create a version note.  */
 | 
			
		||||
+	frag_now_fix ();
 | 
			
		||||
+	note = frag_more (note_size);
 | 
			
		||||
+	memset (note, 0, note_size);
 | 
			
		||||
 
 | 
			
		||||
-  /* Find the last code section symbol.  */
 | 
			
		||||
-  if (sym)
 | 
			
		||||
-    {
 | 
			
		||||
-      for (sym = symbol_lastP; sym != NULL; sym = sym->sy_previous)
 | 
			
		||||
-	if (sym->bsym != NULL
 | 
			
		||||
-	    && sym->bsym->flags & BSF_SECTION_SYM
 | 
			
		||||
-	    && sym->bsym->section != NULL
 | 
			
		||||
-	    && sym->bsym->section->flags & SEC_CODE)
 | 
			
		||||
+	if (target_big_endian)
 | 
			
		||||
 	  {
 | 
			
		||||
-	    /* Create a relocation against the end of this symbol.  */
 | 
			
		||||
-	    create_note_reloc (sec, sym, desc2_offset, desc_reloc,
 | 
			
		||||
-			       bfd_get_section_size (sym->bsym->section),
 | 
			
		||||
-			       note);
 | 
			
		||||
-	    break;
 | 
			
		||||
+	    note[3] = 8; /* strlen (name) + 1.  */
 | 
			
		||||
+	    note[7] = desc_size; /* Two 8-byte offsets.  */
 | 
			
		||||
+	    note[10] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8;
 | 
			
		||||
+	    note[11] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff;
 | 
			
		||||
 	  }
 | 
			
		||||
-    }
 | 
			
		||||
-  /* else - if we were unable to find any code section symbols then
 | 
			
		||||
-     probably there is no code in the output.  So leaving the start
 | 
			
		||||
-     and end values as zero in the note is OK.  */
 | 
			
		||||
+	else
 | 
			
		||||
+	  {
 | 
			
		||||
+	    note[0] = 8; /* strlen (name) + 1.  */
 | 
			
		||||
+	    note[4] = desc_size; /* Two 8-byte offsets.  */
 | 
			
		||||
+	    note[8] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff;
 | 
			
		||||
+	    note[9] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8;
 | 
			
		||||
+	  }
 | 
			
		||||
+
 | 
			
		||||
+	/* The a1 version number indicates that this note was
 | 
			
		||||
+	   generated by the assembler and not the gcc annobin plugin.  */
 | 
			
		||||
+	memcpy (note + 12, "GA$3a1", 8);
 | 
			
		||||
 
 | 
			
		||||
-  /* FIXME: Maybe add a note recording the assembler command line and version ?  */
 | 
			
		||||
+	/* Create a relocation to install the start address of the note...  */
 | 
			
		||||
+	create_note_reloc (sec, sym, 20, desc_reloc, 0, note);
 | 
			
		||||
+
 | 
			
		||||
+	/* ...and another one to install the end address.  */
 | 
			
		||||
+	create_note_reloc (sec, sym, desc2_offset, desc_reloc,
 | 
			
		||||
+			   bfd_get_section_size (sym->bsym->section),
 | 
			
		||||
+			   note);
 | 
			
		||||
+
 | 
			
		||||
+	total_size += note_size;
 | 
			
		||||
+	/* FIXME: Maybe add a note recording the assembler command line and version ?  */
 | 
			
		||||
+      }
 | 
			
		||||
 
 | 
			
		||||
   /* Install the note(s) into the section.  */
 | 
			
		||||
-  bfd_set_section_contents (stdoutput, sec, (bfd_byte *) note, 0, note_size);
 | 
			
		||||
+  if (total_size)
 | 
			
		||||
+    bfd_set_section_contents (stdoutput, sec, (bfd_byte *) note, 0, total_size);
 | 
			
		||||
   subsegs_finish_section (sec);
 | 
			
		||||
   relax_segment (seg_info (sec)->frchainP->frch_root, sec, 0);
 | 
			
		||||
   size_seg (stdoutput, sec, NULL);
 | 
			
		||||
							
								
								
									
										24
									
								
								binutils-missing-notes.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								binutils-missing-notes.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
--- binutils.orig/gas/write.c	2018-07-06 11:49:29.149532896 +0100
 | 
			
		||||
+++ binutils-2.30/gas/write.c	2018-07-06 11:49:37.550441810 +0100
 | 
			
		||||
@@ -1963,7 +1963,7 @@ maybe_generate_build_notes (void)
 | 
			
		||||
     if (sym->bsym != NULL
 | 
			
		||||
 	&& sym->bsym->flags & BSF_SECTION_SYM
 | 
			
		||||
 	&& sym->bsym->section != NULL
 | 
			
		||||
-	/* Skip linkonce sections - we cannot these section symbols as they may disappear.  */
 | 
			
		||||
+	/* Skip linkonce sections - we cannot use these section symbols as they may disappear.  */
 | 
			
		||||
 	&& (sym->bsym->section->flags & (SEC_CODE | SEC_LINK_ONCE)) == SEC_CODE
 | 
			
		||||
 	/* Not all linkonce sections are flagged...  */
 | 
			
		||||
 	&& strncmp (S_GET_NAME (sym), ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) != 0)
 | 
			
		||||
@@ -1993,10 +1993,10 @@ maybe_generate_build_notes (void)
 | 
			
		||||
 	memcpy (note + 12, "GA$3a1", 8);
 | 
			
		||||
 
 | 
			
		||||
 	/* Create a relocation to install the start address of the note...  */
 | 
			
		||||
-	create_note_reloc (sec, sym, 20, desc_reloc, 0, note);
 | 
			
		||||
+	create_note_reloc (sec, sym, total_size + 20, desc_reloc, 0, note);
 | 
			
		||||
 
 | 
			
		||||
 	/* ...and another one to install the end address.  */
 | 
			
		||||
-	create_note_reloc (sec, sym, desc2_offset, desc_reloc,
 | 
			
		||||
+	create_note_reloc (sec, sym, total_size + desc2_offset, desc_reloc,
 | 
			
		||||
 			   bfd_get_section_size (sym->bsym->section),
 | 
			
		||||
 			   note);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5427
									
								
								binutils-nfp.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5427
									
								
								binutils-nfp.patch
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										6
									
								
								sources
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								sources
									
									
									
									
									
								
							@ -1,8 +1,2 @@
 | 
			
		||||
SHA512 (binutils-2.30.tar.xz) = e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839
 | 
			
		||||
SHA512 (binutils-gas-build-notes.patch) = fdf731780873bb8330b87744918257eca05d8a19992e6513b619312ee37495591c4157c3d4b1c47c3ab4c05675c087aeabacead32f69a8d3e2c34e72fb8a7c97
 | 
			
		||||
SHA512 (binutils-ifunc-relocs-in-notes.patch) = 5774cabdac1ad9fda32dda44d5c0d8ebee1a6e0066946309bdbd8a3248cc12adb9157c244c836bbe6f150643722b3ba3b446e80d625e2e294d7cbc07acaebe4b
 | 
			
		||||
SHA512 (binutils-improved-note-merging.patch) = 4474c6ade0e153321a23ab86e11482825f1861321ee320a6747aba8a6fc48f25fd12914e7e497190abc110a960cbb4b87db0ba05ec315f56f1ecde3c5c728a4f
 | 
			
		||||
SHA512 (binutils-linkonce-notes.patch) = 4392fde9f1750495abffdde5d3f56d4e38f816a29d37626f968d796982fb10cfad5144fac8c5dc61403e9f7a22e640d02c3f00f53832300d647830d6988d2cab
 | 
			
		||||
SHA512 (binutils-missing-notes.patch) = d0a62e5768e2cc391665491197d21fbb159d4a9f9078b7894e81e73868d9a69aa00126caaed0de881c2d665445372d2adef5216660df1b0965bfa006c1fa6f49
 | 
			
		||||
SHA512 (binutils-nfp.patch) = e1cc48f0fd01e2eaaa49e22c37cbbfb372251c205d0bf0f4b4cc6b451866448eee2e60658cee5ec850e98f2b683bd5d3d9c5caeea1c2b81d90fa1ef7a4ab0df2
 | 
			
		||||
SHA512 (standards.info.gz) = 52452ec58c9b0045abeb1f7fb29d56a62cd4042edbb5e1685dad5f6932731ace2bf05ec238b2e8d3d851114a2718b511dfc721c996bee8721a873314de7c7358
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user