import binutils-2.30-99.el8

This commit is contained in:
CentOS Sources 2021-04-02 04:13:37 +00:00 committed by Stepan Oksanichenko
commit 9f3c1f001f
92 changed files with 301733 additions and 0 deletions

2
.binutils.metadata Normal file
View File

@ -0,0 +1,2 @@
574d3b5650413d6ee65195a4f5ecbddc3a38f718 SOURCES/binutils-2.30.tar.xz
d3e5c9fc829ed40648110da6fe46c2fb1ed8aadb SOURCES/standards.info.gz

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
SOURCES/binutils-2.30.tar.xz
SOURCES/standards.info.gz

View File

@ -0,0 +1,38 @@
# Generate OUTPUT_FORMAT line for .so files from the system linker output.
# Imported from glibc/Makerules.
/ld.*[ ]-E[BL]/b f
/collect.*[ ]-E[BL]/b f
/OUTPUT_FORMAT[^)]*$/{N
s/\n[ ]*/ /
}
t o
: o
s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
t q
s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/
t s
s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/
t q
d
: s
s/"//g
G
s/\n//
s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p
/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
q
: q
s/"//g
p
q
: f
s/^.*[ ]-E\([BL]\)[ ].*$/,\1/
t h
s/^.*[ ]-E\([BL]\)$/,\1/
t h
d
: h
h

View File

@ -0,0 +1,236 @@
diff -rcp ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure
--- a/bfd/configure 2010-04-08 14:53:48.000000000 +0100
+++ b/bfd/configure 2010-04-08 14:56:50.000000000 +0100
@@ -10762,10 +10762,34 @@
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/binutils/configure ./binutils/configure
--- a/binutils/configure 2010-04-08 14:53:45.000000000 +0100
+++ b/binutils/configure 2010-04-08 14:56:21.000000000 +0100
@@ -10560,10 +10560,34 @@
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/gas/configure ./gas/configure
--- a/gas/configure 2010-04-08 14:53:47.000000000 +0100
+++ b/gas/configure 2010-04-08 14:57:24.000000000 +0100
@@ -10547,10 +10547,34 @@
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/gprof/configure ./gprof/configure
--- a/gprof/configure 2010-04-08 14:53:45.000000000 +0100
+++ b/gprof/configure 2010-04-08 14:57:50.000000000 +0100
@@ -10485,10 +10485,34 @@
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
diff -rcp ../binutils-2.20.51.0.7.original/ld/configure ./ld/configure
--- a/ld/configure 2010-04-08 14:53:44.000000000 +0100
+++ b/ld/configure 2010-04-08 14:58:21.000000000 +0100
@@ -10966,10 +10966,34 @@
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
Only in .: .#libtool.m4
Only in .: #libtool.m4#
diff -rcp ../binutils-2.20.51.0.7.original/opcodes/configure ./opcodes/configure
--- a/opcodes/configure 2010-04-08 14:53:45.000000000 +0100
+++ b/opcodes/configure 2010-04-08 14:59:10.000000000 +0100
@@ -10496,10 +10496,34 @@
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390*|powerpc*|ppc*|sparc*)
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ fi
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on

View File

@ -0,0 +1,21 @@
--- a/bfd/Makefile.am 2012-03-06 14:00:33.229957572 +0000
+++ b/bfd/Makefile.am 2012-04-27 16:46:05.410974817 +0100
@@ -18,7 +18,7 @@
bfdlibdir = @bfdlibdir@
bfdincludedir = @bfdincludedir@
bfdlib_LTLIBRARIES = libbfd.la
-bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h
+bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h
else !INSTALL_LIBBFD
# Empty these so that the respective installation directories will not be created.
bfdlibdir =
--- binutils-2.26.orig/bfd/Makefile.in 2016-01-25 10:23:35.054721634 +0000
+++ binutils-2.26/bfd/Makefile.in 2016-01-25 10:25:59.292607840 +0000
@@ -350,6 +350,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -rel
@INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2)
@INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
+@INSTALL_LIBBFD_TRUE@ $(INCDIR)/demangle.h \
@INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(am__append_2)
@INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@
@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la

View File

@ -0,0 +1,28 @@
--- a/bfd/bfd-in.h 2012-08-02 10:56:34.561769686 +0100
+++ b/bfd/bfd-in.h 2012-08-02 11:13:27.134797755 +0100
@@ -25,11 +25,6 @@
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
-/* PR 14072: Ensure that config.h is included first. */
-#if !defined PACKAGE && !defined PACKAGE_VERSION
-#error config.h must be included before this header
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
--- a/bfd/bfd-in2.h 2012-08-02 10:56:34.349769680 +0100
+++ b/bfd/bfd-in2.h 2012-08-02 11:13:40.015798113 +0100
@@ -32,11 +32,6 @@
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
-/* PR 14072: Ensure that config.h is included first. */
-#if !defined PACKAGE && !defined PACKAGE_VERSION
-#error config.h must be included before this header
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -0,0 +1,38 @@
diff -up binutils-2.25.orig/bfd/configure.ac binutils-2.25/bfd/configure.ac
--- binutils-2.25.orig/bfd/configure.ac 2014-12-24 10:34:45.590491143 +0000
+++ binutils-2.25/bfd/configure.ac 2014-12-24 10:36:12.997981992 +0000
@@ -183,11 +183,13 @@ if test "x${ac_cv_sizeof_long}" = "x8";
BFD_HOST_64BIT_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+fi
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
BFD_HOST_64BIT_LONG_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
BFD_HOSTPTR_T="unsigned long long"
fi
fi
diff -up ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure
--- a/bfd/configure 2010-04-08 15:23:58.000000000 +0100
+++ b/bfd/configure 2010-04-08 15:24:06.000000000 +0100
@@ -12819,11 +12819,13 @@
BFD_HOST_64BIT_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+fi
+if test "x${ac_cv_sizeof_long_long}" = "x8"; then
BFD_HOST_64BIT_LONG_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
+ if test "x${ac_cv_sizeof_void_p}" = "x8" \
+ -a "x${ac_cv_sizeof_long}" != "x8"; then
BFD_HOSTPTR_T="unsigned long long"
fi
fi

View File

@ -0,0 +1,44 @@
--- binutils-2.26.orig/bfd/Makefile.am 2016-01-25 10:11:33.505289018 +0000
+++ binutils-2.26/bfd/Makefile.am 2016-01-25 10:13:23.489964145 +0000
@@ -1043,8 +1043,8 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
- bfd_version_string="\"$(VERSION)\"" ;\
- bfd_soversion="$(VERSION)" ;\
+ bfd_version_string="\"$(VERSION)-%{release}\"" ;\
+ bfd_soversion="$(VERSION)-%{release}" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
. $(srcdir)/development.sh ;\
@@ -1055,7 +1055,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
fi ;\
$(SED) -e "s,@bfd_version@,$$bfd_version," \
-e "s,@bfd_version_string@,$$bfd_version_string," \
- -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@bfd_version_package@,\"version \"," \
-e "s,@report_bugs_to@,$$report_bugs_to," \
< $(srcdir)/version.h > $@; \
echo "$${bfd_soversion}" > libtool-soversion
--- binutils-2.26.orig/bfd/Makefile.in 2016-01-25 10:11:33.505289018 +0000
+++ binutils-2.26/bfd/Makefile.in 2016-01-25 10:14:17.818297941 +0000
@@ -2111,8 +2111,8 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
- bfd_version_string="\"$(VERSION)\"" ;\
- bfd_soversion="$(VERSION)" ;\
+ bfd_version_string="\"$(VERSION)-%{release}\"" ;\
+ bfd_soversion="$(VERSION)-%{release}" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
. $(srcdir)/development.sh ;\
@@ -2123,7 +2123,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/
fi ;\
$(SED) -e "s,@bfd_version@,$$bfd_version," \
-e "s,@bfd_version_string@,$$bfd_version_string," \
- -e "s,@bfd_version_package@,$$bfd_version_package," \
+ -e "s,@bfd_version_package@,\"version \"," \
-e "s,@report_bugs_to@,$$report_bugs_to," \
< $(srcdir)/version.h > $@; \
echo "$${bfd_soversion}" > libtool-soversion

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.27/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2017-02-21 10:45:19.311956006 +0000
+++ binutils-2.27/bfd/elfnn-aarch64.c 2017-02-21 11:55:07.517922655 +0000
@@ -4947,6 +4947,7 @@ elfNN_aarch64_final_link_relocate (reloc
it here if it is defined in a non-shared object. */
if (h != NULL
&& h->type == STT_GNU_IFUNC
+ && (input_section->flags & SEC_ALLOC)
&& h->def_regular)
{
asection *plt;

View File

@ -0,0 +1,14 @@
diff -rup binutils.orig/ld/ldmain.c binutils-2.28/ld/ldmain.c
--- binutils.orig/ld/ldmain.c 2017-06-09 09:08:26.954016429 +0100
+++ binutils-2.28/ld/ldmain.c 2017-06-09 09:09:11.307490976 +0100
@@ -923,6 +923,10 @@ multiple_definition (struct bfd_link_inf
obfd = h->u.def.section->owner;
break;
case bfd_link_hash_indirect:
+ /* PR 21074: The GOLD linker can produce multiple indirect
+ refences to the same symbol. These can be ignored. */
+ if (bfd_is_ind_section (nsec))
+ return;
osec = bfd_ind_section_ptr;
oval = 0;
obfd = NULL;

View File

@ -0,0 +1,124 @@
--- binutils.orig/binutils/readelf.c 2018-01-22 15:48:10.450701702 +0000
+++ binutils-2.30.0/binutils/readelf.c 2018-01-22 15:55:26.739588657 +0000
@@ -19019,75 +19019,85 @@ process_file (char * file_name)
Filedata * filedata = NULL;
struct stat statbuf;
char armag[SARMAG];
- bfd_boolean ret = TRUE;
+ bfd_boolean ret = FALSE;
+ char * name;
+ char * saved_program_name;
+
+ /* Overload program_name to include file_name. Doing this means
+ that warning/error messages will positively identify the file
+ concerned even when multiple instances of readelf are running. */
+ name = xmalloc (strlen (program_name) + strlen (file_name) + 3);
+ sprintf (name, "%s: %s", program_name, file_name);
+ saved_program_name = program_name;
+ program_name = name;
if (stat (file_name, &statbuf) < 0)
{
if (errno == ENOENT)
- error (_("'%s': No such file\n"), file_name);
+ error (_("No such file\n"));
else
- error (_("Could not locate '%s'. System error message: %s\n"),
- file_name, strerror (errno));
- return FALSE;
+ error (_("Could not locate file. System error message: %s\n"),
+ strerror (errno));
+ goto done;
}
if (! S_ISREG (statbuf.st_mode))
{
- error (_("'%s' is not an ordinary file\n"), file_name);
- return FALSE;
+ error (_("Not an ordinary file\n"));
+ goto done;
}
filedata = calloc (1, sizeof * filedata);
if (filedata == NULL)
{
error (_("Out of memory allocating file data structure\n"));
- return FALSE;
+ goto done;
}
filedata->file_name = file_name;
filedata->handle = fopen (file_name, "rb");
if (filedata->handle == NULL)
{
- error (_("Input file '%s' is not readable.\n"), file_name);
- free (filedata);
- return FALSE;
+ error (_("Not readable\n"));
+ goto done;
}
if (fread (armag, SARMAG, 1, filedata->handle) != 1)
{
- error (_("%s: Failed to read file's magic number\n"), file_name);
- fclose (filedata->handle);
- free (filedata);
- return FALSE;
- }
-
- filedata->file_size = (bfd_size_type) statbuf.st_size;
-
- if (memcmp (armag, ARMAG, SARMAG) == 0)
- {
- if (! process_archive (filedata, FALSE))
- ret = FALSE;
- }
- else if (memcmp (armag, ARMAGT, SARMAG) == 0)
- {
- if ( ! process_archive (filedata, TRUE))
- ret = FALSE;
+ error (_("Failed to read file's magic number\n"));
}
else
{
- if (do_archive_index)
- error (_("File %s is not an archive so its index cannot be displayed.\n"),
- file_name);
+ filedata->file_size = (bfd_size_type) statbuf.st_size;
- rewind (filedata->handle);
- archive_file_size = archive_file_offset = 0;
-
- if (! process_object (filedata))
- ret = FALSE;
+ if (memcmp (armag, ARMAG, SARMAG) == 0)
+ {
+ if (process_archive (filedata, FALSE))
+ ret = TRUE;
+ }
+ else if (memcmp (armag, ARMAGT, SARMAG) == 0)
+ {
+ if (process_archive (filedata, TRUE))
+ ret = TRUE;
+ }
+ else
+ {
+ if (do_archive_index)
+ error (_("Not an archive so its index cannot be displayed.\n"));
+
+ rewind (filedata->handle);
+ archive_file_size = archive_file_offset = 0;
+
+ if (process_object (filedata))
+ ret = TRUE;
+ }
}
fclose (filedata->handle);
+ done:
free (filedata);
+ free (program_name);
+ program_name = saved_program_name;
return ret;
}

View File

@ -0,0 +1,147 @@
From 279b2f94168ee91e02ccd070d27c983fc001fe12 Mon Sep 17 00:00:00 2001
From: Renlin Li <renlin.li@arm.com>
Date: Sat, 3 Feb 2018 13:18:17 +0000
Subject: [PATCH] [PR22764][LD][AARCH64]Allow R_AARCH64_ABS16 and
R_AARCH64_ABS32 against absolution symbol or undefine symbol in shared
object.
The assumption that R_AARCH64_ABS16 and R_AARCH64_ABS32 relocation in LP64 abi
will be used to generate an address does not hold for absolute symbol.
In this case, it is a value fixed at static linking time.
The condition to check the relocations is relax to allow absolute symbol and
undefined symbol case.
bfd/
2018-02-05 Renlin Li <renlin.li@arm.com>
PR ld/22764
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Relax the
R_AARCH64_ABS32 and R_AARCH64_ABS16 for absolute symbol. Apply the
check for writeable section as well.
ld/
2018-02-05 Renlin Li <renlin.li@arm.com>
PR ld/22764
* testsuite/ld-aarch64/emit-relocs-258.s: Define symbol as an address.
* testsuite/ld-aarch64/emit-relocs-259.s: Likewise.
* testsuite/ld-aarch64/aarch64-elf.exp: Run new test.
* testsuite/ld-aarch64/pr22764.s: New.
* testsuite/ld-aarch64/pr22764.d: New.
---
bfd/ChangeLog | 7 +++++++
bfd/elfnn-aarch64.c | 15 ++++++++++++---
ld/ChangeLog | 8 ++++++++
ld/testsuite/ld-aarch64/aarch64-elf.exp | 1 +
ld/testsuite/ld-aarch64/emit-relocs-258.s | 3 ++-
ld/testsuite/ld-aarch64/emit-relocs-259.s | 3 ++-
ld/testsuite/ld-aarch64/pr22764.d | 18 ++++++++++++++++++
ld/testsuite/ld-aarch64/pr22764.s | 6 ++++++
8 files changed, 56 insertions(+), 5 deletions(-)
create mode 100644 ld/testsuite/ld-aarch64/pr22764.d
create mode 100644 ld/testsuite/ld-aarch64/pr22764.s
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index af448f9..2737773 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -7189,10 +7189,19 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
#if ARCH_SIZE == 64
case BFD_RELOC_AARCH64_32:
#endif
- if (bfd_link_pic (info)
- && (sec->flags & SEC_ALLOC) != 0
- && (sec->flags & SEC_READONLY) != 0)
+ if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0)
{
+ if (h != NULL
+ /* This is an absolute symbol. It represents a value instead
+ of an address. */
+ && ((h->root.type == bfd_link_hash_defined
+ && bfd_is_abs_section (h->root.u.def.section))
+ /* This is an undefined symbol. */
+ || h->root.type == bfd_link_hash_undefined))
+ break;
+
+ /* For local symbols, defined global symbols in a non-ABS section,
+ it is assumed that the value is an address. */
int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
_bfd_error_handler
/* xgettext:c-format */
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 2602a43..c67ffb1 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -285,6 +285,7 @@ run_dump_test "pr17415"
run_dump_test_lp64 "tprel_g2_overflow"
run_dump_test "tprel_add_lo12_overflow"
run_dump_test "protected-data"
+run_dump_test_lp64 "pr22764"
# ifunc tests
run_dump_test "ifunc-1"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-258.s b/ld/testsuite/ld-aarch64/emit-relocs-258.s
index f724776..87bb657 100644
--- a/ld/testsuite/ld-aarch64/emit-relocs-258.s
+++ b/ld/testsuite/ld-aarch64/emit-relocs-258.s
@@ -1,5 +1,6 @@
+.global dummy
.text
-
+dummy:
ldr x0, .L1
.L1:
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-259.s b/ld/testsuite/ld-aarch64/emit-relocs-259.s
index 7e1ba3c..0977c9d 100644
--- a/ld/testsuite/ld-aarch64/emit-relocs-259.s
+++ b/ld/testsuite/ld-aarch64/emit-relocs-259.s
@@ -1,5 +1,6 @@
+.global dummy
.text
-
+dummy:
ldr x0, .L1
.L1:
diff --git a/ld/testsuite/ld-aarch64/pr22764.d b/ld/testsuite/ld-aarch64/pr22764.d
new file mode 100644
index 0000000..997519f
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/pr22764.d
@@ -0,0 +1,18 @@
+#source: pr22764.s
+#ld: -shared -T relocs.ld -defsym sym_abs1=0x1 -defsym sym_abs2=0x2 -defsym sym_abs3=0x3 -e0 --emit-relocs
+#notarget: aarch64_be-*-*
+#objdump: -dr
+#...
+
+Disassembly of section \.text:
+
+0000000000010000 \<\.text\>:
+ 10000: d503201f nop
+ ...
+ 10004: R_AARCH64_ABS64 sym_abs1
+ 1000c: 00000002 \.word 0x00000002
+ 1000c: R_AARCH64_ABS32 sym_abs2
+ 10010: 0003 \.short 0x0003
+ 10010: R_AARCH64_ABS16 sym_abs3
+ 10012: 0000 \.short 0x0000
+ 10014: d503201f nop
diff --git a/ld/testsuite/ld-aarch64/pr22764.s b/ld/testsuite/ld-aarch64/pr22764.s
new file mode 100644
index 0000000..25e36b4
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/pr22764.s
@@ -0,0 +1,6 @@
+ .text
+ nop
+ .xword sym_abs1
+ .word sym_abs2
+ .short sym_abs3
+ nop
--
2.9.3

View File

@ -0,0 +1,373 @@
diff -pruN binutils-2.30.orig/gold/aarch64.cc binutils-2.30/gold/aarch64.cc
--- binutils-2.30.orig/gold/aarch64.cc 2019-03-28 06:50:31.813828734 -0400
+++ binutils-2.30/gold/aarch64.cc 2019-03-28 06:50:46.993954670 -0400
@@ -6478,6 +6478,17 @@ Target_aarch64<size, big_endian>::Scan::
gold_error(_("%s: unsupported reloc %u in pos independent link."),
object->name().c_str(), r_type);
}
+ // Make a PLT entry if necessary.
+ if (gsym->needs_plt_entry())
+ {
+ target->make_plt_entry(symtab, layout, gsym);
+ // Since this is not a PC-relative relocation, we may be
+ // taking the address of a function. In that case we need to
+ // set the entry in the dynamic symbol table to the address of
+ // the PLT entry.
+ if (gsym->is_from_dynobj() && !parameters->options().shared())
+ gsym->set_needs_dynsym_value();
+ }
break;
case elfcpp::R_AARCH64_LD_PREL_LO19: // 273
diff -pruN binutils-2.30.orig/gold/ChangeLog binutils-2.30/gold/ChangeLog
--- binutils-2.30.orig/gold/ChangeLog 2018-01-27 10:08:21.000000000 -0500
+++ binutils-2.30/gold/ChangeLog 2019-03-28 06:52:51.924999245 -0400
@@ -1,3 +1,14 @@
+2019-02-19 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
+
+ PR gold/23870
+ * aarch64.cc (Target_aarch64::Scan::global): Check if a symbol with
+ R_AARCH64_MOVW_.ABS_* relocations requires a PLT entry.
+ * testsuite/Makefile.am: Add aarch64_pr23870 test case.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/aarch64_pr23870_bar.c: New file.
+ * testsuite/aarch64_pr23870_foo.c: New file.
+ * testsuite/aarch64_pr23870_main.S: New file.
+
2018-01-27 Nick Clifton <nickc@redhat.com>
This is the 2.30 release:
diff -pruN binutils-2.30.orig/gold/testsuite/aarch64_pr23870_bar.c binutils-2.30/gold/testsuite/aarch64_pr23870_bar.c
--- binutils-2.30.orig/gold/testsuite/aarch64_pr23870_bar.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.30/gold/testsuite/aarch64_pr23870_bar.c 2019-03-28 06:50:46.993954670 -0400
@@ -0,0 +1,6 @@
+void bar (void);
+
+void bar ()
+{
+ return;
+}
diff -pruN binutils-2.30.orig/gold/testsuite/aarch64_pr23870_foo.c binutils-2.30/gold/testsuite/aarch64_pr23870_foo.c
--- binutils-2.30.orig/gold/testsuite/aarch64_pr23870_foo.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.30/gold/testsuite/aarch64_pr23870_foo.c 2019-03-28 06:50:46.993954670 -0400
@@ -0,0 +1,6 @@
+void foo (void (*bar)(void));
+
+void foo (void (*bar)(void))
+{
+ bar();
+}
diff -pruN binutils-2.30.orig/gold/testsuite/aarch64_pr23870_main.S binutils-2.30/gold/testsuite/aarch64_pr23870_main.S
--- binutils-2.30.orig/gold/testsuite/aarch64_pr23870_main.S 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.30/gold/testsuite/aarch64_pr23870_main.S 2019-03-28 06:50:46.993954670 -0400
@@ -0,0 +1,15 @@
+
+ .text
+ .globl main
+ .type main,#function
+main:
+ stp x29, x30, [sp,#-16]!
+ mov x29, sp
+ movz x0, #:abs_g3:bar
+ movk x0, #:abs_g2_nc:bar
+ movk x0, #:abs_g1_nc:bar
+ movk x0, #:abs_g0_nc:bar
+ add x0, x0, #0x0
+ bl foo
+ ldp x29, x30, [sp],#16
+ ret
diff -pruN binutils-2.30.orig/gold/testsuite/Makefile.am binutils-2.30/gold/testsuite/Makefile.am
--- binutils-2.30.orig/gold/testsuite/Makefile.am 2019-03-28 06:50:31.563826660 -0400
+++ binutils-2.30/gold/testsuite/Makefile.am 2019-03-28 06:50:46.993954670 -0400
@@ -3144,6 +3144,26 @@ pr22266: pr22266_main.o pr22266_ar.o gcc
pr22266_ar.o: pr22266_a.o gcctestdir/ld
gcctestdir/ld -r -T $(srcdir)/pr22266_script.t -o $@ pr22266_a.o
+if DEFAULT_TARGET_AARCH64
+
+check_PROGRAMS += aarch64_pr23870
+aarch64_pr23870_SOURCES = aarch64_pr23870_foo.c
+aarch64_pr23870_DEPENDENCIES = \
+ gcctestdir/ld gcctestdir/as aarch64_pr23870_main.o \
+ aarch64_pr23870_foo.o aarch64_pr23870_bar.so
+aarch64_pr23870_LDFLAGS = -Wl,-R,. -L. -Wl,-l:aarch64_pr23870_bar.so
+aarch64_pr23870_LDADD = aarch64_pr23870_main.o
+aarch64_pr23870_main.o: aarch64_pr23870_main.S
+ $(COMPILE) -c -o $@ $<
+aarch64_pr23870_foo.o: aarch64_pr23870_foo.c
+ $(COMPILE) -c -o $@ $<
+aarch64_pr23870_bar.o: aarch64_pr23870_bar.c
+ $(COMPILE) -c -fPIC -o $@ $<
+aarch64_pr23870_bar.so: aarch64_pr23870_bar.o
+ $(COMPILE) -shared -o $@ $<
+
+endif DEFAULT_TARGET_AARCH64
+
endif GCC
endif NATIVE_LINKER
diff -pruN binutils-2.30.orig/gold/testsuite/Makefile.in binutils-2.30/gold/testsuite/Makefile.in
--- binutils-2.30.orig/gold/testsuite/Makefile.in 2019-03-28 06:50:31.573826743 -0400
+++ binutils-2.30/gold/testsuite/Makefile.in 2019-03-28 06:59:26.518313455 -0400
@@ -70,7 +70,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
$(am__EXEEXT_31) $(am__EXEEXT_32) $(am__EXEEXT_33) \
$(am__EXEEXT_34) $(am__EXEEXT_35) $(am__EXEEXT_36) \
$(am__EXEEXT_37) $(am__EXEEXT_38) $(am__EXEEXT_39) \
- $(am__EXEEXT_40) $(am__EXEEXT_41)
+ $(am__EXEEXT_40) $(am__EXEEXT_41) $(am__EXEEXT_42)
@NATIVE_OR_CROSS_LINKER_TRUE@am__append_1 = object_unittest \
@NATIVE_OR_CROSS_LINKER_TRUE@ binary_unittest leb128_unittest \
@NATIVE_OR_CROSS_LINKER_TRUE@ overflow_unittest
@@ -817,27 +817,28 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_84 = gnu_property_test.sh
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_85 = gnu_property_test.stdout
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_86 = pr22266
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_87 = aarch64_pr23870
# These tests work with native and cross linkers.
# Test script section order.
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = script_test_10.sh
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = script_test_10.stdout
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = script_test_10
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = script_test_10.sh
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = script_test_10.stdout
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = script_test_10
# These tests work with cross linkers only.
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_i386.sh
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_i386_1.stdout split_i386_2.stdout \
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_i386.sh
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_i386_1.stdout split_i386_2.stdout \
@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_i386_1 split_i386_2 split_i386_3 \
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_i386_1 split_i386_2 split_i386_3 \
@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_4 split_i386_r
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_x86_64.sh \
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x86_64.sh \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_plt_1.sh \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_1.sh \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_2.sh
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x86_64_1.stdout \
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x86_64_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_2.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_3.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4.stdout \
@@ -845,14 +846,14 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_plt_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_2.stdout
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4 split_x86_64_r
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = split_x32.sh
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = split_x32_1.stdout split_x32_2.stdout \
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = split_x32.sh
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = split_x32_1.stdout split_x32_2.stdout \
@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = split_x32_1 split_x32_2 split_x32_3 \
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = split_x32_1 split_x32_2 split_x32_3 \
@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_4 split_x32_r
@@ -873,7 +874,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
# Check Thumb to ARM farcall veneers
# Check handling of --target1-abs, --target1-rel and --target2 options
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = arm_abs_global.sh \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = arm_abs_global.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_in_range.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_out_of_range.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_v4bx.sh \
@@ -896,7 +897,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.sh
# The test demonstrates why the constructor of a target object should not access options.
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = arm_abs_global.stdout \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = arm_abs_global.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range.stdout \
@@ -949,7 +950,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target_lazy_init
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = arm_abs_global \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = arm_abs_global \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range \
@@ -1000,20 +1001,20 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target_lazy_init
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = aarch64_reloc_none.sh \
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = aarch64_reloc_none.sh \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs.sh \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430.sh \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc.sh
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = aarch64_reloc_none.stdout \
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = aarch64_reloc_none.stdout \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs.stdout \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430.stdout \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc.stdout
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = aarch64_reloc_none \
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_105 = aarch64_reloc_none \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430 \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_105 = split_s390.sh
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_106 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_106 = split_s390.sh
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_107 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
@@ -1025,7 +1026,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_n2_ns.stdout split_s390x_r.stdout
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_107 = split_s390_z1 split_s390_z2 split_s390_z3 \
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_108 = split_s390_z1 split_s390_z2 split_s390_z3 \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
@@ -1034,10 +1035,10 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
-@DEFAULT_TARGET_X86_64_TRUE@am__append_108 = *.dwo *.dwp
-@DEFAULT_TARGET_X86_64_TRUE@am__append_109 = dwp_test_1.sh \
+@DEFAULT_TARGET_X86_64_TRUE@am__append_109 = *.dwo *.dwp
+@DEFAULT_TARGET_X86_64_TRUE@am__append_110 = dwp_test_1.sh \
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.sh
-@DEFAULT_TARGET_X86_64_TRUE@am__append_110 = dwp_test_1.stdout \
+@DEFAULT_TARGET_X86_64_TRUE@am__append_111 = dwp_test_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.stdout
subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
@@ -1243,6 +1244,11 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_40 = \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_x86_64_bnd_test$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_41 = pr22266$(EXEEXT)
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_42 = aarch64_pr23870$(EXEEXT)
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am_aarch64_pr23870_OBJECTS = aarch64_pr23870_foo.$(OBJEXT)
+aarch64_pr23870_OBJECTS = $(am_aarch64_pr23870_OBJECTS)
+aarch64_pr23870_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(aarch64_pr23870_LDFLAGS) $(LDFLAGS) -o $@
basic_pic_test_SOURCES = basic_pic_test.c
basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT)
basic_pic_test_LDADD = $(LDADD)
@@ -2392,7 +2398,7 @@ am__depfiles_maybe = depfiles
am__mv = mv -f
CCLD = $(CC)
CXXLD = $(CXX)
-SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
+SOURCES = $(libgoldtest_a_SOURCES) $(aarch64_pr23870_SOURCES) basic_pic_test.c basic_pie_test.c \
basic_static_pic_test.c basic_static_test.c basic_test.c \
$(binary_test_SOURCES) $(binary_unittest_SOURCES) \
$(common_test_1_SOURCES) $(common_test_2_SOURCES) \
@@ -2830,9 +2836,9 @@ MOSTLYCLEANFILES = *.so *.syms *.stdout
$(am__append_34) $(am__append_37) $(am__append_41) \
$(am__append_47) $(am__append_51) $(am__append_52) \
$(am__append_58) $(am__append_78) $(am__append_81) \
- $(am__append_83) $(am__append_89) $(am__append_92) \
- $(am__append_95) $(am__append_98) $(am__append_101) \
- $(am__append_104) $(am__append_107) $(am__append_108)
+ $(am__append_83) $(am__append_90) $(am__append_93) \
+ $(am__append_96) $(am__append_99) $(am__append_102) \
+ $(am__append_105) $(am__append_108) $(am__append_109)
# We will add to these later, for each individual test. Note
# that we add each test under check_SCRIPTS or check_PROGRAMS;
@@ -2842,17 +2848,17 @@ check_SCRIPTS = $(am__append_2) $(am__ap
$(am__append_45) $(am__append_49) $(am__append_53) \
$(am__append_56) $(am__append_62) $(am__append_73) \
$(am__append_76) $(am__append_79) $(am__append_84) \
- $(am__append_87) $(am__append_90) $(am__append_93) \
- $(am__append_96) $(am__append_99) $(am__append_102) \
- $(am__append_105) $(am__append_109)
+ $(am__append_88) $(am__append_91) $(am__append_94) \
+ $(am__append_97) $(am__append_100) $(am__append_103) \
+ $(am__append_106) $(am__append_110)
check_DATA = $(am__append_3) $(am__append_20) $(am__append_24) \
$(am__append_30) $(am__append_36) $(am__append_43) \
$(am__append_46) $(am__append_50) $(am__append_54) \
$(am__append_57) $(am__append_63) $(am__append_74) \
$(am__append_77) $(am__append_80) $(am__append_85) \
- $(am__append_88) $(am__append_91) $(am__append_94) \
- $(am__append_97) $(am__append_100) $(am__append_103) \
- $(am__append_106) $(am__append_110)
+ $(am__append_89) $(am__append_92) $(am__append_95) \
+ $(am__append_98) $(am__append_101) $(am__append_104) \
+ $(am__append_107) $(am__append_111)
BUILT_SOURCES = $(am__append_40)
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
@@ -3408,6 +3414,13 @@ LDADD = libgoldtest.a ../libgold.a ../..
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS) -Wl,-z,bndplt
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_SOURCES = aarch64_pr23870_foo.c
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_DEPENDENCIES = \
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld gcctestdir/as aarch64_pr23870_main.o \
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ aarch64_pr23870_foo.o aarch64_pr23870_bar.so
+
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_LDFLAGS = -Wl,-R,. -L. -Wl,-l:aarch64_pr23870_bar.so
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_LDADD = aarch64_pr23870_main.o
@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
@@ -3457,6 +3470,11 @@ libgoldtest.a: $(libgoldtest_a_OBJECTS)
clean-checkPROGRAMS:
-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+aarch64_pr23870$(EXEEXT): $(aarch64_pr23870_OBJECTS) $(aarch64_pr23870_DEPENDENCIES) $(EXTRA_aarch64_pr23870_DEPENDENCIES)
+ @rm -f aarch64_pr23870$(EXEEXT)
+ $(AM_V_CCLD)$(aarch64_pr23870_LINK) $(aarch64_pr23870_OBJECTS) $(aarch64_pr23870_LDADD) $(LIBS)
+
@GCC_FALSE@basic_pic_test$(EXEEXT): $(basic_pic_test_OBJECTS) $(basic_pic_test_DEPENDENCIES) $(EXTRA_basic_pic_test_DEPENDENCIES)
@GCC_FALSE@ @rm -f basic_pic_test$(EXEEXT)
@GCC_FALSE@ $(LINK) $(basic_pic_test_OBJECTS) $(basic_pic_test_LDADD) $(LIBS)
@@ -4397,6 +4415,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aarch64_pr23870_foo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_pic_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_pie_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_static_pic_test.Po@am__quote@
@@ -5741,6 +5760,13 @@ pr22266.log: pr22266$(EXEEXT)
@p='pr22266$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
gnu_property_test.sh.log: gnu_property_test.sh
@p='gnu_property_test.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+aarch64_pr23870.log: aarch64_pr23870$(EXEEXT)
+ @p='aarch64_pr23870$(EXEEXT)'; \
+ b='aarch64_pr23870'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
@@ -7414,6 +7440,14 @@ uninstall-am:
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ pr22266_main.o pr22266_ar.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@pr22266_ar.o: pr22266_a.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -r -T $(srcdir)/pr22266_script.t -o $@ pr22266_a.o
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_main.o: aarch64_pr23870_main.S
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -o $@ $<
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_foo.o: aarch64_pr23870_foo.c
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -o $@ $<
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_bar.o: aarch64_pr23870_bar.c
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -fPIC -o $@ $<
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@aarch64_pr23870_bar.so: aarch64_pr23870_bar.o
+@DEFAULT_TARGET_AARCH64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -shared -o $@ $<
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10.o: script_test_10.s
@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $<
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld

View File

@ -0,0 +1,22 @@
--- binutils.orig/binutils/dwarf.c 2018-05-01 11:42:02.656431736 +0100
+++ binutils-2.30/binutils/dwarf.c 2018-05-01 11:43:24.210383020 +0100
@@ -9244,7 +9244,18 @@ process_cu_tu_index (struct dwarf_sectio
}
if (!do_display)
- memcpy (&this_set[row - 1].signature, ph, sizeof (uint64_t));
+ {
+ size_t num_copy = sizeof (uint64_t);
+
+ /* PR 23064: Beware of buffer overflow. */
+ if (ph + num_copy < limit)
+ memcpy (&this_set[row - 1].signature, ph, num_copy);
+ else
+ {
+ warn (_("Signature (%p) extends beyond end of space in section\n"), ph);
+ return 0;
+ }
+ }
prow = poffsets + (row - 1) * ncols * 4;
/* PR 17531: file: b8ce60a8. */

View File

@ -0,0 +1,11 @@
--- binutils.orig/bfd/dwarf2.c 2018-05-01 11:42:03.152425647 +0100
+++ binutils-2.30/bfd/dwarf2.c 2018-05-01 12:03:27.533735710 +0100
@@ -1559,7 +1559,7 @@ concat_filename (struct line_info_table
{
char *filename;
- if (file - 1 >= table->num_files)
+ if (table == NULL || file - 1 >= table->num_files)
{
/* FILE == 0 means unknown. */
if (file)

View File

@ -0,0 +1,18 @@
--- binutils.orig/bfd/peXXigen.c 2018-05-10 10:09:03.619147342 +0100
+++ binutils-2.30/bfd/peXXigen.c 2018-05-10 10:20:20.884883540 +0100
@@ -2991,6 +2991,15 @@ _bfd_XX_bfd_copy_private_bfd_data_common
bfd_get_section_size (section) - (addr - section->vma));
return FALSE;
}
+ /* PR 23110. */
+ else if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size < 0)
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler
+ (_("%pB: Data Directory size (%#lx) is negative"),
+ obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size);
+ return FALSE;
+ }
for (i = 0; i < ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size
/ sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++)

View File

@ -0,0 +1,28 @@
--- binutils.orig/bfd/elf.c 2018-05-10 10:09:03.622147305 +0100
+++ binutils-2.30/bfd/elf.c 2018-05-10 10:29:09.895577234 +0100
@@ -4021,16 +4021,23 @@ ignore_section_sym (bfd *abfd, asymbol *
{
elf_symbol_type *type_ptr;
+ if (sym == NULL)
+ return FALSE;
+
if ((sym->flags & BSF_SECTION_SYM) == 0)
return FALSE;
+ if (sym->section == NULL)
+ return TRUE;
+
type_ptr = elf_symbol_from (abfd, sym);
return ((type_ptr != NULL
&& type_ptr->internal_elf_sym.st_shndx != 0
&& bfd_is_abs_section (sym->section))
|| !(sym->section->owner == abfd
- || (sym->section->output_section->owner == abfd
- && sym->section->output_offset == 0)
+ || (sym->section->output_section != NULL
+ && sym->section->output_section->owner == abfd
+ && sym->section->output_offset == 0)
|| bfd_is_abs_section (sym->section)));
}

View File

@ -0,0 +1,101 @@
diff -rup binutils.orig/bfd/dwarf2.c binutils-2.30/bfd/dwarf2.c
--- binutils.orig/bfd/dwarf2.c 2018-09-26 15:07:47.162863937 +0100
+++ binutils-2.30/bfd/dwarf2.c 2018-09-26 15:08:50.868368183 +0100
@@ -527,6 +527,7 @@ read_section (bfd * abfd,
asection *msec;
const char *section_name = sec->uncompressed_name;
bfd_byte *contents = *section_buffer;
+ bfd_size_type amt;
/* The section may have already been read. */
if (contents == NULL)
@@ -549,7 +550,14 @@ read_section (bfd * abfd,
*section_size = msec->rawsize ? msec->rawsize : msec->size;
/* Paranoia - alloc one extra so that we can make sure a string
section is NUL terminated. */
- contents = (bfd_byte *) bfd_malloc (*section_size + 1);
+ amt = *section_size + 1;
+ if (amt == 0)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+ contents = (bfd_byte *) bfd_malloc (amt);
+
if (contents == NULL)
return FALSE;
if (syms
diff -rup binutils.orig/bfd/syms.c binutils-2.30/bfd/syms.c
--- binutils.orig/bfd/syms.c 2018-09-26 15:07:47.162863937 +0100
+++ binutils-2.30/bfd/syms.c 2018-09-26 15:11:41.671038993 +0100
@@ -1035,6 +1035,10 @@ _bfd_stab_section_find_nearest_line (bfd
0, strsize))
return FALSE;
+ /* Stab strings ought to be nul terminated. Ensure the last one
+ is, to prevent running off the end of the buffer. */
+ info->strs[strsize - 1] = 0;
+
/* If this is a relocatable object file, we have to relocate
the entries in .stab. This should always be simple 32 bit
relocations against symbols defined in this object file, so
@@ -1073,7 +1077,8 @@ _bfd_stab_section_find_nearest_line (bfd
|| r->howto->bitsize != 32
|| r->howto->pc_relative
|| r->howto->bitpos != 0
- || r->howto->dst_mask != 0xffffffff)
+ || r->howto->dst_mask != 0xffffffff
+ || r->address * bfd_octets_per_byte (abfd) + 4 > stabsize)
{
_bfd_error_handler
(_("Unsupported .stab relocation"));
@@ -1195,7 +1200,8 @@ _bfd_stab_section_find_nearest_line (bfd
{
nul_fun = stab;
nul_str = str;
- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+ if (file_name >= (char *) info->strs + strsize
+ || file_name < (char *) str)
file_name = NULL;
if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize
&& *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO)
@@ -1206,7 +1212,8 @@ _bfd_stab_section_find_nearest_line (bfd
directory_name = file_name;
file_name = ((char *) str
+ bfd_get_32 (abfd, stab + STRDXOFF));
- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+ if (file_name >= (char *) info->strs + strsize
+ || file_name < (char *) str)
file_name = NULL;
}
}
@@ -1217,7 +1224,8 @@ _bfd_stab_section_find_nearest_line (bfd
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
/* PR 17512: file: 0c680a1f. */
/* PR 17512: file: 5da8aec4. */
- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+ if (file_name >= (char *) info->strs + strsize
+ || file_name < (char *) str)
file_name = NULL;
break;
@@ -1226,7 +1234,8 @@ _bfd_stab_section_find_nearest_line (bfd
function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
if (function_name == (char *) str)
continue;
- if (function_name >= (char *) info->strs + strsize)
+ if (function_name >= (char *) info->strs + strsize
+ || function_name < (char *) str)
function_name = NULL;
nul_fun = NULL;
@@ -1335,7 +1344,8 @@ _bfd_stab_section_find_nearest_line (bfd
if (val <= offset)
{
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+ if (file_name >= (char *) info->strs + strsize
+ || file_name < (char *) str)
file_name = NULL;
*pline = 0;
}

View File

@ -0,0 +1,20 @@
--- binutils.orig/bfd/elfcode.h 2018-05-01 11:42:03.250424443 +0100
+++ binutils-2.30/bfd/elfcode.h 2018-05-01 12:41:00.745780026 +0100
@@ -680,7 +680,7 @@ elf_object_p (bfd *abfd)
if (i_ehdrp->e_shnum > ((bfd_size_type) -1) / sizeof (*i_shdrp))
goto got_wrong_format_error;
#endif
- amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
+ amt = sizeof (*i_shdrp) * (bfd_size_type) i_ehdrp->e_shnum;
i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
if (!i_shdrp)
goto got_no_match;
@@ -776,7 +776,7 @@ elf_object_p (bfd *abfd)
if (i_ehdrp->e_phnum > ((bfd_size_type) -1) / sizeof (*i_phdr))
goto got_wrong_format_error;
#endif
- amt = i_ehdrp->e_phnum * sizeof (*i_phdr);
+ amt = (bfd_size_type) i_ehdrp->e_phnum * sizeof (*i_phdr);
elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->phdr == NULL)
goto got_no_match;

View File

@ -0,0 +1,69 @@
--- binutils.orig/bfd/opncls.c 2018-05-01 11:42:03.266424248 +0100
+++ binutils-2.30/bfd/opncls.c 2018-05-01 12:52:36.792579838 +0100
@@ -1179,6 +1179,7 @@ bfd_get_debug_link_info_1 (bfd *abfd, vo
bfd_byte *contents;
unsigned int crc_offset;
char *name;
+ bfd_size_type size;
BFD_ASSERT (abfd);
BFD_ASSERT (crc32_out);
@@ -1188,6 +1189,12 @@ bfd_get_debug_link_info_1 (bfd *abfd, vo
if (sect == NULL)
return NULL;
+ size = bfd_get_section_size (sect);
+
+ /* PR 22794: Make sure that the section has a reasonable size. */
+ if (size < 8 || size >= bfd_get_size (abfd))
+ return NULL;
+
if (!bfd_malloc_and_get_section (abfd, sect, &contents))
{
if (contents != NULL)
@@ -1198,9 +1205,9 @@ bfd_get_debug_link_info_1 (bfd *abfd, vo
/* CRC value is stored after the filename, aligned up to 4 bytes. */
name = (char *) contents;
/* PR 17597: avoid reading off the end of the buffer. */
- crc_offset = strnlen (name, bfd_get_section_size (sect)) + 1;
+ crc_offset = strnlen (name, size) + 1;
crc_offset = (crc_offset + 3) & ~3;
- if (crc_offset + 4 > bfd_get_section_size (sect))
+ if (crc_offset + 4 > size)
return NULL;
*crc32 = bfd_get_32 (abfd, contents + crc_offset);
@@ -1261,6 +1268,7 @@ bfd_get_alt_debug_link_info (bfd * abfd,
bfd_byte *contents;
unsigned int buildid_offset;
char *name;
+ bfd_size_type size;
BFD_ASSERT (abfd);
BFD_ASSERT (buildid_len);
@@ -1271,6 +1279,10 @@ bfd_get_alt_debug_link_info (bfd * abfd,
if (sect == NULL)
return NULL;
+ size = bfd_get_section_size (sect);
+ if (size < 8 || size >= bfd_get_size (abfd))
+ return NULL;
+
if (!bfd_malloc_and_get_section (abfd, sect, & contents))
{
if (contents != NULL)
@@ -1280,11 +1292,11 @@ bfd_get_alt_debug_link_info (bfd * abfd,
/* BuildID value is stored after the filename. */
name = (char *) contents;
- buildid_offset = strnlen (name, bfd_get_section_size (sect)) + 1;
- if (buildid_offset >= bfd_get_section_size (sect))
+ buildid_offset = strnlen (name, size) + 1;
+ if (buildid_offset >= size)
return NULL;
- *buildid_len = bfd_get_section_size (sect) - buildid_offset;
+ *buildid_len = size - buildid_offset;
*buildid_out = bfd_malloc (*buildid_len);
memcpy (*buildid_out, contents + buildid_offset, *buildid_len);

View File

@ -0,0 +1,12 @@
--- binutils.orig/bfd/coffgen.c 2018-04-27 09:23:33.449859052 +0100
+++ binutils-2.30/bfd/coffgen.c 2018-04-27 09:34:34.530135122 +0100
@@ -1555,7 +1555,8 @@ coff_pointerize_aux (bfd *abfd,
}
/* A negative tagndx is meaningless, but the SCO 3.2v4 cc can
generate one, so we must be careful to ignore it. */
- if (auxent->u.auxent.x_sym.x_tagndx.l > 0)
+ if ((unsigned long) auxent->u.auxent.x_sym.x_tagndx.l
+ < obj_raw_syment_count (abfd))
{
auxent->u.auxent.x_sym.x_tagndx.p =
table_base + auxent->u.auxent.x_sym.x_tagndx.l;

View File

@ -0,0 +1,37 @@
--- binutils.orig/bfd/dwarf1.c 2018-05-01 13:04:35.060041875 +0100
+++ binutils-2.30/bfd/dwarf1.c 2018-05-01 13:24:17.943833855 +0100
@@ -213,6 +213,7 @@ parse_die (bfd * abfd,
/* Then the attributes. */
while (xptr + 2 <= aDiePtrEnd)
{
+ unsigned int block_len;
unsigned short attr;
/* Parse the attribute based on its form. This section
@@ -255,12 +256,24 @@ parse_die (bfd * abfd,
break;
case FORM_BLOCK2:
if (xptr + 2 <= aDiePtrEnd)
- xptr += bfd_get_16 (abfd, xptr);
+ {
+ block_len = bfd_get_16 (abfd, xptr);
+ if (xptr + block_len > aDiePtrEnd
+ || xptr + block_len < xptr)
+ return FALSE;
+ xptr += block_len;
+ }
xptr += 2;
break;
case FORM_BLOCK4:
if (xptr + 4 <= aDiePtrEnd)
- xptr += bfd_get_32 (abfd, xptr);
+ {
+ block_len = bfd_get_32 (abfd, xptr);
+ if (xptr + block_len > aDiePtrEnd
+ || xptr + block_len < xptr)
+ return FALSE;
+ xptr += block_len;
+ }
xptr += 4;
break;
case FORM_STRING:

View File

@ -0,0 +1,75 @@
--- binutils.orig/bfd/dwarf2.c 2018-05-01 13:04:35.055041935 +0100
+++ binutils-2.30/bfd/dwarf2.c 2018-05-01 13:31:32.882624448 +0100
@@ -622,14 +622,24 @@ read_8_bytes (bfd *abfd, bfd_byte *buf,
}
static bfd_byte *
-read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED,
- bfd_byte *buf,
- bfd_byte *end,
- unsigned int size ATTRIBUTE_UNUSED)
-{
- if (buf + size > end)
- return NULL;
- return buf;
+read_n_bytes (bfd_byte * buf,
+ bfd_byte * end,
+ struct dwarf_block * block)
+{
+ unsigned int size = block->size;
+ bfd_byte * block_end = buf + size;
+
+ if (block_end > end || block_end < buf)
+ {
+ block->data = NULL;
+ block->size = 0;
+ return end;
+ }
+ else
+ {
+ block->data = buf;
+ return block_end;
+ }
}
/* Scans a NUL terminated string starting at BUF, returning a pointer to it.
@@ -1127,8 +1137,7 @@ read_attribute_value (struct attribute *
return NULL;
blk->size = read_2_bytes (abfd, info_ptr, info_ptr_end);
info_ptr += 2;
- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size);
- info_ptr += blk->size;
+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk);
attr->u.blk = blk;
break;
case DW_FORM_block4:
@@ -1138,8 +1147,7 @@ read_attribute_value (struct attribute *
return NULL;
blk->size = read_4_bytes (abfd, info_ptr, info_ptr_end);
info_ptr += 4;
- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size);
- info_ptr += blk->size;
+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk);
attr->u.blk = blk;
break;
case DW_FORM_data2:
@@ -1179,8 +1187,7 @@ read_attribute_value (struct attribute *
blk->size = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
FALSE, info_ptr_end);
info_ptr += bytes_read;
- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size);
- info_ptr += blk->size;
+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk);
attr->u.blk = blk;
break;
case DW_FORM_block1:
@@ -1190,8 +1197,7 @@ read_attribute_value (struct attribute *
return NULL;
blk->size = read_1_byte (abfd, info_ptr, info_ptr_end);
info_ptr += 1;
- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size);
- info_ptr += blk->size;
+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk);
attr->u.blk = blk;
break;
case DW_FORM_data1:

View File

@ -0,0 +1,156 @@
--- binutils.orig/bfd/elf.c 2018-05-01 11:42:03.151425659 +0100
+++ binutils-2.30/bfd/elf.c 2018-05-01 12:30:42.129206856 +0100
@@ -5713,6 +5713,9 @@ assign_file_positions_for_load_sections
return TRUE;
}
+#define IS_TBSS(s) \
+ ((s->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) == SEC_THREAD_LOCAL)
+
/* Assign file positions for the other sections. */
static bfd_boolean
@@ -5862,65 +5865,100 @@ assign_file_positions_for_non_load_secti
{
if (p->p_type == PT_GNU_RELRO)
{
- const Elf_Internal_Phdr *lp;
- struct elf_segment_map *lm;
+ bfd_vma start, end;
+ bfd_boolean ok;
if (link_info != NULL)
{
/* During linking the range of the RELRO segment is passed
- in link_info. */
+ in link_info. Note that there may be padding between
+ relro_start and the first RELRO section. */
+ start = link_info->relro_start;
+ end = link_info->relro_end;
+ }
+ else if (m->count != 0)
+ {
+ if (!m->p_size_valid)
+ abort ();
+ start = m->sections[0]->vma;
+ end = start + m->p_size;
+ }
+ else
+ {
+ start = 0;
+ end = 0;
+ }
+
+ ok = FALSE;
+ if (start < end)
+ {
+ struct elf_segment_map *lm;
+ const Elf_Internal_Phdr *lp;
+ unsigned int i;
+
+ /* Find a LOAD segment containing a section in the RELRO
+ segment. */
for (lm = elf_seg_map (abfd), lp = phdrs;
lm != NULL;
lm = lm->next, lp++)
{
if (lp->p_type == PT_LOAD
- && lp->p_vaddr < link_info->relro_end
&& lm->count != 0
- && lm->sections[0]->vma >= link_info->relro_start)
+ && (lm->sections[lm->count - 1]->vma
+ + (!IS_TBSS (lm->sections[lm->count - 1])
+ ? lm->sections[lm->count - 1]->size
+ : 0)) > start
+ && lm->sections[0]->vma < end)
break;
}
- BFD_ASSERT (lm != NULL);
- }
- else
- {
- /* Otherwise we are copying an executable or shared
- library, but we need to use the same linker logic. */
- for (lp = phdrs; lp < phdrs + count; ++lp)
+ if (lm != NULL)
{
- if (lp->p_type == PT_LOAD
- && lp->p_paddr == p->p_paddr)
- break;
+ /* Find the section starting the RELRO segment. */
+ for (i = 0; i < lm->count; i++)
+ {
+ asection *s = lm->sections[i];
+ if (s->vma >= start
+ && s->vma < end
+ && s->size != 0)
+ break;
+ }
+
+ if (i < lm->count)
+ {
+ p->p_vaddr = lm->sections[i]->vma;
+ p->p_paddr = lm->sections[i]->lma;
+ p->p_offset = lm->sections[i]->filepos;
+ p->p_memsz = end - p->p_vaddr;
+ p->p_filesz = p->p_memsz;
+
+ /* The RELRO segment typically ends a few bytes
+ into .got.plt but other layouts are possible.
+ In cases where the end does not match any
+ loaded section (for instance is in file
+ padding), trim p_filesz back to correspond to
+ the end of loaded section contents. */
+ if (p->p_filesz > lp->p_vaddr + lp->p_filesz - p->p_vaddr)
+ p->p_filesz = lp->p_vaddr + lp->p_filesz - p->p_vaddr;
+
+ /* Preserve the alignment and flags if they are
+ valid. The gold linker generates RW/4 for
+ the PT_GNU_RELRO section. It is better for
+ objcopy/strip to honor these attributes
+ otherwise gdb will choke when using separate
+ debug files. */
+ if (!m->p_align_valid)
+ p->p_align = 1;
+ if (!m->p_flags_valid)
+ p->p_flags = PF_R;
+ ok = TRUE;
+ }
}
}
-
- if (lp < phdrs + count)
- {
- p->p_vaddr = lp->p_vaddr;
- p->p_paddr = lp->p_paddr;
- p->p_offset = lp->p_offset;
- if (link_info != NULL)
- p->p_filesz = link_info->relro_end - lp->p_vaddr;
- else if (m->p_size_valid)
- p->p_filesz = m->p_size;
- else
- abort ();
- p->p_memsz = p->p_filesz;
- /* Preserve the alignment and flags if they are valid. The
- gold linker generates RW/4 for the PT_GNU_RELRO section.
- It is better for objcopy/strip to honor these attributes
- otherwise gdb will choke when using separate debug files.
- */
- if (!m->p_align_valid)
- p->p_align = 1;
- if (!m->p_flags_valid)
- p->p_flags = PF_R;
- }
- else
- {
- memset (p, 0, sizeof *p);
- p->p_type = PT_NULL;
- }
+ if (link_info != NULL)
+ BFD_ASSERT (ok);
+ if (!ok)
+ memset (p, 0, sizeof *p);
}
else if (p->p_type == PT_GNU_STACK)
{

View File

@ -0,0 +1,17 @@
--- binutils.orig/bfd/aoutx.h 2018-04-26 15:14:18.411450291 +0100
+++ binutils-2.30/bfd/aoutx.h 2018-04-26 17:22:38.328770529 +0100
@@ -2283,10 +2283,12 @@ NAME (aout, swap_std_reloc_in) (bfd *abf
if (r_baserel)
r_extern = 1;
- if (r_extern && r_index > symcount)
+ if (r_extern && r_index >= symcount)
{
/* We could arrange to return an error, but it might be useful
- to see the file even if it is bad. */
+ to see the file even if it is bad. FIXME: Of course this
+ means that objdump -r *doesn't* see the actual reloc, and
+ objcopy silently writes a different reloc. */
r_extern = 0;
r_index = N_ABS;
}

View File

@ -0,0 +1,16 @@
--- binutils.orig/binutils/dwarf.c 2018-04-27 09:22:07.402864408 +0100
+++ binutils-2.30/binutils/dwarf.c 2018-04-27 09:24:26.794235786 +0100
@@ -6810,6 +6810,13 @@ display_debug_ranges (struct dwarf_secti
continue;
}
+ if (next < section_begin || next >= finish)
+ {
+ warn (_("Corrupt offset (%#8.8lx) in range entry %u\n"),
+ (unsigned long) offset, i);
+ continue;
+ }
+
if (dwarf_check != 0 && i > 0)
{
if (start < next)

View File

@ -0,0 +1,29 @@
diff -rup binutils.orig/bfd/elf-attrs.c binutils-2.30/bfd/elf-attrs.c
--- binutils.orig/bfd/elf-attrs.c 2018-05-17 14:14:04.341805666 +0100
+++ binutils-2.30/bfd/elf-attrs.c 2018-05-17 14:15:19.729952453 +0100
@@ -438,6 +438,14 @@ _bfd_elf_parse_attributes (bfd *abfd, El
/* PR 17512: file: 2844a11d. */
if (hdr->sh_size == 0)
return;
+ if (hdr->sh_size > bfd_get_file_size (abfd))
+ {
+ _bfd_error_handler (_("%pB: error: attribute section '%pA' too big: %#llx"),
+ abfd, hdr->bfd_section, (long long) hdr->sh_size);
+ bfd_set_error (bfd_error_invalid_operation);
+ return;
+ }
+
contents = (bfd_byte *) bfd_malloc (hdr->sh_size + 1);
if (!contents)
return;
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2018-05-17 14:14:04.326805836 +0100
+++ binutils-2.30/bfd/elf.c 2018-05-17 14:15:59.412503342 +0100
@@ -298,6 +298,7 @@ bfd_elf_get_str_section (bfd *abfd, unsi
/* Allocate and clear an extra byte at the end, to prevent crashes
in case the string table is not terminated. */
if (shstrtabsize + 1 <= 1
+ || shstrtabsize > bfd_get_file_size (abfd)
|| bfd_seek (abfd, offset, SEEK_SET) != 0
|| (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL)
shstrtab = NULL;

View File

@ -0,0 +1,15 @@
--- binutils.orig/gold/fileread.cc 2019-11-08 10:33:58.911577903 +0000
+++ binutils-2.30/gold/fileread.cc 2019-11-08 10:34:13.001470092 +0000
@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_
ssize_t bytes;
if (this->whole_file_view_ != NULL)
{
+ // See PR 23765 for an example of a testcase that triggers this error.
+ if (((ssize_t) start) < 0)
+ gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),
+ this->filename().c_str(),
+ static_cast<long long>(start));
+
bytes = this->size_ - start;
if (static_cast<section_size_type>(bytes) >= size)
{

View File

@ -0,0 +1,11 @@
--- binutils.orig/binutils/readelf.c 2019-08-13 10:03:33.518792590 +0100
+++ binutils-2.32/binutils/readelf.c 2019-08-13 10:04:22.885418269 +0100
@@ -13234,7 +13234,7 @@ apply_relocations (Filedata *
}
rloc = start + rp->r_offset;
- if ((rloc + reloc_size) > end || (rloc < start))
+ if (rloc >= end || (rloc + reloc_size) > end || (rloc < start))
{
warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
(unsigned long) rp->r_offset,

View File

@ -0,0 +1,62 @@
--- binutils.orig/bfd/dwarf2.c 2019-12-03 15:50:43.324118062 +0000
+++ binutils-2.30/bfd/dwarf2.c 2019-12-03 15:54:32.545489215 +0000
@@ -2803,8 +2803,8 @@ lookup_symbol_in_variable_table (struct
static bfd_boolean
find_abstract_instance_name (struct comp_unit *unit,
- bfd_byte *orig_info_ptr,
struct attribute *attr_ptr,
+ unsigned int recur_count,
const char **pname,
bfd_boolean *is_linkage)
{
@@ -2817,6 +2817,14 @@ find_abstract_instance_name (struct comp
struct attribute attr;
const char *name = NULL;
+ if (recur_count == 100)
+ {
+ _bfd_error_handler
+ (_("DWARF error: abstract instance recursion detected"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
/* DW_FORM_ref_addr can reference an entry in a different CU. It
is an offset from the .debug_info section, not the current CU. */
if (attr_ptr->form == DW_FORM_ref_addr)
@@ -2934,15 +2942,7 @@ find_abstract_instance_name (struct comp
info_ptr, info_ptr_end);
if (info_ptr == NULL)
break;
- /* It doesn't ever make sense for DW_AT_specification to
- refer to the same DIE. Stop simple recursion. */
- if (info_ptr == orig_info_ptr)
- {
- _bfd_error_handler
- (_("Dwarf Error: Abstract instance recursion detected."));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
+
switch (attr.name)
{
case DW_AT_name:
@@ -2956,7 +2956,7 @@ find_abstract_instance_name (struct comp
}
break;
case DW_AT_specification:
- if (!find_abstract_instance_name (unit, info_ptr, &attr,
+ if (!find_abstract_instance_name (unit, &attr, recur_count + 1,
pname, is_linkage))
return FALSE;
break;
@@ -3162,7 +3162,7 @@ scan_unit_for_symbols (struct comp_unit
case DW_AT_abstract_origin:
case DW_AT_specification:
- if (!find_abstract_instance_name (unit, info_ptr, &attr,
+ if (!find_abstract_instance_name (unit, &attr, 0,
&func->name,
&func->is_linkage))
goto fail;

View File

@ -0,0 +1,20 @@
--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:32:09.395430104 +0000
+++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:33:17.272899503 +0000
@@ -4440,7 +4440,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd,
for (total_size = 0;
msec;
msec = find_debug_info (debug_bfd, debug_sections, msec))
- total_size += msec->size;
+ {
+ /* Catch PR25070 testcase overflowing size calculation here. */
+ if (total_size + msec->size < total_size
+ || total_size + msec->size < msec->size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+ total_size += msec->size;
+ }
stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size);
if (stash->info_ptr_memory == NULL)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
--- binutils.orig/bfd/elf32-ppc.c 2018-06-12 17:35:40.931551297 +0100
+++ binutils-2.30/bfd/elf32-ppc.c 2018-06-12 17:37:22.252441292 +0100
@@ -4677,12 +4677,12 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *i
_bfd_error_handler
/* xgettext:c-format */
(_("Warning: %B uses IBM long double, "
- "%B uses IEEE long double"), ibfd, obfd);
+ "%B uses IEEE long double"), obfd, ibfd);
else if (out_fp == 3 * 4 && in_fp == 1 * 4)
_bfd_error_handler
/* xgettext:c-format */
(_("Warning: %B uses IBM long double, "
- "%B uses IEEE long double"), obfd, ibfd);
+ "%B uses IEEE long double"), ibfd, obfd);
}
}

View File

@ -0,0 +1,855 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.32/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2019-07-02 17:30:19.407892712 +0100
+++ binutils-2.32/bfd/elfnn-aarch64.c 2019-07-02 17:35:21.874749884 +0100
@@ -2579,6 +2579,9 @@ struct elf_aarch64_link_hash_table
unsigned int top_index;
asection **input_list;
+ /* JUMP_SLOT relocs for variant PCS symbols may be present. */
+ int variant_pcs;
+
/* The offset into splt of the PLT entry for the TLS descriptor
resolver. Special values are 0, if not necessary (or not found
to be necessary yet), and -1 if needed but not determined
@@ -2790,6 +2793,31 @@ elfNN_aarch64_copy_indirect_symbol (stru
_bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
+/* Merge non-visibility st_other attributes. */
+
+static void
+elfNN_aarch64_merge_symbol_attribute (struct elf_link_hash_entry *h,
+ const Elf_Internal_Sym *isym,
+ bfd_boolean definition ATTRIBUTE_UNUSED,
+ bfd_boolean dynamic ATTRIBUTE_UNUSED)
+{
+ unsigned int isym_sto = isym->st_other & ~ELF_ST_VISIBILITY (-1);
+ unsigned int h_sto = h->other & ~ELF_ST_VISIBILITY (-1);
+
+ if (isym_sto == h_sto)
+ return;
+
+ if (isym_sto & ~STO_AARCH64_VARIANT_PCS)
+ /* Not fatal, this callback cannot fail. */
+ _bfd_error_handler (_("unknown attribute for symbol `%s': 0x%02x"),
+ h->root.root.string, isym_sto);
+
+ /* Note: Ideally we would warn about any attribute mismatch, but
+ this api does not allow that without substantial changes. */
+ if (isym_sto & STO_AARCH64_VARIANT_PCS)
+ h->other |= STO_AARCH64_VARIANT_PCS;
+}
+
/* Destroy an AArch64 elf linker hash table. */
static void
@@ -8370,6 +8398,12 @@ elfNN_aarch64_allocate_dynrelocs (struct
updated. */
htab->root.srelplt->reloc_count++;
+
+ /* Mark the DSO in case R_<CLS>_JUMP_SLOT relocs against
+ variant PCS symbols are present. */
+ if (h->other & STO_AARCH64_VARIANT_PCS)
+ htab->variant_pcs = 1;
+
}
else
{
@@ -8958,6 +8992,10 @@ elfNN_aarch64_size_dynamic_sections (bfd
|| !add_dynamic_entry (DT_JMPREL, 0))
return FALSE;
+ if (htab->variant_pcs
+ && !add_dynamic_entry (DT_AARCH64_VARIANT_PCS, 0))
+ return FALSE;
+
if (htab->tlsdesc_plt
&& (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
|| !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
@@ -9708,6 +9746,9 @@ const struct elf_size_info elfNN_aarch64
#define elf_backend_copy_indirect_symbol \
elfNN_aarch64_copy_indirect_symbol
+#define elf_backend_merge_symbol_attribute \
+ elfNN_aarch64_merge_symbol_attribute
+
/* Create .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts
to them in our hash. */
#define elf_backend_create_dynamic_sections \
diff -rup binutils.orig/binutils/readelf.c binutils-2.32/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2019-07-02 17:30:18.890896375 +0100
+++ binutils-2.32/binutils/readelf.c 2019-07-02 17:32:25.008002901 +0100
@@ -1797,6 +1797,19 @@ dump_relocations (Filedata * fi
}
static const char *
+get_aarch64_dynamic_type (unsigned long type)
+{
+ switch (type)
+ {
+ case DT_AARCH64_BTI_PLT: return "AARCH64_BTI_PLT";
+ case DT_AARCH64_PAC_PLT: return "AARCH64_PAC_PLT";
+ case DT_AARCH64_VARIANT_PCS: return "AARCH64_VARIANT_PCS";
+ default:
+ return NULL;
+ }
+}
+
+static const char *
get_mips_dynamic_type (unsigned long type)
{
switch (type)
@@ -2169,6 +2182,9 @@ get_dynamic_type (Filedata * filedata, u
switch (filedata->file_header.e_machine)
{
+ case EM_AARCH64:
+ result = get_aarch64_dynamic_type (type);
+ break;
case EM_MIPS:
case EM_MIPS_RS3_LE:
result = get_mips_dynamic_type (type);
@@ -11054,6 +11070,22 @@ get_solaris_symbol_visibility (unsigned
}
static const char *
+get_aarch64_symbol_other (unsigned int other)
+{
+ static char buf[32];
+
+ if (other & STO_AARCH64_VARIANT_PCS)
+ {
+ other &= ~STO_AARCH64_VARIANT_PCS;
+ if (other == 0)
+ return "VARIANT_PCS";
+ snprintf (buf, sizeof buf, "VARIANT_PCS | %x", other);
+ return buf;
+ }
+ return NULL;
+}
+
+static const char *
get_mips_symbol_other (unsigned int other)
{
switch (other)
@@ -11164,6 +11196,9 @@ get_symbol_other (Filedata * filedata, u
switch (filedata->file_header.e_machine)
{
+ case EM_AARCH64:
+ result = get_aarch64_symbol_other (other);
+ break;
case EM_MIPS:
result = get_mips_symbol_other (other);
break;
diff -rup binutils.orig/gas/config/tc-aarch64.c binutils-2.32/gas/config/tc-aarch64.c
--- binutils.orig/gas/config/tc-aarch64.c 2019-07-02 17:30:19.131894667 +0100
+++ binutils-2.32/gas/config/tc-aarch64.c 2019-07-02 17:35:45.202584620 +0100
@@ -1938,6 +1938,28 @@ s_aarch64_elf_cons (int nbytes)
demand_empty_rest_of_line ();
}
+/* Mark symbol that it follows a variant PCS convention. */
+
+static void
+s_variant_pcs (int ignored ATTRIBUTE_UNUSED)
+{
+ char *name;
+ char c;
+ symbolS *sym;
+ asymbol *bfdsym;
+ elf_symbol_type *elfsym;
+
+ c = get_symbol_name (&name);
+ if (!*name)
+ as_bad (_("Missing symbol name in directive"));
+ sym = symbol_find_or_make (name);
+ restore_line_pointer (c);
+ demand_empty_rest_of_line ();
+ bfdsym = symbol_get_bfdsym (sym);
+ elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
+ gas_assert (elfsym);
+ elfsym->internal_elf_sym.st_other |= STO_AARCH64_VARIANT_PCS;
+}
#endif /* OBJ_ELF */
/* Output a 32-bit word, but mark as an instruction. */
@@ -2084,6 +2106,7 @@ const pseudo_typeS md_pseudo_table[] = {
{"long", s_aarch64_elf_cons, 4},
{"xword", s_aarch64_elf_cons, 8},
{"dword", s_aarch64_elf_cons, 8},
+ {"variant_pcs", s_variant_pcs, 0},
#endif
{0, 0, 0}
};
@@ -9320,3 +9343,35 @@ aarch64_copy_symbol_attributes (symbolS
{
AARCH64_GET_FLAG (dest) = AARCH64_GET_FLAG (src);
}
+
+#ifdef OBJ_ELF
+/* Same as elf_copy_symbol_attributes, but without copying st_other.
+ This is needed so AArch64 specific st_other values can be independently
+ specified for an IFUNC resolver (that is called by the dynamic linker)
+ and the symbol it resolves (aliased to the resolver). In particular,
+ if a function symbol has special st_other value set via directives,
+ then attaching an IFUNC resolver to that symbol should not override
+ the st_other setting. Requiring the directive on the IFUNC resolver
+ symbol would be unexpected and problematic in C code, where the two
+ symbols appear as two independent function declarations. */
+
+void
+aarch64_elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
+{
+ struct elf_obj_sy *srcelf = symbol_get_obj (src);
+ struct elf_obj_sy *destelf = symbol_get_obj (dest);
+ if (srcelf->size)
+ {
+ if (destelf->size == NULL)
+ destelf->size = XNEW (expressionS);
+ *destelf->size = *srcelf->size;
+ }
+ else
+ {
+ if (destelf->size != NULL)
+ free (destelf->size);
+ destelf->size = NULL;
+ }
+ S_SET_SIZE (dest, S_GET_SIZE (src));
+}
+#endif
diff -rup binutils.orig/gas/config/tc-aarch64.h binutils-2.32/gas/config/tc-aarch64.h
--- binutils.orig/gas/config/tc-aarch64.h 2019-07-02 17:30:19.136894632 +0100
+++ binutils-2.32/gas/config/tc-aarch64.h 2019-07-02 17:35:45.202584620 +0100
@@ -130,6 +130,12 @@ void aarch64_copy_symbol_attributes (sym
(aarch64_copy_symbol_attributes (DEST, SRC))
#endif
+#ifdef OBJ_ELF
+void aarch64_elf_copy_symbol_attributes (symbolS *, symbolS *);
+#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \
+ aarch64_elf_copy_symbol_attributes (DEST, SRC)
+#endif
+
#define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) \
(NEXT_CHAR == ':' || (NEXT_CHAR == '/' && aarch64_data_in_code ()))
#define tc_canonicalize_symbol_name(str) aarch64_canonicalize_symbol_name (str);
diff -rup binutils.orig/gas/doc/c-aarch64.texi binutils-2.32/gas/doc/c-aarch64.texi
--- binutils.orig/gas/doc/c-aarch64.texi 2019-07-02 17:30:19.125894710 +0100
+++ binutils-2.32/gas/doc/c-aarch64.texi 2019-07-02 17:35:11.362824354 +0100
@@ -425,6 +425,12 @@ should only be done if it is really nece
@c VVVVVVVVVVVVVVVVVVVVVVVVVV
+@cindex @code{.variant_pcs} directive, AArch64
+@item .variant_pcs @var{symbol}
+This directive marks @var{symbol} referencing a function that may
+follow a variant procedure call standard with different register
+usage convention from the base procedure call standard.
+
@c WWWWWWWWWWWWWWWWWWWWWWWWWW
@c XXXXXXXXXXXXXXXXXXXXXXXXXX
diff -rup binutils.orig/include/elf/aarch64.h binutils-2.32/include/elf/aarch64.h
--- binutils.orig/include/elf/aarch64.h 2019-07-02 17:30:18.850896658 +0100
+++ binutils-2.32/include/elf/aarch64.h 2019-07-02 17:32:55.678785616 +0100
@@ -36,6 +36,15 @@
#define SHF_COMDEF 0x80000000 /* Section may be multiply defined
in the input to a link step. */
+/* Processor specific dynamic array tags. */
+#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1)
+#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3)
+#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
+
+/* AArch64-specific values for st_other. */
+#define STO_AARCH64_VARIANT_PCS 0x80 /* Symbol may follow different call
+ convention from the base PCS. */
+
/* Relocation types. */
START_RELOC_NUMBERS (elf_aarch64_reloc_type)
diff -rup binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp binutils-2.32/ld/testsuite/ld-aarch64/aarch64-elf.exp
--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp 2019-07-02 17:30:18.922896148 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/aarch64-elf.exp 2019-07-02 17:35:21.875749878 +0100
@@ -371,6 +371,10 @@ run_dump_test_lp64 "rela-abs-relative-op
run_dump_test_lp64 "pie-bind-locally"
+run_dump_test_lp64 "variant_pcs-r"
+run_dump_test_lp64 "variant_pcs-shared"
+run_dump_test_lp64 "variant_pcs-now"
+
set aarch64elflinktests {
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
{} "copy-reloc-so.so"}
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.d 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,10 @@
+#objdump: -t
+
+.*: file format .*
+
+SYMBOL TABLE:
+0+ l d \.text 0+ \.text
+0+ l d \.data 0+ \.data
+0+ l d \.bss 0+ \.bss
+0+ l \.text 0+ func
+0+ \*UND\* 0+ 0x80 foobar
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.s 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,8 @@
+.text
+.variant_pcs foobar
+func:
+ bl foobar
+ b foobar
+
+.data
+.xword foobar
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.d 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,9 @@
+#objdump: -t
+
+.*: file format .*
+
+SYMBOL TABLE:
+0+ l d \.text 0+ \.text
+0+ l d \.data 0+ \.data
+0+ l d \.bss 0+ \.bss
+0+ l \.text 0+ 0x80 foo
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.s 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,4 @@
+.text
+.variant_pcs foo
+foo:
+ ret
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-3.s 2019-07-02 17:35:45.202584620 +0100
@@ -0,0 +1,20 @@
+.text
+.global foo_vpcs
+.global foo_base
+.global alias_vpcs
+.global alias_base
+
+.variant_pcs foo_vpcs
+.variant_pcs alias_vpcs
+
+foo_vpcs:
+foo_base:
+ bl foo_vpcs
+ bl foo_base
+ bl alias_vpcs
+ bl alias_base
+
+/* Check that the STO_AARCH64_VARIANT_PCS is not affected by .set. */
+
+.set alias_base, foo_vpcs
+.set alias_vpcs, foo_base
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-3.d 2019-07-02 17:35:45.202584620 +0100
@@ -0,0 +1,12 @@
+#objdump: -t
+
+.*: file format .*
+
+SYMBOL TABLE:
+0+ l d \.text 0+ \.text
+0+ l d \.data 0+ \.data
+0+ l d \.bss 0+ \.bss
+0+ g \.text 0+ 0x80 foo_vpcs
+0+ g \.text 0+ foo_base
+0+ g \.text 0+ 0x80 alias_vpcs
+0+ g \.text 0+ alias_base
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-1.s 2019-07-02 17:35:21.875749878 +0100
@@ -0,0 +1,59 @@
+.text
+
+.variant_pcs f_spec_global_default_def
+.variant_pcs f_spec_global_default_undef
+.variant_pcs f_spec_global_hidden_def
+.variant_pcs f_spec_local
+.variant_pcs f_spec_global_default_ifunc
+.variant_pcs f_spec_global_hidden_ifunc
+.variant_pcs f_spec_local_ifunc
+
+.global f_spec_global_default_def
+.global f_spec_global_default_undef
+.global f_spec_global_hidden_def
+.global f_spec_global_default_ifunc
+.global f_spec_global_hidden_ifunc
+.global f_base_global_default_def
+.global f_base_global_default_undef
+.global f_base_global_hidden_def
+.global f_base_global_default_ifunc
+.global f_base_global_hidden_ifunc
+
+.hidden f_spec_global_hidden_def
+.hidden f_spec_global_hidden_ifunc
+.hidden f_base_global_hidden_def
+.hidden f_base_global_hidden_ifunc
+
+.type f_spec_global_default_ifunc, %gnu_indirect_function
+.type f_spec_global_hidden_ifunc, %gnu_indirect_function
+.type f_spec_local_ifunc, %gnu_indirect_function
+.type f_base_global_default_ifunc, %gnu_indirect_function
+.type f_base_global_hidden_ifunc, %gnu_indirect_function
+.type f_base_local_ifunc, %gnu_indirect_function
+
+f_spec_global_default_def:
+f_spec_global_hidden_def:
+f_spec_local:
+f_base_global_default_def:
+f_base_global_hidden_def:
+f_base_local:
+f_spec_global_default_ifunc:
+f_spec_global_hidden_ifunc:
+f_spec_local_ifunc:
+f_base_global_default_ifunc:
+f_base_global_hidden_ifunc:
+f_base_local_ifunc:
+ bl f_spec_global_default_def
+ bl f_spec_global_default_undef
+ bl f_spec_global_hidden_def
+ bl f_spec_local
+ bl f_base_global_default_def
+ bl f_base_global_default_undef
+ bl f_base_global_hidden_def
+ bl f_base_local
+ bl f_spec_global_default_ifunc
+ bl f_spec_global_hidden_ifunc
+ bl f_spec_local_ifunc
+ bl f_base_global_default_ifunc
+ bl f_base_global_hidden_ifunc
+ bl f_base_local_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-2.s 2019-07-02 17:35:21.875749878 +0100
@@ -0,0 +1,47 @@
+.text
+
+.variant_pcs f_spec_global_default_def
+.variant_pcs f_spec_global_default_undef
+.variant_pcs f_spec_global_hidden_def
+.variant_pcs f_spec_local2
+.variant_pcs f_spec_global_default_ifunc
+.variant_pcs f_spec_global_hidden_ifunc
+.variant_pcs f_spec_local2_ifunc
+
+.global f_spec_global_default_def
+.global f_spec_global_default_undef
+.global f_spec_global_hidden_def
+.global f_spec_global_default_ifunc
+.global f_spec_global_hidden_ifunc
+.global f_base_global_default_def
+.global f_base_global_default_undef
+.global f_base_global_hidden_def
+.global f_base_global_default_ifunc
+.global f_base_global_hidden_ifunc
+
+.hidden f_spec_global_hidden_def
+.hidden f_spec_global_hidden_ifunc
+.hidden f_base_global_hidden_def
+.hidden f_base_global_hidden_ifunc
+
+.type f_spec_local2_ifunc, %gnu_indirect_function
+.type f_base_local2_ifunc, %gnu_indirect_function
+
+f_spec_local2:
+f_base_local2:
+f_spec_local2_ifunc:
+f_base_local2_ifunc:
+ bl f_spec_global_default_def
+ bl f_spec_global_default_undef
+ bl f_spec_global_hidden_def
+ bl f_spec_local2
+ bl f_base_global_default_def
+ bl f_base_global_default_undef
+ bl f_base_global_hidden_def
+ bl f_base_local2
+ bl f_spec_global_default_ifunc
+ bl f_spec_global_hidden_ifunc
+ bl f_spec_local2_ifunc
+ bl f_base_global_default_ifunc
+ bl f_base_global_hidden_ifunc
+ bl f_base_local2_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs.ld 2019-07-02 17:35:37.100642017 +0100
@@ -0,0 +1,23 @@
+/* Script for .variant_pcs symbol tests. */
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ PROVIDE (__executable_start = 0x8000); . = 0x8000;
+ .text :
+ {
+ *(.before)
+ *(.text)
+ *(.after)
+ } =0
+ . = 0x9000;
+ .got : { *(.got) *(.got.plt)}
+ . = 0x10000;
+ .rela.dyn : { *(.rela.ifunc) }
+ . = 0x11000;
+ .rela.plt : { *(.rela.plt) *(.rela.iplt) }
+ . = 0x12340000;
+ .far : { *(.far) }
+ .ARM.attributes 0 : { *(.ARM.atttributes) }
+}
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-02 17:34:37.557063849 +0100
@@ -0,0 +1,67 @@
+#source: variant_pcs-1.s
+#source: variant_pcs-2.s
+#ld: -shared --hash-style=sysv -T variant_pcs.ld -z now
+#readelf: -rsW
+
+Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
+0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
+
+Symbol table '\.dynsym' contains 7 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+
+Symbol table '\.symtab' contains 35 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000008000 0 SECTION LOCAL DEFAULT 1
+ 2: 0000000000008070 0 SECTION LOCAL DEFAULT 2
+ 3: 0000000000009000 0 SECTION LOCAL DEFAULT 3
+ 4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
+ 5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
+ 6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
+ 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
+ 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
+ 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
+ 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
+ 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
+ 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
+ 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
+ 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
+ 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
+ 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-02 17:35:35.244655166 +0100
@@ -0,0 +1,60 @@
+#source: variant_pcs-1.s
+#source: variant_pcs-2.s
+#ld: -r
+#readelf: -rsW
+
+Relocation section '\.rela\.text' at offset .* contains 24 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0000000000000000 000000180000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_def \+ 0
+0000000000000004 000000110000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000000008 000000120000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_hidden_def \+ 0
+0000000000000010 000000170000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_def \+ 0
+0000000000000014 000000100000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_undef \+ 0
+0000000000000018 000000150000011b R_AARCH64_CALL26 0000000000000000 f_base_global_hidden_def \+ 0
+0000000000000020 000000140000011b R_AARCH64_CALL26 f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000000024 000000160000011b R_AARCH64_CALL26 f_spec_global_hidden_ifunc\(\) f_spec_global_hidden_ifunc \+ 0
+0000000000000028 000000060000011b R_AARCH64_CALL26 f_spec_local_ifunc\(\) f_spec_local_ifunc \+ 0
+000000000000002c 000000190000011b R_AARCH64_CALL26 f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000000030 000000130000011b R_AARCH64_CALL26 f_base_global_hidden_ifunc\(\) f_base_global_hidden_ifunc \+ 0
+0000000000000034 000000070000011b R_AARCH64_CALL26 f_base_local_ifunc\(\) f_base_local_ifunc \+ 0
+0000000000000038 000000180000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_def \+ 0
+000000000000003c 000000110000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000000040 000000120000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_hidden_def \+ 0
+0000000000000048 000000170000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_def \+ 0
+000000000000004c 000000100000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_undef \+ 0
+0000000000000050 000000150000011b R_AARCH64_CALL26 0000000000000000 f_base_global_hidden_def \+ 0
+0000000000000058 000000140000011b R_AARCH64_CALL26 f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+000000000000005c 000000160000011b R_AARCH64_CALL26 f_spec_global_hidden_ifunc\(\) f_spec_global_hidden_ifunc \+ 0
+0000000000000060 0000000c0000011b R_AARCH64_CALL26 f_spec_local2_ifunc\(\) f_spec_local2_ifunc \+ 0
+0000000000000064 000000190000011b R_AARCH64_CALL26 f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000000068 000000130000011b R_AARCH64_CALL26 f_base_global_hidden_ifunc\(\) f_base_global_hidden_ifunc \+ 0
+000000000000006c 0000000d0000011b R_AARCH64_CALL26 f_base_local2_ifunc\(\) f_base_local2_ifunc \+ 0
+
+Symbol table '\.symtab' contains 26 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1
+ 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3
+ 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4
+ 4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
+ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
+ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
+ 8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
+ 9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
+ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
+ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
+ 14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
+ 15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc
+ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def
+ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-02 17:34:45.635006622 +0100
@@ -0,0 +1,67 @@
+#source: variant_pcs-1.s
+#source: variant_pcs-2.s
+#ld: -shared --hash-style=sysv -T variant_pcs.ld
+#readelf: -rsW
+
+Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
+0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
+
+Symbol table '\.dynsym' contains 7 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+
+Symbol table '\.symtab' contains 35 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000008000 0 SECTION LOCAL DEFAULT 1
+ 2: 0000000000008070 0 SECTION LOCAL DEFAULT 2
+ 3: 0000000000009000 0 SECTION LOCAL DEFAULT 3
+ 4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
+ 5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
+ 6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
+ 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
+ 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
+ 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
+ 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
+ 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
+ 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
+ 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
+ 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
+ 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
+ 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-03 10:06:20.012412075 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-03 10:20:51.959203582 +0100
@@ -22,10 +22,10 @@ Symbol table '\.dynsym' contains 7 entri
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
@@ -40,28 +40,28 @@ Symbol table '\.symtab' contains 35 entr
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\]
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\]
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def \[VARIANT_PCS\]
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\]
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-03 10:06:20.012412075 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-03 10:14:28.152933189 +0100
@@ -37,24 +37,24 @@ Symbol table '\.symtab' contains 26 entr
2: 0000000000000000 0 SECTION LOCAL DEFAULT 3
3: 0000000000000000 0 SECTION LOCAL DEFAULT 4
4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
+ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x
10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\]
+ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\]
13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x
16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_spec_global_hidden_def \[VARIANT_PCS\]
19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc
- 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def
- 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\]
23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-03 10:06:20.012412075 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-03 10:19:00.760994532 +0100
@@ -22,10 +22,10 @@ Symbol table '\.dynsym' contains 7 entri
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
@@ -40,28 +40,28 @@ Symbol table '\.symtab' contains 35 entr
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\]
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\]
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def \[VARIANT_PCS\]
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\]
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,122 @@
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 16:21:53.296852157 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 16:28:56.733001935 +0100
@@ -5,28 +5,29 @@
Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
Offset Info Type Symbol's Value Symbol's Name \+ Addend
-0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
-0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
-0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
-0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009020 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009048 0000000.00000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009058 0000000.00000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
-Symbol table '\.dynsym' contains 7 entries:
+Symbol table '\.dynsym' contains . entries:
Num: Value Size Type Bind Vis Ndx Name
- 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
- 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
- 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
Num: Value Size Type Bind Vis Ndx Name
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 16:21:53.296852157 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 16:28:35.565094429 +0100
@@ -5,28 +5,29 @@
Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
Offset Info Type Symbol's Value Symbol's Name \+ Addend
-0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
-0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
-0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
-0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009020 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009048 0000000.00000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009058 0000000.00000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
-Symbol table '\.dynsym' contains 7 entries:
+Symbol table '\.dynsym' contains . entries:
Num: Value Size Type Bind Vis Ndx Name
- 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
- 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
- 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
Num: Value Size Type Bind Vis Ndx Name
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 17:27:02.890275588 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 17:33:51.136464165 +0100
@@ -38,8 +38,8 @@ Symbol table '\.symtab' contains 35 entr
4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
- 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
- 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 7: 00000000000111.. 0 SECTION LOCAL DEFAULT 7
+ 8: 00000000000112.. 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 17:27:02.890275588 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 17:33:56.512440347 +0100
@@ -38,8 +38,8 @@ Symbol table '\.symtab' contains 35 entr
4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
- 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
- 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 7: 00000000000111.. 0 SECTION LOCAL DEFAULT 7
+ 8: 00000000000112.. 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]

View File

@ -0,0 +1,547 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-11-04 14:53:52.144476367 +0000
+++ binutils-2.30/bfd/elfnn-aarch64.c 2020-11-04 14:56:42.275422499 +0000
@@ -2191,6 +2191,9 @@ struct elf_aarch64_obj_tdata
/* Zero to warn when linking objects with incompatible wchar_t sizes. */
int no_wchar_size_warning;
+
+ /* All GNU_PROPERTY_AARCH64_FEATURE_1_AND properties. */
+ uint32_t gnu_and_prop;
};
#define elf_aarch64_tdata(bfd) \
@@ -9311,6 +9314,32 @@ elfNN_aarch64_backend_symbol_processing
sym->flags |= BSF_KEEP;
}
+/* Implement elf_backend_setup_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_link_setup_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bfd *
+elfNN_aarch64_link_setup_gnu_properties (struct bfd_link_info *info)
+{
+ uint32_t prop = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+ bfd *pbfd = _bfd_aarch64_elf_link_setup_gnu_properties (info, &prop);
+ elf_aarch64_tdata (info->output_bfd)->gnu_and_prop = prop;
+ return pbfd;
+}
+
+/* Implement elf_backend_merge_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_merge_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bfd_boolean
+elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
+ bfd *abfd,
+ elf_property *aprop,
+ elf_property *bprop)
+{
+ uint32_t prop
+ = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+ return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
+ bprop, prop);
+}
/* We use this so we can override certain functions
(though currently we don't). */
@@ -9453,6 +9482,12 @@ const struct elf_size_info elfNN_aarch64
#define elf_backend_symbol_processing \
elfNN_aarch64_backend_symbol_processing
+#define elf_backend_setup_gnu_properties \
+ elfNN_aarch64_link_setup_gnu_properties
+
+#define elf_backend_merge_gnu_properties \
+ elfNN_aarch64_merge_gnu_properties
+
#define elf_backend_can_refcount 1
#define elf_backend_can_gc_sections 1
#define elf_backend_plt_readonly 1
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
--- binutils.orig/bfd/elfxx-aarch64.c 2020-11-04 14:53:52.138476401 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.c 2020-11-04 14:56:42.276422492 +0000
@@ -660,3 +660,183 @@ _bfd_aarch64_elf_write_core_note (bfd *a
}
}
}
+
+/* Find the first input bfd with GNU property and merge it with GPROP. If no
+ such input is found, add it to a new section at the last input. Update
+ GPROP accordingly. */
+bfd *
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
+ uint32_t *gprop)
+{
+ asection *sec;
+ bfd *pbfd;
+ bfd *ebfd = NULL;
+ elf_property *prop;
+
+ uint32_t gnu_prop = *gprop;
+
+ /* Find a normal input file with GNU property note. */
+ for (pbfd = info->input_bfds;
+ pbfd != NULL;
+ pbfd = pbfd->link.next)
+ if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour
+ && bfd_count_sections (pbfd) != 0)
+ {
+ ebfd = pbfd;
+
+ if (elf_properties (pbfd) != NULL)
+ break;
+ }
+
+ /* If ebfd != NULL it is either an input with property note or the last
+ input. Either way if we have gnu_prop, we should add it (by creating
+ a section if needed). */
+ if (ebfd != NULL && gnu_prop)
+ {
+ prop = _bfd_elf_get_property (ebfd,
+ GNU_PROPERTY_AARCH64_FEATURE_1_AND,
+ 4);
+ prop->u.number |= gnu_prop;
+ prop->pr_kind = property_number;
+
+ /* pbfd being NULL implies ebfd is the last input. Create the GNU
+ property note section. */
+ if (pbfd == NULL)
+ {
+ sec = bfd_make_section_with_flags (ebfd,
+ NOTE_GNU_PROPERTY_SECTION_NAME,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_IN_MEMORY
+ | SEC_READONLY
+ | SEC_HAS_CONTENTS
+ | SEC_DATA));
+ if (sec == NULL)
+ info->callbacks->einfo (
+ _("%F%P: failed to create GNU property section\n"));
+
+ elf_section_type (sec) = SHT_NOTE;
+ }
+ }
+
+ pbfd = _bfd_elf_link_setup_gnu_properties (info);
+
+ if (bfd_link_relocatable (info))
+ return pbfd;
+
+ /* If pbfd has any GNU_PROPERTY_AARCH64_FEATURE_1_AND properties, update
+ gnu_prop accordingly. */
+ if (pbfd != NULL)
+ {
+ elf_property_list *p;
+
+ /* The property list is sorted in order of type. */
+ for (p = elf_properties (pbfd); p; p = p->next)
+ {
+ /* Check for all GNU_PROPERTY_AARCH64_FEATURE_1_AND. */
+ if (GNU_PROPERTY_AARCH64_FEATURE_1_AND == p->property.pr_type)
+ {
+ gnu_prop = (p->property.u.number
+ & (GNU_PROPERTY_AARCH64_FEATURE_1_PAC
+ | GNU_PROPERTY_AARCH64_FEATURE_1_BTI));
+ break;
+ }
+ else if (GNU_PROPERTY_AARCH64_FEATURE_1_AND < p->property.pr_type)
+ break;
+ }
+ }
+ *gprop = gnu_prop;
+ return pbfd;
+}
+
+/* Define elf_backend_parse_gnu_properties for AArch64. */
+enum elf_property_kind
+_bfd_aarch64_elf_parse_gnu_properties (bfd *abfd, unsigned int type,
+ bfd_byte *ptr, unsigned int datasz)
+{
+ elf_property *prop;
+
+ switch (type)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
+ if (datasz != 4)
+ {
+ _bfd_error_handler
+ ( _("error: %pB: <corrupt AArch64 used size: 0x%x>"),
+ abfd, datasz);
+ return property_corrupt;
+ }
+ prop = _bfd_elf_get_property (abfd, type, datasz);
+ /* Combine properties of the same type. */
+ prop->u.number |= bfd_h_get_32 (abfd, ptr);
+ prop->pr_kind = property_number;
+ break;
+
+ default:
+ return property_ignored;
+ }
+
+ return property_number;
+}
+
+/* Merge AArch64 GNU property BPROP with APROP also accounting for PROP.
+ If APROP isn't NULL, merge it with BPROP and/or PROP. Vice-versa if BROP
+ isn't NULL. Return TRUE if there is any update to APROP or if BPROP should
+ be merge with ABFD. */
+bfd_boolean
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *info
+ ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ elf_property *aprop,
+ elf_property *bprop,
+ uint32_t prop)
+{
+ unsigned int orig_number;
+ bfd_boolean updated = FALSE;
+ unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
+
+ switch (pr_type)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
+ {
+ if (aprop != NULL && bprop != NULL)
+ {
+ orig_number = aprop->u.number;
+ aprop->u.number = (orig_number & bprop->u.number) | prop;
+ updated = orig_number != aprop->u.number;
+ /* Remove the property if all feature bits are cleared. */
+ if (aprop->u.number == 0)
+ aprop->pr_kind = property_remove;
+ break;
+ }
+ /* If either is NULL, the AND would be 0 so, if there is
+ any PROP, asign it to the input that is not NULL. */
+ if (prop)
+ {
+ if (aprop != NULL)
+ {
+ orig_number = aprop->u.number;
+ aprop->u.number = prop;
+ updated = orig_number != aprop->u.number;
+ }
+ else
+ {
+ bprop->u.number = prop;
+ updated = TRUE;
+ }
+ }
+ /* No PROP and BPROP is NULL, so remove APROP. */
+ else if (aprop != NULL)
+ {
+ aprop->pr_kind = property_remove;
+ updated = TRUE;
+ }
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ return updated;
+}
diff -rup binutils.orig/bfd/elfxx-aarch64.h binutils-2.30/bfd/elfxx-aarch64.h
--- binutils.orig/bfd/elfxx-aarch64.h 2020-11-04 14:53:52.134476424 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.h 2020-11-04 14:56:42.276422492 +0000
@@ -65,3 +65,19 @@ _bfd_aarch64_elf_write_core_note (bfd *,
#define elf_backend_grok_prstatus _bfd_aarch64_elf_grok_prstatus
#define elf_backend_grok_psinfo _bfd_aarch64_elf_grok_psinfo
#define elf_backend_write_core_note _bfd_aarch64_elf_write_core_note
+
+extern bfd *
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *,
+ uint32_t *);
+
+extern enum elf_property_kind
+_bfd_aarch64_elf_parse_gnu_properties (bfd *, unsigned int,
+ bfd_byte *, unsigned int);
+
+extern bfd_boolean
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *, bfd *,
+ elf_property *, elf_property *,
+ uint32_t);
+
+#define elf_backend_parse_gnu_properties \
+ _bfd_aarch64_elf_parse_gnu_properties
diff -rup binutils.orig/binutils/readelf.c binutils-2.30/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2020-11-04 14:53:51.723478764 +0000
+++ binutils-2.30/binutils/readelf.c 2020-11-04 14:56:42.277422485 +0000
@@ -17103,6 +17103,33 @@ decode_x86_feature_2 (unsigned int bitma
}
static void
+decode_aarch64_feature_1_and (unsigned int bitmask)
+{
+ while (bitmask)
+ {
+ unsigned int bit = bitmask & (- bitmask);
+
+ bitmask &= ~ bit;
+ switch (bit)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_BTI:
+ printf ("BTI");
+ break;
+
+ case GNU_PROPERTY_AARCH64_FEATURE_1_PAC:
+ printf ("PAC");
+ break;
+
+ default:
+ printf (_("<unknown: %x>"), bit);
+ break;
+ }
+ if (bitmask)
+ printf (", ");
+ }
+}
+
+static void
print_gnu_property_note (Filedata * filedata, Elf_Internal_Note * pnote)
{
unsigned char * ptr = (unsigned char *) pnote->descdata;
@@ -17236,6 +17263,18 @@ print_gnu_property_note (Filedata * file
break;
}
}
+ else if (filedata->file_header.e_machine == EM_AARCH64)
+ {
+ if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)
+ {
+ printf ("AArch64 feature: ");
+ if (datasz != 4)
+ printf (_("<corrupt length: %#x> "), datasz);
+ else
+ decode_aarch64_feature_1_and (byte_get (ptr, 4));
+ goto next;
+ }
+ }
}
else
{
diff -rup binutils.orig/include/elf/common.h binutils-2.30/include/elf/common.h
--- binutils.orig/include/elf/common.h 2020-11-04 14:53:52.155476304 +0000
+++ binutils-2.30/include/elf/common.h 2020-11-04 14:56:42.277422485 +0000
@@ -832,6 +832,12 @@
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT (1U << 8)
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEC (1U << 9)
+/* AArch64 specific GNU PROPERTY. */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
+
+#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
+#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1)
+
/* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG). */
#define GNU_ABI_TAG_LINUX 0
#define GNU_ABI_TAG_HURD 1
diff -rup binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp
--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp 2020-11-04 14:53:51.843478081 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp 2020-11-04 14:56:42.278422479 +0000
@@ -337,6 +337,10 @@ run_dump_test_lp64 "variant_pcs-r"
run_dump_test_lp64 "variant_pcs-shared"
run_dump_test_lp64 "variant_pcs-now"
+run_dump_test "property-bti-pac1"
+run_dump_test "property-bti-pac2"
+run_dump_test "property-bti-pac3"
+
set aarch64elflinktests {
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
{} "copy-reloc-so.so"}
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,11 @@
+#name: GNU Property (single input, combine section)
+#source: property-bti-pac1.s
+#as: -march=armv8.5-a -defsym __mult__=0
+#ld: -shared
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI, PAC
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.s 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,37 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ mov x1, #2
+.ifndef __mult__
+ bl foo
+.endif
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2 /* PAC. */
+4:
+ .p2align 3
+5:
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1 /* BTI. */
+4:
+ .p2align 3
+5:
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.s 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,50 @@
+ .text
+ .global foo
+ .type foo, %function
+foo:
+ sub sp, sp, #16
+ mov w0, 9
+ str w0, [sp, 12]
+ ldr w0, [sp, 12]
+ add w0, w0, 4
+ str w0, [sp, 12]
+ nop
+ add sp, sp, 16
+ ret
+ .size foo, .-foo
+ .global bar
+ .type bar, %function
+.ifdef __property_bti__
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1 /* BTI. */
+4:
+ .p2align 3
+5:
+.endif
+.ifdef __property_pac__
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2 /* PAC. */
+4:
+ .p2align 3
+5:
+.endif
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,12 @@
+#name: GNU Property (combine multiple with BTI)
+#source: property-bti-pac1.s
+#source: property-bti-pac2.s
+#as: -mabi=lp64 -defsym __property_bti__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac3.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,12 @@
+#name: GNU Property (combine multiple with PAC)
+#source: property-bti-pac1.s
+#source: property-bti-pac2.s
+#as: -mabi=lp64 -defsym __property_pac__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: PAC
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-11-25 11:53:26.648275978 +0000
+++ binutils-2.30/bfd/elfnn-aarch64.c 2020-11-25 12:21:39.276864970 +0000
@@ -9331,12 +9331,14 @@ elfNN_aarch64_link_setup_gnu_properties
for the effect of GNU properties of the output_bfd. */
static bfd_boolean
elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
- bfd *abfd,
- elf_property *aprop,
- elf_property *bprop)
+ bfd *abfd,
+ bfd *bbfd ATTRIBUTE_UNUSED,
+ elf_property *aprop,
+ elf_property *bprop)
{
uint32_t prop
= elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+
return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
bprop, prop);
}
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
--- binutils.orig/bfd/elfxx-aarch64.c 2020-11-25 11:53:26.655275930 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.c 2020-11-25 12:21:34.689895875 +0000
@@ -22,6 +22,7 @@
#include "elfxx-aarch64.h"
#include <stdarg.h>
#include <string.h>
+#include "libbfd.h"
#define MASK(n) ((1u << (n)) - 1)
@@ -835,7 +836,10 @@ _bfd_aarch64_elf_merge_gnu_properties (s
break;
default:
- abort ();
+ _bfd_error_handler
+ ( _("error: %pB: <corrupt AArch64 property note: 0x%x>"),
+ abfd, pr_type);
+ return FALSE;
}
return updated;
diff -rup binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d
--- binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-25 11:53:26.344278044 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-25 11:57:53.179471900 +0000
@@ -1,6 +1,6 @@
#name: GNU Property (single input, combine section)
#source: property-bti-pac1.s
-#as: -march=armv8.5-a -defsym __mult__=0
+#as: -defsym __mult__=0
#ld: -shared
#readelf: -n
#target: *linux*

View File

@ -0,0 +1,68 @@
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
--- binutils.orig/gas/config/obj-elf.c 2018-09-24 17:50:06.974172867 +0100
+++ binutils-2.30/gas/config/obj-elf.c 2018-09-25 15:19:33.559830794 +0100
@@ -82,9 +82,11 @@ static void obj_elf_gnu_attribute (int);
static void obj_elf_tls_common (int);
static void obj_elf_lcomm (int);
static void obj_elf_struct (int);
+static void obj_elf_attach_to_group (int);
static const pseudo_typeS elf_pseudo_table[] =
{
+ {"attach_to_group", obj_elf_attach_to_group, 0},
{"comm", obj_elf_common, 0},
{"common", obj_elf_common, 1},
{"ident", obj_elf_ident, 0},
@@ -1007,6 +1009,27 @@ obj_elf_section_name (void)
return name;
}
+static void
+obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
+{
+ const char * gname = obj_elf_section_name ();
+
+ if (gname == NULL)
+ {
+ as_warn ("group name not parseable");
+ return;
+ }
+
+ if (elf_group_name (now_seg))
+ {
+ as_warn ("already has a group");
+ return;
+ }
+
+ elf_group_name (now_seg) = xstrdup (gname);
+ elf_section_flags (now_seg) |= SHF_GROUP;
+}
+
void
obj_elf_section (int push)
{
diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo
--- binutils.orig/gas/doc/as.texinfo 2018-09-24 17:50:06.984172788 +0100
+++ binutils-2.30/gas/doc/as.texinfo 2018-09-25 15:19:43.557748972 +0100
@@ -4407,6 +4407,7 @@ Some machine configurations provide addi
* Altmacro:: @code{.altmacro}
* Ascii:: @code{.ascii "@var{string}"}@dots{}
* Asciz:: @code{.asciz "@var{string}"}@dots{}
+* Attach_to_group:: @code{.attach_to_group @var{name}}
* Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}}
* Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc
* Byte:: @code{.byte @var{expressions}}
@@ -4703,6 +4704,12 @@ trailing zero byte) into consecutive add
@code{.asciz} is just like @code{.ascii}, but each string is followed by
a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''.
+@node Attach_to_group
+@section @code{.attach_to_group @var{name}}
+Attaches the current section to the named group. This is like declaring
+the section with the @code{G} attribute, but can be done after the section
+has been created.
+
@node Balign
@section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}}
Only in binutils-2.30/gas/doc: as.texinfo.orig

View File

@ -0,0 +1,29 @@
--- binutils.orig/bfd/elflink.c 2020-12-08 17:45:26.487260908 +0000
+++ binutils-2.30/bfd/elflink.c 2020-12-08 17:48:06.650728413 +0000
@@ -1895,7 +1895,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
if (skip)
goto nondefault;
- if (hi->def_regular)
+ if (hi->def_regular || ELF_COMMON_DEF_P (hi))
{
/* If the undecorated symbol will have a version added by a
script different to H, then don't indirect to/from the
@@ -2236,7 +2236,7 @@ _bfd_elf_link_assign_sym_version (struct
/* We only need version numbers for symbols defined in regular
objects. */
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
return TRUE;
bed = get_elf_backend_data (info->output_bfd);
@@ -9957,7 +9957,7 @@ elf_link_output_extsym (struct bfd_hash_
Elf_Internal_Versym iversym;
Elf_External_Versym *eversym;
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
{
if (h->verinfo.verdef == NULL
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)

View File

@ -0,0 +1,591 @@
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2020-02-12 13:31:20.348605538 +0000
+++ binutils-2.30/bfd/elf-bfd.h 2020-02-12 13:31:33.831507582 +0000
@@ -1479,6 +1479,19 @@ struct elf_backend_data
/* Opcode representing no unwind. */
int (*cant_unwind_opcode) (struct bfd_link_info *);
+ /* Called when a section has extra reloc sections. */
+ bfd_boolean (*init_secondary_reloc_section) (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
+
+ /* Called when after loading the normal relocs for a section. */
+ bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **);
+
+ /* Called after writing the normal relocs for a section. */
+ bfd_boolean (*write_secondary_relocs) (bfd *, asection *);
+
+ /* Called to return the value to set in the ST_SHNDX field of an ELF symbol
+ from an iternal symbol which does not map to any known section. */
+ unsigned int (*symbol_section_index) (bfd *, elf_symbol_type *);
+
/* This is non-zero if static TLS segments require a special alignment. */
unsigned static_tls_alignment;
@@ -2696,6 +2709,19 @@ extern bfd_vma elf64_r_sym (bfd_vma);
extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
extern bfd_vma elf32_r_sym (bfd_vma);
+
+extern bfd_boolean _bfd_elf_init_secondary_reloc_section
+ (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
+extern bfd_boolean _bfd_elf_slurp_secondary_reloc_section
+ (bfd *, asection *, asymbol **);
+extern bfd_boolean _bfd_elf_copy_special_section_fields
+ (const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *);
+extern bfd_boolean _bfd_elf_write_secondary_reloc_section
+ (bfd *, asection *);
+extern unsigned int _bfd_elf_symbol_section_index
+ (bfd *, elf_symbol_type *);
+
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2020-02-12 13:31:20.347605546 +0000
+++ binutils-2.30/bfd/elf.c 2020-02-12 13:33:19.635738944 +0000
@@ -1572,7 +1572,7 @@ _bfd_elf_copy_private_bfd_data (bfd *ibf
/* Final attempt. Call the backend copy function
with a NULL input section. */
if (bed->elf_backend_copy_special_section_fields != NULL)
- bed->elf_backend_copy_special_section_fields (ibfd, obfd, NULL, oheader);
+ (void) bed->elf_backend_copy_special_section_fields (ibfd, obfd, NULL, oheader);
}
}
@@ -2416,11 +2416,14 @@ bfd_section_from_shdr (bfd *abfd, unsign
sections. */
if (*p_hdr != NULL)
{
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%B: warning: multiple relocation sections for section %A \
-found - ignoring all but the first"),
- abfd, target_sect);
+ if (bed->init_secondary_reloc_section == NULL
+ || ! bed->init_secondary_reloc_section (abfd, hdr, name, shindex))
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: warning: secondary relocation section '%s' for section %pA found - ignoring"),
+ abfd, name, target_sect);
+ }
goto success;
}
hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2));
@@ -7948,9 +7951,20 @@ error_return:
if (elf_symtab_shndx_list (abfd))
shndx = elf_symtab_shndx_list (abfd)->ndx;
break;
- default:
+ case SHN_COMMON:
+ case SHN_ABS:
shndx = SHN_ABS;
break;
+ default:
+ if (bed->symbol_section_index)
+ shndx = bed->symbol_section_index (abfd, type_ptr);
+ else
+ {
+ _bfd_error_handler (_("%pB: Unable to handle section index %x in ELF symbol. Using ABS instead. (%x)"),
+ abfd, shndx, SHN_COMMON);
+ shndx = SHN_ABS;
+ }
+ break;
}
}
else
@@ -11556,3 +11570,354 @@ _bfd_elf_maybe_function_sym (const asymb
size = 1;
return size;
}
+
+/* Set to non-zero to enable some debug messages. */
+#define DEBUG_SECONDARY_RELOCS 0
+
+/* An internal-to-the-bfd-library only section type
+ used to indicate a cached secondary reloc section. */
+#define SHT_SECONDARY_RELOC (SHT_LOOS + SHT_RELA)
+
+/* Create a BFD section to hold a secondary reloc section. */
+
+bfd_boolean
+_bfd_elf_init_secondary_reloc_section (bfd * abfd,
+ Elf_Internal_Shdr *hdr,
+ const char * name,
+ unsigned int shindex)
+{
+ /* We only support RELA secondary relocs. */
+ if (hdr->sh_type != SHT_RELA)
+ return FALSE;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "secondary reloc section %s encountered\n", name);
+#endif
+ hdr->sh_type = SHT_SECONDARY_RELOC;
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+}
+
+/* Read in any secondary relocs associated with SEC. */
+
+bfd_boolean
+_bfd_elf_slurp_secondary_reloc_section (bfd * abfd,
+ asection * sec,
+ asymbol ** symbols)
+{
+ const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
+ asection * relsec;
+ bfd_boolean result = TRUE;
+ bfd_vma (*r_sym) (bfd_vma);
+
+
+#ifdef BFD64
+ if (bfd_arch_bits_per_address (abfd) != 32)
+ r_sym = elf64_r_sym;
+ else
+#endif
+ r_sym = elf32_r_sym;
+
+ /* Discover if there are any secondary reloc sections
+ associated with SEC. */
+ for (relsec = abfd->sections; relsec != NULL; relsec = relsec->next)
+ {
+ Elf_Internal_Shdr * hdr = & elf_section_data (relsec)->this_hdr;
+
+ if (hdr->sh_type == SHT_SECONDARY_RELOC
+ && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx)
+ {
+ bfd_byte * native_relocs;
+ bfd_byte * native_reloc;
+ arelent * internal_relocs;
+ arelent * internal_reloc;
+ unsigned int i;
+ unsigned int entsize;
+ unsigned int symcount;
+ unsigned int reloc_count;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "read secondary relocs for %s from %s\n", sec->name, relsec->name);
+#endif
+ entsize = hdr->sh_entsize;
+
+ native_relocs = bfd_malloc (hdr->sh_size);
+ if (native_relocs == NULL)
+ {
+ result = FALSE;
+ continue;
+ }
+
+ reloc_count = NUM_SHDR_ENTRIES (hdr);
+ internal_relocs = (arelent *) bfd_alloc2 (abfd, reloc_count, sizeof (arelent));
+ if (internal_relocs == NULL)
+ {
+ free (native_relocs);
+ result = FALSE;
+ continue;
+ }
+
+ if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bread (native_relocs, hdr->sh_size, abfd) != hdr->sh_size))
+ {
+ free (native_relocs);
+ free (internal_relocs);
+ result = FALSE;
+ continue;
+ }
+
+ symcount = bfd_get_symcount (abfd);
+
+ for (i = 0, internal_reloc = internal_relocs, native_reloc = native_relocs;
+ i < reloc_count;
+ i++, internal_reloc++, native_reloc += entsize)
+ {
+ ;
+ Elf_Internal_Rela rela;
+
+ ebd->s->swap_reloca_in (abfd, native_reloc, & rela);
+
+ /* The address of an ELF reloc is section relative for an object
+ file, and absolute for an executable file or shared library.
+ The address of a normal BFD reloc is always section relative,
+ and the address of a dynamic reloc is absolute.. */
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+ internal_reloc->address = rela.r_offset;
+ else
+ internal_reloc->address = rela.r_offset - sec->vma;
+
+ if (r_sym (rela.r_info) == STN_UNDEF)
+ {
+ /* FIXME: This and the error case below mean that we
+ have a symbol on relocs that is not elf_symbol_type. */
+ internal_reloc->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+ }
+ else if (r_sym (rela.r_info) > symcount)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%pA): relocation %d has invalid symbol index %ld"),
+ abfd, sec, i, (long) r_sym (rela.r_info));
+ bfd_set_error (bfd_error_bad_value);
+ internal_reloc->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+ result = FALSE;
+ }
+ else
+ {
+ asymbol **ps;
+
+ ps = symbols + r_sym (rela.r_info) - 1;
+
+ internal_reloc->sym_ptr_ptr = ps;
+ /* Make sure that this symbol is not removed by strip. */
+ (*ps)->flags |= BSF_KEEP;
+ }
+
+ internal_reloc->addend = rela.r_addend;
+
+ ebd->elf_info_to_howto (abfd, internal_reloc, & rela);
+ if (internal_reloc->howto == NULL)
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "there is no howto associated with reloc %lx\n", rela.r_info);
+#endif
+ result = FALSE;
+ }
+ }
+
+ free (native_relocs);
+ /* Store the internal relocs. */
+ elf_section_data (relsec)->sec_info = internal_relocs;
+ }
+ }
+
+ return result;
+}
+
+/* Set the ELF section header fields of an output secondary reloc section. */
+
+bfd_boolean
+_bfd_elf_copy_special_section_fields (const bfd * ibfd ATTRIBUTE_UNUSED,
+ bfd * obfd ATTRIBUTE_UNUSED,
+ const Elf_Internal_Shdr * isection,
+ Elf_Internal_Shdr * osection)
+{
+ if (isection == NULL)
+ return FALSE;
+
+ if (isection->sh_type != SHT_SECONDARY_RELOC)
+ return TRUE;
+
+ asection * isec = isection->bfd_section;
+ if (isec == NULL)
+ return FALSE;
+
+ asection * osec = osection->bfd_section;
+ if (osec == NULL)
+ return FALSE;
+
+ BFD_ASSERT (elf_section_data (osec)->sec_info == NULL);
+ elf_section_data (osec)->sec_info = elf_section_data (isec)->sec_info;
+ osection->sh_type = SHT_RELA;
+ osection->sh_link = elf_onesymtab (obfd);
+ if (osection->sh_link == 0)
+ {
+ /* There is no symbol table - we are hosed... */
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%pA): link section cannot be set because the output file does not have a symbol table"),
+ obfd, osec);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ /* Find the output section that corresponds to the isection's sh_info link. */
+ BFD_ASSERT (isection->sh_info > 0 && isection->sh_info < elf_numsections (ibfd));
+ isection = elf_elfsections (ibfd)[isection->sh_info];
+
+ BFD_ASSERT (isection != NULL);
+ BFD_ASSERT (isection->bfd_section != NULL);
+ BFD_ASSERT (isection->bfd_section->output_section != NULL);
+ osection->sh_info = elf_section_data (isection->bfd_section->output_section)->this_idx;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "update header of %s, sh_link = %u, sh_info = %u\n",
+ osec->name, osection->sh_link, osection->sh_info);
+#endif
+
+ return TRUE;
+}
+
+/* Write out a secondary reloc section. */
+
+bfd_boolean
+_bfd_elf_write_secondary_reloc_section (bfd *abfd, asection *sec)
+{
+ const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
+ bfd_vma addr_offset;
+ asection * relsec;
+ bfd_vma (*r_info) (bfd_vma, bfd_vma);
+
+#ifdef BFD64
+ if (bfd_arch_bits_per_address (abfd) != 32)
+ r_info = elf64_r_info;
+ else
+#endif
+ r_info = elf32_r_info;
+
+ if (sec == NULL)
+ return FALSE;
+
+ /* The address of an ELF reloc is section relative for an object
+ file, and absolute for an executable file or shared library.
+ The address of a BFD reloc is always section relative. */
+ addr_offset = 0;
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
+ addr_offset = sec->vma;
+
+ /* Discover if there are any secondary reloc sections
+ associated with SEC. */
+ for (relsec = abfd->sections; relsec != NULL; relsec = relsec->next)
+ {
+ const struct bfd_elf_section_data * const esd = elf_section_data (relsec);
+ Elf_Internal_Shdr * const hdr = (Elf_Internal_Shdr *) & esd->this_hdr;
+
+ if (hdr->sh_type == SHT_RELA
+ && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx)
+ {
+ asymbol * last_sym;
+ int last_sym_idx;
+ unsigned int reloc_count;
+ unsigned int idx;
+ arelent * src_irel;
+ bfd_byte * dst_rela;
+
+ BFD_ASSERT (hdr->contents == NULL);
+
+ reloc_count = hdr->sh_size / hdr->sh_entsize;
+ BFD_ASSERT (reloc_count > 0);
+
+ hdr->contents = bfd_alloc (abfd, hdr->sh_size);
+ if (hdr->contents == NULL)
+ continue;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "write %u secondary relocs for %s from %s\n", reloc_count, sec->name, relsec->name);
+#endif
+ last_sym = NULL;
+ last_sym_idx = 0;
+ dst_rela = hdr->contents;
+ src_irel = (arelent *) esd->sec_info;
+ BFD_ASSERT (src_irel != NULL);
+
+ for (idx = 0; idx < reloc_count; idx++, dst_rela += hdr->sh_entsize)
+ {
+ Elf_Internal_Rela src_rela;
+ arelent *ptr;
+ asymbol *sym;
+ int n;
+
+ ptr = src_irel + idx;
+ sym = *ptr->sym_ptr_ptr;
+
+ if (sym == last_sym)
+ n = last_sym_idx;
+ else
+ {
+ last_sym = sym;
+ n = _bfd_elf_symbol_from_bfd_symbol (abfd, & sym);
+ if (n < 0)
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "failed to find symbol %s whilst rewriting relocs\n",
+ sym->name);
+#endif
+ /* FIXME: Signal failure somehow. */
+ n = 0;
+ }
+ last_sym_idx = n;
+ }
+
+ if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
+ && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
+ && ! _bfd_elf_validate_reloc (abfd, ptr))
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "symbol %s is not in the output bfd\n",
+ sym->name);
+#endif
+ /* FIXME: Signal failure somehow. */
+ n = 0;
+ }
+
+ if (ptr->howto == NULL)
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "reloc for symbol %s does not have a howto associated with it\n",
+ sym->name);
+#endif
+ /* FIXME: Signal failure somehow. */
+ n = 0;
+ }
+
+ src_rela.r_offset = ptr->address + addr_offset;
+ src_rela.r_info = r_info (n, ptr->howto->type);
+ src_rela.r_addend = ptr->addend;
+ ebd->s->swap_reloca_out (abfd, &src_rela, dst_rela);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Preserve any OS or PROCESSOR specific section indicies. */
+
+unsigned int
+_bfd_elf_symbol_section_index (bfd * abfd ATTRIBUTE_UNUSED,
+ elf_symbol_type * sym)
+{
+ unsigned int shndx = sym->internal_elf_sym.st_shndx;
+
+ /* Preserve special section indicies. */
+ return shndx >= SHN_LORESERVE ? shndx : SHN_ABS;
+}
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2020-02-12 13:31:20.334605640 +0000
+++ binutils-2.30/bfd/elfcode.h 2020-02-12 13:31:33.833507567 +0000
@@ -855,6 +855,7 @@ elf_object_p (bfd *abfd)
void
elf_write_relocs (bfd *abfd, asection *sec, void *data)
{
+ const struct elf_backend_data * const bed = get_elf_backend_data (abfd);
bfd_boolean *failedp = (bfd_boolean *) data;
Elf_Internal_Shdr *rela_hdr;
bfd_vma addr_offset;
@@ -969,6 +970,13 @@ elf_write_relocs (bfd *abfd, asection *s
src_rela.r_addend = ptr->addend;
(*swap_out) (abfd, &src_rela, dst_rela);
}
+
+ if (bed->write_secondary_relocs != NULL)
+ if (! bed->write_secondary_relocs (abfd, sec))
+ {
+ *failedp = TRUE;
+ return;
+ }
}
/* Write out the program headers. */
@@ -1271,7 +1279,10 @@ elf_slurp_symbol_table (bfd *abfd, asymb
{
/* This symbol is in a section for which we did not
create a BFD section. Just use bfd_abs_section,
- although it is wrong. FIXME. */
+ although it is wrong. FIXME. Note - there is
+ code in elf.c:swap_out_syms that calls
+ symbol_section_index() in the elf backend for
+ cases like this. */
sym->symbol.section = bfd_abs_section_ptr;
}
}
@@ -1501,6 +1512,7 @@ elf_slurp_reloc_table (bfd *abfd,
asymbol **symbols,
bfd_boolean dynamic)
{
+ const struct elf_backend_data * const bed = get_elf_backend_data (abfd);
struct bfd_elf_section_data * const d = elf_section_data (asect);
Elf_Internal_Shdr *rel_hdr;
Elf_Internal_Shdr *rel_hdr2;
@@ -1564,6 +1576,10 @@ elf_slurp_reloc_table (bfd *abfd,
symbols, dynamic))
return FALSE;
+ if (bed->slurp_secondary_relocs != NULL
+ && ! bed->slurp_secondary_relocs (abfd, asect, symbols))
+ return FALSE;
+
asect->relocation = relents;
return TRUE;
}
diff -rup binutils.orig/bfd/elflink.c binutils-2.30/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2020-02-12 13:31:20.338605611 +0000
+++ binutils-2.30/bfd/elflink.c 2020-02-12 13:31:33.834507560 +0000
@@ -11514,6 +11514,10 @@ elf_final_link_free (bfd *obfd, struct e
}
}
+#define is_reloc_section(ESDO) \
+ ( (ESDO)->this_hdr.sh_type == SHT_REL \
+ || (ESDO)->this_hdr.sh_type == SHT_RELA)
+
/* Do the final step of an ELF link. */
bfd_boolean
@@ -11685,8 +11689,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
&& elf_symtab_shndx_list (sec->owner) != NULL)
max_sym_shndx_count = sym_count;
- if (esdo->this_hdr.sh_type == SHT_REL
- || esdo->this_hdr.sh_type == SHT_RELA)
+ if (is_reloc_section (esdo))
/* Some backends use reloc_count in relocation sections
to count particular types of relocs. Of course,
reloc sections themselves can't have relocations. */
@@ -12290,6 +12293,9 @@ bfd_elf_final_link (bfd *abfd, struct bf
struct bfd_elf_section_data *esdo = elf_section_data (o);
bfd_boolean sort;
+ if (esdo == NULL)
+ continue;
+
if ((o->flags & SEC_RELOC) == 0)
continue;
diff -rup binutils.orig/bfd/elfxx-target.h binutils-2.30/bfd/elfxx-target.h
--- binutils.orig/bfd/elfxx-target.h 2020-02-12 13:31:20.338605611 +0000
+++ binutils-2.30/bfd/elfxx-target.h 2020-02-12 13:31:33.834507560 +0000
@@ -737,7 +737,7 @@
#endif
#ifndef elf_backend_copy_special_section_fields
-#define elf_backend_copy_special_section_fields NULL
+#define elf_backend_copy_special_section_fields _bfd_elf_copy_special_section_fields
#endif
#ifndef elf_backend_compact_eh_encoding
@@ -745,7 +745,23 @@
#endif
#ifndef elf_backend_cant_unwind_opcode
-#define elf_backend_cant_unwind_opcode 0
+#define elf_backend_cant_unwind_opcode NULL
+#endif
+
+#ifndef elf_backend_init_secondary_reloc_section
+#define elf_backend_init_secondary_reloc_section _bfd_elf_init_secondary_reloc_section
+#endif
+
+#ifndef elf_backend_slurp_secondary_reloc_section
+#define elf_backend_slurp_secondary_reloc_section _bfd_elf_slurp_secondary_reloc_section
+#endif
+
+#ifndef elf_backend_write_secondary_reloc_section
+#define elf_backend_write_secondary_reloc_section _bfd_elf_write_secondary_reloc_section
+#endif
+
+#ifndef elf_backend_symbol_section_index
+#define elf_backend_symbol_section_index _bfd_elf_symbol_section_index
#endif
#ifndef elf_match_priority
@@ -870,6 +886,10 @@ static struct elf_backend_data elfNN_bed
elf_backend_setup_gnu_properties,
elf_backend_compact_eh_encoding,
elf_backend_cant_unwind_opcode,
+ elf_backend_init_secondary_reloc_section,
+ elf_backend_slurp_secondary_reloc_section,
+ elf_backend_write_secondary_reloc_section,
+ elf_backend_symbol_section_index,
elf_backend_static_tls_alignment,
elf_backend_stack_align,
elf_backend_strtab_flags,
Only in binutils-2.30/bfd: elfxx-target.h.orig

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
--- binutils.orig/bfd/elflink.c 2018-03-14 10:14:49.729271271 +0000
+++ binutils-2.30/bfd/elflink.c 2018-03-14 10:15:15.748967793 +0000
@@ -12785,7 +12785,7 @@ _bfd_elf_gc_mark_hook (asection *sec,
return NULL;
}
-/* Return the global debug definition section. */
+/* Return the debug definition section. */
static asection *
elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED,
@@ -12794,11 +12794,22 @@ elf_gc_mark_debug_section (asection *sec
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym ATTRIBUTE_UNUSED)
{
- if (h != NULL
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0)
- return h->root.u.def.section;
+ if (h != NULL)
+ {
+ /* Return the global debug definition section. */
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0)
+ return h->root.u.def.section;
+ }
+ else
+ {
+ /* Return the local debug definition section. */
+ asection *isec = bfd_section_from_elf_index (sec->owner,
+ sym->st_shndx);
+ if ((isec->flags & SEC_DEBUGGING) != 0)
+ return isec;
+ }
return NULL;
}

View File

@ -0,0 +1,16 @@
--- binutils.orig/binutils/readelf.c 2018-09-05 14:08:22.733186922 +0100
+++ binutils-2.30/binutils/readelf.c 2018-09-05 15:35:38.009749485 +0100
@@ -17634,11 +17634,12 @@ print_gnu_build_attribute_description (E
if (is_open_attr)
{
+#if 0
/* FIXME: Need to properly allow for section alignment. 16 is just the alignment used on x86_64. */
if (global_end > 0 && start > BFD_ALIGN (global_end, 16))
warn (_("Gap in build notes detected from %#lx to %#lx\n"),
global_end + 1, start - 1);
-
+#endif
printf (_(" Applies to region from %#lx"), start);
global_offset = start;

View File

@ -0,0 +1,83 @@
diff -rup binutils.orig/configure binutils-2.30/configure
--- binutils.orig/configure 2018-09-24 17:50:06.967172922 +0100
+++ binutils-2.30/configure 2018-09-24 17:51:16.648624865 +0100
@@ -4996,49 +4996,6 @@ if test -z "$LD"; then
fi
fi
-# Check whether -static-libstdc++ -static-libgcc is supported.
-have_static_libs=no
-if test "$GCC" = yes; then
- saved_LDFLAGS="$LDFLAGS"
-
- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -static-libstdc++ -static-libgcc" >&5
-$as_echo_n "checking whether g++ accepts -static-libstdc++ -static-libgcc... " >&6; }
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
-#error -static-libstdc++ not implemented
-#endif
-int main() {}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }; have_static_libs=yes
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
- LDFLAGS="$saved_LDFLAGS"
-fi
-
-
if test -n "$ac_tool_prefix"; then
diff -rup binutils.orig/configure.ac binutils-2.30/configure.ac
--- binutils.orig/configure.ac 2018-09-24 17:50:07.241170767 +0100
+++ binutils-2.30/configure.ac 2018-09-24 17:50:29.908992486 +0100
@@ -1288,26 +1288,6 @@ if test -z "$LD"; then
fi
fi
-# Check whether -static-libstdc++ -static-libgcc is supported.
-have_static_libs=no
-if test "$GCC" = yes; then
- saved_LDFLAGS="$LDFLAGS"
-
- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
- AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
- AC_LANG_PUSH(C++)
- AC_LINK_IFELSE([
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
-#error -static-libstdc++ not implemented
-#endif
-int main() {}],
- [AC_MSG_RESULT([yes]); have_static_libs=yes],
- [AC_MSG_RESULT([no])])
- AC_LANG_POP(C++)
-
- LDFLAGS="$saved_LDFLAGS"
-fi
-
ACX_PROG_GNAT
ACX_PROG_CMP_IGNORE_INITIAL

View File

@ -0,0 +1,18 @@
--- binutils.orig/ld/emultempl/elf32.em 2019-07-22 13:25:51.601030174 +0100
+++ binutils-2.32/ld/emultempl/elf32.em 2019-07-22 13:27:36.070394830 +0100
@@ -2029,10 +2029,12 @@ elf_orphan_compatible (asection *in, ase
if (elf_section_data (out)->this_hdr.sh_info
!= elf_section_data (in)->this_hdr.sh_info)
return FALSE;
- /* We can't merge two sections with differing SHF_EXCLUDE when doing
- a relocatable link. */
+ /* We can't merge with member of output section group nor merge two
+ sections with differing SHF_EXCLUDE when doing a relocatable link. */
if (bfd_link_relocatable (&link_info)
- && ((elf_section_flags (out) ^ elf_section_flags (in)) & SHF_EXCLUDE) != 0)
+ && (elf_next_in_group (out) != NULL
+ || ((elf_section_flags (out) ^ elf_section_flags (in))
+ & SHF_EXCLUDE) != 0))
return FALSE;
return _bfd_elf_match_sections_by_type (link_info.output_bfd, out,
in->owner, in);

View File

@ -0,0 +1,68 @@
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2020-04-06 13:08:43.081659992 +0100
+++ binutils-2.30/bfd/elf-bfd.h 2020-04-06 13:09:17.040517295 +0100
@@ -2722,6 +2722,8 @@ extern unsigned int _bfd_elf_symbol_sect
(bfd *, elf_symbol_type *);
+extern bfd_boolean is_debuginfo_file (bfd *);
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
Only in binutils-2.30/bfd: elf-bfd.h.orig
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2020-04-06 13:08:43.104659896 +0100
+++ binutils-2.30/bfd/elf.c 2020-04-06 13:09:17.042517287 +0100
@@ -5749,6 +5749,35 @@ assign_file_positions_for_load_sections
#define IS_TBSS(s) \
((s->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) == SEC_THREAD_LOCAL)
+/* Determine if a bfd is a debuginfo file. Unfortunately there
+ is no defined method for detecting such files, so we have to
+ use heuristics instead. */
+
+bfd_boolean
+is_debuginfo_file (bfd *abfd)
+{
+ if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return FALSE;
+
+ Elf_Internal_Shdr **start_headers = elf_elfsections (abfd);
+ Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd);
+ Elf_Internal_Shdr **headerp;
+
+ for (headerp = start_headers; headerp < end_headers; headerp ++)
+ {
+ Elf_Internal_Shdr *header = * headerp;
+
+ /* Debuginfo files do not have any allocated SHT_PROGBITS sections.
+ The only allocated sections are SHT_NOBITS or SHT_NOTES. */
+ if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC
+ && header->sh_type != SHT_NOBITS
+ && header->sh_type != SHT_NOTE)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* Assign file positions for the other sections. */
static bfd_boolean
@@ -5782,7 +5811,13 @@ assign_file_positions_for_non_load_secti
BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
- if (hdr->sh_size != 0)
+ if (hdr->sh_size != 0
+ /* PR 24717 - debuginfo files are known to be not strictly
+ compliant with the ELF standard. In particular they often
+ have .note.gnu.property sections that are outside of any
+ loadable segment. This is not a problem for such files,
+ so do not warn about them. */
+ && ! is_debuginfo_file (abfd))
_bfd_error_handler
/* xgettext:c-format */
(_("%B: warning: allocated section `%s' not in segment"),
Only in binutils-2.30/bfd: elf.c.orig

View File

@ -0,0 +1,768 @@
diff -rup binutils.orig/gold/testsuite/Makefile.am binutils-2.30/gold/testsuite/Makefile.am
--- binutils.orig/gold/testsuite/Makefile.am 2018-05-31 16:14:12.736538727 +0100
+++ binutils-2.30/gold/testsuite/Makefile.am 2018-06-01 10:15:00.936103521 +0100
@@ -393,7 +393,7 @@ icf_sht_rel_addend_test: icf_sht_rel_add
icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
$(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
-check_PROGRAMS += large_symbol_alignment
+# check_PROGRAMS += large_symbol_alignment
large_symbol_alignment_SOURCES = large_symbol_alignment.cc
large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
large_symbol_alignment_LDFLAGS = -Bgcctestdir/
@@ -783,7 +783,7 @@ weak_test_DEPENDENCIES = gcctestdir/ld
weak_test_LDFLAGS = -Bgcctestdir/
weak_test_LDADD =
-check_PROGRAMS += weak_undef_test
+# check_PROGRAMS += weak_undef_test
MOSTLYCLEANFILES += alt/weak_undef_lib.so
weak_undef_test_SOURCES = weak_undef_test.cc
weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
@@ -1409,7 +1409,7 @@ initpri2_DEPENDENCIES = gcctestdir/ld
initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
initpri2_LDADD =
-check_PROGRAMS += initpri3a
+# check_PROGRAMS += initpri3a
initpri3a_SOURCES = initpri3.c
initpri3a_DEPENDENCIES = gcctestdir/ld
initpri3a_LDFLAGS = -Bgcctestdir/
@@ -1897,19 +1897,19 @@ relro_script_test_LDADD = relro_script_t
relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
$(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
-check_PROGRAMS += script_test_1
+# check_PROGRAMS += script_test_1
script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
script_test_1_LDADD =
-check_PROGRAMS += script_test_2
+# check_PROGRAMS += script_test_2
script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
script_test_2_LDADD =
-check_PROGRAMS += justsyms
+# check_PROGRAMS += justsyms
justsyms_SOURCES = justsyms_1.cc
justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
@@ -1919,7 +1919,7 @@ justsyms_2.o: justsyms_2.cc
justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
-check_PROGRAMS += justsyms_exec
+# check_PROGRAMS += justsyms_exec
justsyms_exec_SOURCES = justsyms_exec.c
justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
@@ -1930,7 +1930,7 @@ justsyms_lib.o: justsyms_lib.c
justsyms_lib: justsyms_lib.o gcctestdir/ld
gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
-check_PROGRAMS += binary_test
+# check_PROGRAMS += binary_test
MOSTLYCLEANFILES += binary.txt
binary_test_SOURCES = binary_test.cc
binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
@@ -1952,7 +1952,7 @@ ver_matching_def_pic.o: ver_matching_def
ver_matching_test.stdout: ver_matching_def.so
$(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
-check_PROGRAMS += script_test_3
+# check_PROGRAMS += script_test_3
check_SCRIPTS += script_test_3.sh
check_DATA += script_test_3.stdout
MOSTLYCLEANFILES += script_test_3.stdout
@@ -1961,7 +1961,7 @@ script_test_3: basic_test.o gcctestdir/l
script_test_3.stdout: script_test_3
$(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
-check_PROGRAMS += tls_phdrs_script_test
+# check_PROGRAMS += tls_phdrs_script_test
tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
@@ -2043,7 +2043,7 @@ check_PROGRAMS += script_test_12
script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
$(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
-check_PROGRAMS += script_test_12i
+# check_PROGRAMS += script_test_12i
script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
$(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
script_test_12a.o: script_test_12a.c
@@ -3023,7 +3023,7 @@ two_file_test_2_ndebug.o: two_file_test_
two_file_test_main_ndebug.o: two_file_test_main.cc
$(CXXCOMPILE) -O0 -g0 -c -o $@ $<
-check_PROGRAMS += incremental_test_2
+# check_PROGRAMS += incremental_test_2
MOSTLYCLEANFILES += two_file_test_tmp_2.o
incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
@@ -3033,7 +3033,7 @@ incremental_test_2: two_file_test_1_v1_n
cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
-check_PROGRAMS += incremental_test_3
+# check_PROGRAMS += incremental_test_3
MOSTLYCLEANFILES += two_file_test_tmp_3.o
incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
two_file_test_2.o two_file_test_main.o gcctestdir/ld
@@ -3043,7 +3043,7 @@ incremental_test_3: two_file_test_1.o tw
cp -f two_file_test_1b.o two_file_test_tmp_3.o
$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
-check_PROGRAMS += incremental_test_4
+# check_PROGRAMS += incremental_test_4
MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
two_file_test_2.o two_file_test_main.o gcctestdir/ld
@@ -3054,7 +3054,7 @@ incremental_test_4: two_file_test_1.o tw
cp -f two_file_test_2.o two_file_test_tmp_4.o
$(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
-check_PROGRAMS += incremental_test_5
+# check_PROGRAMS += incremental_test_5
MOSTLYCLEANFILES += two_file_test_5.a
incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
two_file_test_2.o two_file_test_main.o gcctestdir/ld
@@ -3068,7 +3068,7 @@ incremental_test_5: two_file_test_1.o tw
# Test the --incremental-unchanged flag with an archive library.
# The second link should not update the library.
-check_PROGRAMS += incremental_test_6
+# check_PROGRAMS += incremental_test_6
MOSTLYCLEANFILES += two_file_test_6.a
incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
two_file_test_2.o two_file_test_main.o gcctestdir/ld
@@ -3080,7 +3080,7 @@ incremental_test_6: two_file_test_1.o tw
$(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
-check_PROGRAMS += incremental_copy_test
+# check_PROGRAMS += incremental_copy_test
incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
cp -f copy_test_v1.o copy_test_tmp.o
$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
@@ -3088,7 +3088,7 @@ incremental_copy_test: copy_test_v1.o co
cp -f copy_test.o copy_test_tmp.o
$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
-check_PROGRAMS += incremental_common_test_1
+# check_PROGRAMS += incremental_common_test_1
incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
cp -f common_test_1_v1.o common_test_1_tmp.o
$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie -Bgcctestdir/ common_test_1_tmp.o
@@ -3096,7 +3096,7 @@ incremental_common_test_1: common_test_1
cp -f common_test_1_v2.o common_test_1_tmp.o
$(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ common_test_1_tmp.o
-check_PROGRAMS += incremental_comdat_test_1
+# check_PROGRAMS += incremental_comdat_test_1
incremental_comdat_test_1: incr_comdat_test_1.o incr_comdat_test_2_v1.o incr_comdat_test_2_v2.o incr_comdat_test_2_v3.o gcctestdir/ld
cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
$(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
diff -rup binutils.orig/gold/testsuite/Makefile.in binutils-2.30/gold/testsuite/Makefile.in
--- binutils.orig/gold/testsuite/Makefile.in 2018-05-31 16:14:12.729538804 +0100
+++ binutils-2.30/gold/testsuite/Makefile.in 2018-06-01 10:15:13.070965094 +0100
@@ -166,7 +166,6 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@GCC_TRUE@@NATIVE_LINKER_TRUE@ alt/weak_undef_lib.so \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ libweak_undef_2.a
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_5 = icf_virtual_function_folding_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ large_symbol_alignment \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test basic_pic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ eh_test
@GCC_FALSE@large_symbol_alignment_DEPENDENCIES =
@@ -220,7 +219,6 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@NATIVE_LINKER_FALSE@exception_test_DEPENDENCIES =
@GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@am__append_14 = exception_static_test
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_15 = weak_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test_2
@GCC_FALSE@weak_test_DEPENDENCIES =
@NATIVE_LINKER_FALSE@weak_test_DEPENDENCIES =
@@ -334,7 +332,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
# Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_39 = many_sections_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_r_test initpri1 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2 initpri3a \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections_none \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections \
@@ -348,13 +346,9 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_12 protected_1 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_2 relro_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_now_test relro_strip_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_script_test script_test_1 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2 justsyms \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_exec binary_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_phdrs_script_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_script_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_script_test script_test_11 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12 script_test_12i \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ dynamic_list_2 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_1 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_2
@@ -813,15 +807,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
# Test the --incremental-unchanged flag with an archive library.
# The second link should not update the library.
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_82 = incremental_test_2 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_5 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_6 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_copy_test \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_comdat_test_1 \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_x86_64_bnd_test
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_82 =
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_83 = two_file_test_tmp_2.o \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_tmp_3.o \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4.base \
@@ -1082,7 +1068,6 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest
@NATIVE_OR_CROSS_LINKER_TRUE@ leb128_unittest$(EXEEXT) \
@NATIVE_OR_CROSS_LINKER_TRUE@ overflow_unittest$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_2 = icf_virtual_function_folding_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ large_symbol_alignment$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pic_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ eh_test$(EXEEXT)
@@ -1127,7 +1112,6 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test$(EXEEXT)
@GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_11 = exception_static_test$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_12 = weak_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test_2$(EXEEXT)
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_13 = weak_undef_nonpic_test$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_14 = \
@@ -1164,7 +1148,6 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest
@GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_r_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri1$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri3a$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections_none$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections$(EXEEXT) \
@@ -1186,17 +1169,9 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest
@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_now_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_strip_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_script_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_1$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_exec$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ binary_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_phdrs_script_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_script_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_11$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12i$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ dynamic_list_2$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_1$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_2$(EXEEXT)
@@ -1263,14 +1238,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ehdr_start_test_3$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ehdr_start_test_5$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr20976$(EXEEXT)
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_40 = incremental_test_2$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_5$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_6$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_copy_test$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1$(EXEEXT) \
-@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_comdat_test_1$(EXEEXT) \
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_40 = \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_x86_64_bnd_test$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_41 = pr22266$(EXEEXT)
basic_pic_test_SOURCES = basic_pic_test.c
--- binutils.orig/ld/testsuite/ld-elf/pr22269-1.c 2018-05-31 16:14:12.648539694 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr22269-1.c 2018-06-01 10:55:24.284977908 +0100
@@ -5,4 +5,5 @@ _start (void)
{
if (&foo)
return foo;
+ return 0;
}
--- binutils.orig/ld/testsuite/ld-scripts/cross3.t 2018-05-31 16:14:12.679539354 +0100
+++ binutils-2.30/ld/testsuite/ld-scripts/cross3.t 2018-06-01 10:59:46.109996654 +0100
@@ -6,5 +6,6 @@ SECTIONS
.nocrossrefs : { *(.nocrossrefs) }
.data : { *(.data) *(.data.*) *(.sdata) *(.opd) *(.toc) }
.bss : { *(.bss) *(COMMON) }
+ .got.plt : { *(.got) *(.plt) *(.got.plt) }
/DISCARD/ : { *(*) }
}
--- binutils.orig/ld/testsuite/ld-srec/srec.exp 2018-05-31 16:14:12.570540551 +0100
+++ binutils-2.30/ld/testsuite/ld-srec/srec.exp 2018-06-01 11:01:15.443979458 +0100
@@ -19,6 +19,14 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
+if [istarget x86_64-*-*] {
+ # The S-record tests are failing for some configurations
+ # of x86_64-linux builds, but not others. Not worth
+ # investigating however as S-record conversion can always
+ # be done outside of the linker.
+ return
+}
+
# Get the offset from an S-record line to the start of the data.
proc srec_off { l } {
--- binutils.orig/ld/testsuite/ld-x86-64/pr14207.d 2018-05-31 16:14:12.614540068 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr14207.d 2018-06-01 11:02:02.438444359 +0100
@@ -13,7 +13,7 @@ Program Headers:
LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001c8 0x0001c8 R 0x200000
LOAD 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.0 0x000c.8 RW 0x200000
DYNAMIC 0x000b.0 0x0000000000200b.0 0x0000000000200b.0 0x0001.0 0x0001.0 RW 0x8
- GNU_RELRO 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.8 0x0004.8 R 0x1
+ GNU_RELRO 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.. 0x0004.8 R 0x1
Section to Segment mapping:
Segment Sections...
--- binutils.orig/ld/testsuite/ld-x86-64/pr22001-1b.err 2018-05-31 16:14:12.621539991 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr22001-1b.err 2018-06-01 11:02:58.554805393 +0100
@@ -1,2 +1,2 @@
-.*relocation R_X86_64_32S against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC
+.*relocation R_X86_64_(PC32|32S) against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC
#...
--- binutils.orig/ld/testsuite/ld-x86-64/pr21997-1b.err 2018-05-31 16:14:12.620540002 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr21997-1b.err 2018-06-01 11:04:01.535088273 +0100
@@ -1,2 +1,2 @@
-.*relocation R_X86_64_32S against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC
+.*relocation R_X86_64_(PC32|32S) against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC
#...
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2018-05-31 16:14:12.617540035 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2018-06-01 11:05:46.005912951 +0100
@@ -1792,7 +1792,7 @@ if { [isnative] && [which $CC] != 0 } {
}
}
- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
+ # undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" ""
undefined_weak "-fPIE" "-pie"
undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak"
--- binutils.orig/ld/testsuite/ld-size/size-7a.c 2018-05-31 16:14:12.569540562 +0100
+++ binutils-2.30/ld/testsuite/ld-size/size-7a.c 2018-06-01 11:06:44.106265741 +0100
@@ -1,11 +1,12 @@
#include <stdio.h>
-extern char size_of_bar asm ("bar@SIZE");
+extern char size_of_bar asm ("bar@SIZE");
+char * bar_size = & size_of_bar;
int
-main ()
+main (void)
{
- if (10 == (long) &size_of_bar)
+ if (10L == (long) bar_size)
printf ("OK\n");
return 0;
--- binutils.orig/ld/testsuite/ld-size/size-8a.c 2018-05-31 16:14:12.568540573 +0100
+++ binutils-2.30/ld/testsuite/ld-size/size-8a.c 2018-06-01 11:07:54.926476839 +0100
@@ -1,14 +1,15 @@
#include <stdio.h>
extern __thread char bar[];
-extern char size_of_bar asm ("bar@SIZE");
-extern void set_bar (int, int);
+extern char size_of_bar asm ("bar@SIZE");
+extern void set_bar (int, int);
+char * bar_size = & size_of_bar;
int
-main ()
+main (void)
{
set_bar (1, 20);
- if (10 == (long) &size_of_bar && bar[1] == 20)
+ if (10L == (long) bar_size && bar[1] == 20)
printf ("OK\n");
return 0;
--- binutils.orig/ld/testsuite/ld-size/size-4b.c 2018-05-31 16:14:12.569540562 +0100
+++ binutils-2.30/ld/testsuite/ld-size/size-4b.c 2018-06-01 11:09:00.979741038 +0100
@@ -2,7 +2,7 @@ extern char bar[];
extern char size_of_bar asm ("bar@SIZE");
char *bar_size_1 = &size_of_bar;
-static char *bar_size_2 = &size_of_bar;
+char *bar_size_2 = &size_of_bar;
char *
bar_size1 (void)
@@ -20,7 +20,7 @@ extern char foo[];
extern char size_of_foo asm ("foo@SIZE");
char *foo_size_1 = &size_of_foo;
-static char *foo_size_2 = &size_of_foo;
+char *foo_size_2 = &size_of_foo;
char *
foo_size1 (void)
--- binutils.orig/ld/testsuite/ld-size/size-5b.c 2018-05-31 16:14:12.569540562 +0100
+++ binutils-2.30/ld/testsuite/ld-size/size-5b.c 2018-06-01 11:09:42.134282596 +0100
@@ -2,7 +2,7 @@ extern __thread char bar[];
extern char size_of_bar asm ("bar@SIZE");
char *bar_size_1 = &size_of_bar;
-static char *bar_size_2 = &size_of_bar;
+char *bar_size_2 = &size_of_bar;
char *
bar_size1 (void)
@@ -21,7 +21,7 @@ extern __thread char foo[];
extern char size_of_foo asm ("foo@SIZE");
char *foo_size_1 = &size_of_foo;
-static char *foo_size_2 = &size_of_foo;
+char *foo_size_2 = &size_of_foo;
char *
foo_size1 (void)
--- binutils.orig/ld/testsuite/ld-size/size-6a.c 2018-05-31 16:14:12.568540573 +0100
+++ binutils-2.30/ld/testsuite/ld-size/size-6a.c 2018-06-01 11:11:42.478942015 +0100
@@ -1,14 +1,15 @@
#include <stdio.h>
-extern char bar[];
-extern char size_of_bar asm ("bar@SIZE");
-extern void set_bar (int, int);
+extern char bar[];
+extern char size_of_bar asm ("bar@SIZE");
+extern void set_bar (int, int);
+char * bar_size = & size_of_bar;
int
-main ()
+main (void)
{
set_bar (1, 20);
- if (10 == (long) &size_of_bar && bar[1] == 20)
+ if (10 == (long) bar_size && bar[1] == 20)
printf ("OK\n");
return 0;
--- binutils.orig/ld/testsuite/ld-s390/tlspic_64.dd 2018-05-31 16:14:12.579540452 +0100
+++ binutils-2.30/ld/testsuite/ld-s390/tlspic_64.dd 2018-06-01 13:20:16.509595466 +0100
@@ -78,7 +78,7 @@ Disassembly of section .text:
+[0-9a-f]+: 00 00 00 60 .long 0x00000060
# function prolog
+[0-9a-f]+: b9 04 00 ef lgr %r14,%r15
- +[0-9a-f]+: c0 c0 [0-9a-f ]+ larl %r12,[0-9a-f]+ <_GLOBAL_OFFSET_TABLE_>
+ +[0-9a-f]+: c0 c0 [0-9a-f ]+ larl %r12,[0-9a-f]+ <.*>
+[0-9a-f]+: a7 fb ff 60 aghi %r15,-160
+[0-9a-f]+: e3 e0 e0 00 00 24 stg %r14,0\(%r14\)
# extract TCB
--- binutils.orig/ld/testsuite/ld-srec/srec.exp 2018-05-31 16:14:12.570540551 +0100
+++ binutils-2.30/ld/testsuite/ld-srec/srec.exp 2018-06-01 13:24:35.262758291 +0100
@@ -420,6 +420,8 @@ setup_xfail "bfin-*-linux-uclibc"
# generate the format if need be).
setup_xfail "tile*-*-*"
+setup_xfail "s390*-*-*"
+
run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
# Now try linking a C++ program with global constructors and
--- binutils.orig/ld/testsuite/ld-elf/tls.exp 2018-05-31 16:14:12.665539507 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/tls.exp 2018-06-01 14:17:13.223211181 +0100
@@ -37,15 +37,18 @@ if { [which $CC] == 0 } {
return
}
-run_ld_link_tests [list \
- [list \
- "Build pr22263-1" \
- "-pie -e _start -z text" \
- "" \
- "" \
- { pr22263-1a.c pr22263-1b.c } \
- {{readelf -r pr22263-1.rd}} \
- "pr22263-1" \
- "-fPIE -O2" \
- ] \
-]
+# The s390x system compiler miscompiles these tests.
+if { ! [istarget s390x-*-*] } {
+ run_ld_link_tests [list \
+ [list \
+ "Build pr22263-1" \
+ "-pie -e _start -z text" \
+ "" \
+ "" \
+ { pr22263-1a.c pr22263-1b.c } \
+ {{readelf -r pr22263-1.rd}} \
+ "pr22263-1" \
+ "-fPIE -O2" \
+ ] \
+ ]
+}
--- binutils.orig/ld/testsuite/ld-elf/indirect.exp 2018-05-31 16:14:12.649539683 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/indirect.exp 2018-06-01 14:32:22.949232924 +0100
@@ -156,12 +156,26 @@ set run_tests {
{"Run with libindirect4c.so 4"
"-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" ""
{dummy.c} "indirect4d" "indirect4.out"}
- {"Run indirect5 1"
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" ""
- {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"}
- {"Run indirect5 2"
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" ""
- {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"}
+}
+
+run_ld_link_exec_tests $run_tests
+
+# The s390x system compiler miscompiles these tests.
+if { ! [istarget s390x-*-*] } {
+
+ set run_tests {
+ {"Run indirect5 1"
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" ""
+ {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"}
+ {"Run indirect5 2"
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" ""
+ {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"}
+ }
+
+ run_ld_link_exec_tests $run_tests
+}
+
+set run_tests {
{"Run indirect6 1"
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" ""
{indirect6a.c} "indirect6a" "indirect5.out" "$NOPIE_CFLAGS"}
@@ -213,12 +227,15 @@ proc check_dynamic_syms { test } {
return 1
}
-foreach t [list indirect5a indirect5b indirect6a indirect6b] {
- set testname [concat $t "dynsym"]
- if { [check_dynamic_syms tmpdir/$t] } {
- pass $testname
- } else {
- fail $testname
+# The s390x system compiler miscompiles indirect5 tests.
+if { ! [istarget s390x-*-*] } {
+ foreach t [list indirect5a indirect5b indirect6a indirect6b] {
+ set testname [concat $t "dynsym"]
+ if { [check_dynamic_syms tmpdir/$t] } {
+ pass $testname
+ } else {
+ fail $testname
+ }
}
}
@@ -229,13 +246,22 @@ if { ! [string match "" $exec_output] }
return
}
+
+# The s390x system compiler miscompiles these tests.
+if { ! [istarget s390x-*-*] } {
+ set pie_tests {
+ {"Run indirect5 3"
+ "-pie -Wl,--no-as-needed tmpdir/libindirect5.so" ""
+ {indirect5a.c} "indirect5c" "indirect5.out" "-fPIE"}
+ {"Run indirect5 4"
+ "-pie -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" ""
+ {dummy.c} "indirect5d" "indirect5.out" "-fPIE"}
+ }
+
+ run_ld_link_exec_tests $pie_tests
+}
+
set pie_tests {
- {"Run indirect5 3"
- "-pie -Wl,--no-as-needed tmpdir/libindirect5.so" ""
- {indirect5a.c} "indirect5c" "indirect5.out" "-fPIE"}
- {"Run indirect5 4"
- "-pie -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" ""
- {dummy.c} "indirect5d" "indirect5.out" "-fPIE"}
{"Run indirect6 3"
"-pie -Wl,--no-as-needed tmpdir/libindirect5.so" ""
{indirect6a.c} "indirect6c" "indirect5.out" "-fPIE"}
@@ -246,11 +272,14 @@ set pie_tests {
run_ld_link_exec_tests $pie_tests
-foreach t [list indirect5c indirect5d indirect6c indirect6d] {
- set testname [concat $t "dynsym"]
- if { [check_dynamic_syms tmpdir/$t] } {
- pass $testname
- } else {
- fail $testname
+# The s390x system compiler miscompiles indirect5 tests.
+if { ! [istarget s390x-*-*] } {
+ foreach t [list indirect5c indirect5d indirect6c indirect6d] {
+ set testname [concat $t "dynsym"]
+ if { [check_dynamic_syms tmpdir/$t] } {
+ pass $testname
+ } else {
+ fail $testname
+ }
}
}
--- binutils.orig/ld/testsuite/ld-elfvers/vers.exp 2018-05-31 16:14:12.572540529 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvers/vers.exp 2018-06-01 15:23:36.518815276 +0100
@@ -938,6 +938,7 @@ if [string match "yes" $pic] then {
build_exec "vers23" vers23.c vers23 "-Wl,--no-as-needed tmpdir/vers23a.so tmpdir/vers23b.o tmpdir/vers23b.so" "" vers23.ver vers23.dsym ""
}
+if {! [istarget ppc64*-*-*] && ![istarget "powerpc*-*-linux*"] } {
# Test .symver x,x@VERS.0
set as_pic_flags ""
if [istarget sparc*-*-*] {
@@ -955,6 +956,7 @@ run_ld_link_tests [list "\"vers24c\"
\"-shared --version-script $srcdir/$subdir/vers24.map\" \"\"
\"$as_pic_flags $as_options\" {vers24c.c} { { readelf -Wrs vers24.rd } }
\"libvers24c.so\" \"-fpic\""]
+}
# Test versioned definition vs. normal definition in different files.
if [string match "yes" $pic] then {
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2018-05-31 16:14:12.573540519 +0100
+++ binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp 2018-06-01 15:26:52.020691739 +0100
@@ -284,11 +284,14 @@ if {! [check_osabi tmpdir/static_nonifun
# The linked ifunc using executables and the shared library containing
# ifunc should contain an IFUNC symbol. The non-ifunc using executable
# should not.
-
+if { ![istarget "ppc*-*-*"] && ![istarget "powerpc*-*-linux*"] } {
if {[contains_ifunc_symbol tmpdir/libshared_ifunc.so] != 1} {
fail "Shared libraries containing ifunc does not contain an IFUNC symbol"
set fails [expr $fails + 1]
}
+}
+
+if { ![istarget "ppc*-*-*"] && ![istarget "powerpc*-*-linux*"] } {
if {[contains_ifunc_symbol tmpdir/local_prog] != 1} {
fail "Local ifunc-using executable does not contain an IFUNC symbol"
set fails [expr $fails + 1]
@@ -297,6 +300,7 @@ if {[contains_ifunc_symbol tmpdir/static
fail "Static ifunc-using executable does not contain an IFUNC symbol"
set fails [expr $fails + 1]
}
+}
if {[contains_ifunc_symbol tmpdir/dynamic_prog] != 0} {
fail "Dynamic ifunc-using executable contains an IFUNC symbol"
set fails [expr $fails + 1]
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2018-05-31 16:14:12.580540442 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2018-06-01 15:29:44.048823172 +0100
@@ -293,12 +293,14 @@ if { !$can_compile || $failed_compile }
run_ld_link_tests $plugin_tests
+if { ! [istarget "ppc*-*-*"] && ![istarget "powerpc*-*-linux*"] } {
if { [is_elf_format] \
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
&& [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
run_ld_link_tests $plugin_extra_elf_tests
}
+}
if {![ar_simple_create $ar "" "tmpdir/libtext.a" "tmpdir/text.o"] || \
![ar_simple_create $ar "" "tmpdir/libempty.a" ""]} {
diff -rup binutils.orig/ld/testsuite/ld-elfvers/vers24.rd binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd
--- binutils.orig/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 09:45:44.013108697 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 12:06:17.287425232 +0100
@@ -7,9 +7,9 @@ Symbol table '.dynsym' contains [0-9]+ e
# And ensure the dynamic symbol table contains at least x@VERS.0
# and foo@@VERS.0 symbols
#...
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
#...
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
#...
Symbol table '.symtab' contains [0-9]+ entries:
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.30/ld/testsuite/ld-plugin/plugin-12.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2018-09-05 09:45:44.025108586 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-12.d 2018-09-05 11:50:14.911718048 +0100
@@ -1,6 +1,6 @@
#...
-.*: symbol `func' definition: 0, visibility: 0, resolution: 2
-.*: symbol `func1' definition: 0, visibility: 1, resolution: 3
-.*: symbol `func2' definition: 0, visibility: 2, resolution: 3
-.*: symbol `func3' definition: 0, visibility: 3, resolution: 3
+.*: symbol `.*unc' definition: 0, visibility: 0, resolution: 2
+.*: symbol `.*unc1' definition: 0, visibility: 1, resolution: 3
+.*: symbol `.*unc2' definition: 0, visibility: 2, resolution: 3
+.*: symbol `.*unc3' definition: 0, visibility: 3, resolution: 3
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.30/ld/testsuite/ld-plugin/plugin.exp
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 09:45:44.023108605 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 11:18:53.997202105 +0100
@@ -118,6 +118,12 @@ if { $can_compile && !$failed_compile }
}
}
+# I do not know why, but the underscore prefix test is going
+# wrong on ppc64le targets. So override it here.
+if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] } {
+ set _ ""
+}
+
set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o"
set testobjfiles_notext "tmpdir/main.o tmpdir/func.o"
set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o"
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.30/ld/testsuite/ld-x86-64/plt-main-bnd.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2018-09-05 14:08:22.983184999 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2018-09-05 16:19:36.033431902 +0100
@@ -2,6 +2,6 @@
Disassembly of section .plt.got:
[a-f0-9]+ <[a-z_]+@plt>:
+#...
[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*>
-[ ]*[a-f0-9]+: 90 nop
#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2018-09-05 14:08:22.970185099 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2018-09-05 16:22:30.064079063 +0100
@@ -671,12 +671,6 @@ if { [isnative] && [which $CC] != 0 } {
return
}
- run_ld_link_tests {
- {"X32 DSO from x86-64 object"
- "-shared -melf32_x86_64 tmpdir/simple-x32.o" "" "--x32"
- {dummy.s} {{readelf {-s --wide} x86-64-x32.rd}} "x86-64-x32"}
- }
-
run_cc_link_tests [list \
[list \
"Build plt-lib.so" \
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2019-12-02 10:22:47.019526080 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2019-12-02 10:28:11.413354928 +0000
@@ -33,8 +33,8 @@ global CFLAGS
global CXXFLAGS
set saved_CFLAGS "$CFLAGS"
set saved_CXXFLAGS "$CXXFLAGS"
-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
+# regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
+# regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
proc restore_notify { } {
global saved_CFLAGS

View 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 (&notes, name, name_length);
ret = (char *) obstack_finish (&notes);
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

View File

@ -0,0 +1,99 @@
diff -rup binutils.orig/gold/layout.cc binutils-2.30/gold/layout.cc
--- binutils.orig/gold/layout.cc 2018-10-09 15:24:05.987282736 +0100
+++ binutils-2.30/gold/layout.cc 2018-10-09 16:08:29.445946736 +0100
@@ -2052,12 +2052,15 @@ Layout::attach_allocated_section_to_segm
// segment.
if (os->type() == elfcpp::SHT_NOTE)
{
+ uint64_t os_align = os->addralign();
+
// See if we already have an equivalent PT_NOTE segment.
for (p = this->segment_list_.begin();
p != segment_list_.end();
++p)
{
if ((*p)->type() == elfcpp::PT_NOTE
+ && (*p)->align() == os_align
&& (((*p)->flags() & elfcpp::PF_W)
== (seg_flags & elfcpp::PF_W)))
{
@@ -2071,6 +2074,7 @@ Layout::attach_allocated_section_to_segm
Output_segment* oseg = this->make_output_segment(elfcpp::PT_NOTE,
seg_flags);
oseg->add_output_section_to_nonload(os, seg_flags);
+ oseg->set_align(os_align);
}
}
@@ -3171,6 +3175,10 @@ Layout::create_note(const char* name, in
#else
const int size = 32;
#endif
+ // The NT_GNU_PROPERTY_TYPE_0 note conforms to gABI.
+ const int addralign = ((note_type == elfcpp::NT_GNU_PROPERTY_TYPE_0
+ ? parameters->target().get_size()
+ : size) / 8);
// The contents of the .note section.
size_t namesz = strlen(name) + 1;
@@ -3234,7 +3242,7 @@ Layout::create_note(const char* name, in
return NULL;
Output_section_data* posd = new Output_data_const_buffer(buffer, notehdrsz,
- size / 8,
+ addralign,
"** note header");
os->add_output_section_data(posd);
@@ -3692,6 +3700,11 @@ Layout::segment_precedes(const Output_se
{
if (type1 != type2)
return type1 < type2;
+ uint64_t align1 = seg1->align();
+ uint64_t align2 = seg2->align();
+ // Place segments with larger alignments first.
+ if (align1 != align2)
+ return align1 > align2;
gold_assert(flags1 != flags2
|| this->script_options_->saw_phdrs_clause());
return flags1 < flags2;
diff -rup binutils.orig/gold/output.cc binutils-2.30/gold/output.cc
--- binutils.orig/gold/output.cc 2018-10-09 15:24:05.986282744 +0100
+++ binutils-2.30/gold/output.cc 2018-10-09 16:09:03.749670846 +0100
@@ -4107,6 +4107,7 @@ Output_segment::Output_segment(elfcpp::E
: vaddr_(0),
paddr_(0),
memsz_(0),
+ align_(0),
max_align_(0),
min_p_align_(0),
offset_(0),
diff -rup binutils.orig/gold/output.h binutils-2.30/gold/output.h
--- binutils.orig/gold/output.h 2018-10-09 15:24:05.984282760 +0100
+++ binutils-2.30/gold/output.h 2018-10-09 16:09:45.665333727 +0100
@@ -4676,6 +4676,16 @@ class Output_segment
offset() const
{ return this->offset_; }
+ // Return the segment alignment.
+ uint64_t
+ align() const
+ { return this->align_; }
+
+ // Set the segment alignment.
+ void
+ set_align(uint64_t align)
+ { this->align_ = align; }
+
// Whether this is a segment created to hold large data sections.
bool
is_large_data_segment() const
@@ -4898,6 +4908,8 @@ class Output_segment
uint64_t paddr_;
// The size of the segment in memory.
uint64_t memsz_;
+ // The segment alignment.
+ uint64_t align_;
// The maximum section alignment. The is_max_align_known_ field
// indicates whether this has been finalized.
uint64_t max_align_;

View File

@ -0,0 +1,10 @@
--- binutils.orig/gold/target-reloc.h 2018-07-25 08:29:41.347174442 +0100
+++ binutils-2.30/gold/target-reloc.h 2018-07-25 08:30:47.390413706 +0100
@@ -136,6 +136,7 @@ class Default_comdat_behavior
if (Layout::is_debug_info_section(name))
return CB_PRETEND;
if (strcmp(name, ".eh_frame") == 0
+ || strncmp(name, ".gnu.build.attributes", 21) == 0 // FIXME: We should really be checking the section type for SHT_NOTE.
|| strcmp(name, ".gcc_except_table") == 0)
return CB_IGNORE;
return CB_WARNING;

View File

@ -0,0 +1,16 @@
--- binutils.orig/gold/resolve.cc 2018-03-22 16:52:11.746513638 +0000
+++ binutils-2.30/gold/resolve.cc 2018-03-22 16:53:58.038192419 +0000
@@ -265,10 +265,13 @@ Symbol_table::resolve(Sized_symbol<size>
return;
// Likewise for an absolute symbol defined twice with the same value.
+ // Plugin-symbols are always absolute with same value here, so ignore those.
if (!is_ordinary
&& st_shndx == elfcpp::SHN_ABS
&& !to_is_ordinary
&& to_shndx == elfcpp::SHN_ABS
+ && object->pluginobj() == NULL
+ && to->object()->pluginobj() == NULL
&& to->value() == sym.get_st_value())
return;

View File

@ -0,0 +1,36 @@
diff -rup binutils.orig/gold/layout.cc binutils-2.32/gold/layout.cc
--- binutils.orig/gold/layout.cc 2019-06-24 14:37:36.013086899 +0100
+++ binutils-2.32/gold/layout.cc 2019-06-24 14:41:40.054517479 +0100
@@ -868,6 +868,7 @@ Layout::get_output_section(const char* n
&& (same_name->flags() & elfcpp::SHF_TLS) == 0)
os = same_name;
}
+#if 0 /* BZ 1722715, PR 17556. */
else if ((flags & elfcpp::SHF_TLS) == 0)
{
elfcpp::Elf_Xword zero_flags = 0;
@@ -878,6 +879,7 @@ Layout::get_output_section(const char* n
if (p != this->section_name_map_.end())
os = p->second;
}
+#endif
}
if (os == NULL)
diff -rup binutils.orig/gold/object.cc binutils-2.32/gold/object.cc
--- binutils.orig/gold/object.cc 2019-06-24 14:37:36.012086906 +0100
+++ binutils-2.32/gold/object.cc 2019-06-24 14:39:59.287165501 +0100
@@ -1644,6 +1644,13 @@ Sized_relobj_file<size, big_endian>::do_
omit[i] = true;
}
+ // Skip empty sections without flags.
+ if (!(shdr.get_sh_flags() & ~elfcpp::SHF_GROUP)
+ && !shdr.get_sh_size())
+ {
+ omit[i] = true;
+ }
+
bool discard = omit[i];
if (!discard)
{

File diff suppressed because it is too large Load Diff

View 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
+

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,251 @@
diff -rup binutils.orig/include/bfdlink.h binutils-2.30/include/bfdlink.h
--- binutils.orig/include/bfdlink.h 2020-11-02 10:04:27.457826514 +0000
+++ binutils-2.30/include/bfdlink.h 2020-11-02 10:05:14.723537971 +0000
@@ -339,6 +339,9 @@ struct bfd_link_info
/* TRUE if the LTO plugin is active. */
unsigned int lto_plugin_active: 1;
+ /* TRUE if all LTO IR symbols have been read. */
+ unsigned int lto_all_symbols_read : 1;
+
/* TRUE if global symbols in discarded sections should be stripped. */
unsigned int strip_discarded: 1;
diff -rup binutils.orig/ld/ldlang.c binutils-2.30/ld/ldlang.c
--- binutils.orig/ld/ldlang.c 2020-11-02 10:04:16.852890551 +0000
+++ binutils-2.30/ld/ldlang.c 2020-11-02 10:06:12.285185841 +0000
@@ -7162,6 +7162,7 @@ lang_process (void)
if (plugin_call_all_symbols_read ())
einfo (_("%P%F: %s: plugin reported error after all symbols read\n"),
plugin_error_plugin ());
+ link_info.lto_all_symbols_read = TRUE;
/* Open any newly added files, updating the file chains. */
open_input_bfds (*added.tail, OPEN_BFD_NORMAL);
/* Restore the global list pointer now they have all been added. */
diff -rup binutils.orig/ld/plugin.c binutils-2.30/ld/plugin.c
--- binutils.orig/ld/plugin.c 2020-11-02 10:04:16.852890551 +0000
+++ binutils-2.30/ld/plugin.c 2020-11-02 10:08:11.010459546 +0000
@@ -1355,12 +1355,16 @@ plugin_notice (struct bfd_link_info *inf
new value from a real BFD. Weak symbols are not normally
overridden by a new weak definition, and strong symbols
will normally cause multiple definition errors. Avoid
- this by making the symbol appear to be undefined. */
- if (((h->type == bfd_link_hash_defweak
- || h->type == bfd_link_hash_defined)
- && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
- || (h->type == bfd_link_hash_common
- && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner)))
+ this by making the symbol appear to be undefined.
+
+ NB: We change the previous definition in the IR object to
+ undefweak only after all LTO symbols have been read. */
+ if (info->lto_all_symbols_read
+ && (((h->type == bfd_link_hash_defweak
+ || h->type == bfd_link_hash_defined)
+ && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
+ || (h->type == bfd_link_hash_common
+ && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner))))
{
h->type = bfd_link_hash_undefweak;
h->u.undef.abfd = sym_bfd;
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-11-02 10:04:16.926890104 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-11-02 10:12:09.551000288 +0000
@@ -214,6 +214,36 @@ set lto_link_tests [list \
[list "Build pr22502b.o" \
"$plug_opt" "-flto $lto_no_fat" \
{pr22502b.c}] \
+ [list "Build pr26262b.o" \
+ "" "-O2" \
+ {pr26262b.c} {} "" "c"] \
+ [list "Build pr26262c.o" \
+ "" "-O2" \
+ {pr26262c.c} {} "" "c"] \
+ [list "Build pr26267a.o" \
+ "" "-O2 -flto $lto_no_fat" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267b.o" \
+ "" "-O2" \
+ {pr26267b.c} {} "" "c"] \
+ [list "Build pr26267c.o" \
+ "" "-O2" \
+ {pr26267c.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "" "-O2" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "-flto tmpdir/pr26267a.o tmpdir/pr26267b.o tmpdir/pr26267c.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267a"] \
+ [list "Build pr26267b" \
+ "-flto tmpdir/pr26267b.o tmpdir/pr26267c.o tmpdir/pr26267a.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267b"] \
]
if { [at_least_gcc_version 4 7] } {
@@ -373,6 +403,16 @@ set lto_run_tests [list \
[list "Run pr22502" \
"-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
{dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \
+ [list "Run pr26262a" \
+ "-O2 -flto" "" \
+ {pr26262a.c} "pr26262a" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ [list "Run pr26262b" \
+ "-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
+ {pr26262a.c} "pr26262b" "pass.out" \
+ "-flto -O2" "c" "" \
+ ""] \
]
if { [at_least_gcc_version 4 7] } {
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26262a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26262b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267.err
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267c.c
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262a.c 2020-11-02 10:13:16.624589913 +0000
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int counter;
+extern void foo (void);
+extern void xxx (void);
+
+void
+bar (void)
+{
+}
+
+int
+main(void)
+{
+ bar ();
+ foo ();
+ xxx ();
+ if (counter == 1)
+ printf ("PASS\n");
+ return 0;
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262b.c 2020-11-02 10:13:27.358523487 +0000
@@ -0,0 +1,16 @@
+#include <stdlib.h>
+
+extern int counter;
+
+void
+foo (void)
+{
+ counter++;
+}
+
+__attribute__((weak))
+void
+bar (void)
+{
+ abort ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262c.c 2020-11-02 10:47:59.031665605 +0000
@@ -0,0 +1,6 @@
+extern void bar (void);
+void
+xxx (void)
+{
+ bar ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267c.c 2020-11-02 10:13:39.665447327 +0000
@@ -0,0 +1,6 @@
+extern void bar (void);
+void
+xxx (void)
+{
+ bar ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267b.c 2020-11-02 10:13:43.648422679 +0000
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+
+extern int counter;
+
+void
+foo (void)
+{
+ counter++;
+}
+
+void
+bar (void)
+{
+ abort ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267a.c 2020-11-02 10:13:47.556398495 +0000
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int counter;
+extern void foo (void);
+extern void xxx (void);
+
+void
+bar (void)
+{
+}
+
+int
+main(void)
+{
+ bar ();
+ foo ();
+ xxx ();
+ if (counter == 1)
+ printf ("PASS\n");
+ return 0;
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 10:14:01.785310441 +0000
@@ -0,0 +1,3 @@
+#...
+.*: multiple definition of `bar'; .*
+#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/pr26267.err binutils-2.30/ld/testsuite/ld-plugin/pr26267.err
--- binutils.orig/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 12:51:28.751137533 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 13:01:38.430679516 +0000
@@ -1,3 +1,3 @@
#...
-.*: multiple definition of `bar'; .*
+.*: multiple definition of `bar'.*
#...
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-11-02 12:51:28.751137533 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-11-02 13:10:49.531708566 +0000
@@ -404,15 +404,13 @@ set lto_run_tests [list \
"-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
{dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \
[list "Run pr26262a" \
- "-O2 -flto" "" \
+ "-O2 -flto tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
{pr26262a.c} "pr26262a" "pass.out" \
- "-flto -O2" "c" "" \
- "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ "-flto -O2" "c" "" ] \
[list "Run pr26262b" \
"-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
{pr26262a.c} "pr26262b" "pass.out" \
- "-flto -O2" "c" "" \
- ""] \
+ "-flto -O2" "c" "" ] \
]
if { [at_least_gcc_version 4 7] } {

View 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);

View File

@ -0,0 +1,123 @@
--- binutils.orig/bfd/elflink.c 2021-03-19 13:03:56.464793790 +0000
+++ binutils-2.30/bfd/elflink.c 2021-03-19 13:05:17.475264954 +0000
@@ -12825,7 +12825,7 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
bfd_boolean *start_stop)
{
unsigned long r_symndx;
- struct elf_link_hash_entry *h;
+ struct elf_link_hash_entry *h, *hw;
r_symndx = cookie->rel->r_info >> cookie->r_sym_shift;
if (r_symndx == STN_UNDEF)
@@ -12845,12 +12845,16 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
h->mark = 1;
- /* If this symbol is weak and there is a non-weak definition, we
- keep the non-weak definition because many backends put
- dynamic reloc info on the non-weak definition for code
- handling copy relocs. */
- if (h->is_weakalias)
- weakdef (h)->mark = 1;
+ /* Keep all aliases of the symbol too. If an object symbol
+ needs to be copied into .dynbss then all of its aliases
+ should be present as dynamic symbols, not just the one used
+ on the copy relocation. */
+ hw = h;
+ while (hw->is_weakalias)
+ {
+ hw = hw->u.alias;
+ hw->mark = 1;
+ }
if (start_stop != NULL)
{
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458.map
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458.rd
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458a.s
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458b.s
diff -rup binutils.orig/ld/testsuite/ld-elf/shared.exp binutils-2.30/ld/testsuite/ld-elf/shared.exp
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2021-03-19 13:03:56.141795899 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/shared.exp 2021-03-19 13:08:57.839826387 +0000
@@ -296,6 +296,38 @@ if { [check_gc_sections_available] } {
"pr22150" \
] \
]
+
+ switch -glob $target_triplet {
+ # Exclude targets that don't support copy relocs.
+ bfin-*-* { }
+ frv-*-* { }
+ lm32-*-* { }
+ mips*-*-* { }
+ tic6x-*-* { }
+ xtensa-*-* { }
+ default {
+ run_ld_link_tests [list \
+ [list \
+ "Build pr25458.so" \
+ "$LFLAGS -shared --version-script=pr25458.map" \
+ "" \
+ "$AFLAGS_PIC" \
+ {pr25458b.s} \
+ {} \
+ "pr25458.so" \
+ ] \
+ [list \
+ "Build pr25458" \
+ "$LFLAGS -e _start --gc-sections" \
+ "tmpdir/pr25458.so" \
+ "$AFLAGS_PIC" \
+ {pr25458a.s} \
+ {{readelf {--dyn-sym --wide} pr25458.rd}} \
+ "pr25458" \
+ ] \
+ ]
+ }
+ }
}
set ASFLAGS $old_ASFLAGS
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458.map 2021-03-19 13:06:34.859759781 +0000
@@ -0,0 +1,4 @@
+FOO {
+global:
+ __environ; _environ; environ;
+};
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458.rd 2021-03-19 13:06:34.860759774 +0000
@@ -0,0 +1,10 @@
+#...
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+#...
+ +[0-9]+: [0-9a-f]+ +(4|8)+ OBJECT +(WEAK|GLOBAL) +DEFAULT +[0-9]+ _*environ@FOO \(2\)
+#...
+ +[0-9]+: [0-9a-f]+ +(4|8)+ OBJECT +(WEAK|GLOBAL) +DEFAULT +[0-9]+ _*environ@FOO \(2\)
+#...
+ +[0-9]+: [0-9a-f]+ +(4|8)+ OBJECT +(WEAK|GLOBAL) +DEFAULT +[0-9]+ _*environ@FOO \(2\)
+#pass
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458a.s 2021-03-19 13:06:34.860759774 +0000
@@ -0,0 +1,6 @@
+ .text
+ .globl _start
+ .type _start, %function
+_start:
+ .dc.a environ
+ .size _start, .-_start
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458b.s 2021-03-19 13:06:34.860759774 +0000
@@ -0,0 +1,11 @@
+ .data
+ .globl __environ
+ .type __environ,%object
+__environ:
+ .dc.a 0
+ .size __environ, .-__environ
+ .weak _environ
+ .globl _environ
+ .set _environ, __environ
+ .weak environ
+ .set environ, __environ

View File

@ -0,0 +1,23 @@
diff -rup binutils.orig/gold/layout.cc binutils-2.30/gold/layout.cc
--- binutils.orig/gold/layout.cc 2018-07-27 12:02:14.160444849 +0100
+++ binutils-2.30/gold/layout.cc 2018-07-27 12:03:11.543820863 +0100
@@ -5133,6 +5133,7 @@ const Layout::Section_name_mapping Layou
MAPPING_INIT(".gnu.linkonce.armextab.", ".ARM.extab"),
MAPPING_INIT(".ARM.exidx", ".ARM.exidx"),
MAPPING_INIT(".gnu.linkonce.armexidx.", ".ARM.exidx"),
+ MAPPING_INIT(".gnu.build.attributes.", ".gnu.build.attributes"),
};
#undef MAPPING_INIT
#undef MAPPING_INIT_EXACT
diff -rup binutils.orig/ld/scripttempl/elf.sc binutils-2.30/ld/scripttempl/elf.sc
--- binutils.orig/ld/scripttempl/elf.sc 2018-07-27 12:02:13.992446676 +0100
+++ binutils-2.30/ld/scripttempl/elf.sc 2018-07-27 12:02:42.292138945 +0100
@@ -692,6 +692,8 @@ cat <<EOF
.comment 0 : { *(.comment) }
+ .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
+
EOF
. $srcdir/scripttempl/DWARF.sc

View 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);

View File

@ -0,0 +1,23 @@
--- binutils.orig/bfd/elf.c 2019-09-10 10:57:33.391081672 +0100
+++ binutils-2.27/bfd/elf.c 2019-09-10 10:59:55.355010766 +0100
@@ -2324,9 +2324,18 @@ bfd_section_from_shdr (bfd *abfd, unsign
else
p_hdr = &esdt->rel.hdr;
- /* PR 17512: file: 0b4f81b7. */
+ /* PR 17512: file: 0b4f81b7.
+ Also see PR 24456, for a file which deliberately has two reloc
+ sections. */
if (*p_hdr != NULL)
- goto fail;
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B: warning: multiple relocation sections for section %A \
+found - ignoring all but the first"),
+ abfd, target_sect);
+ goto success;
+ }
hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2));
if (hdr2 == NULL)
goto fail;

5427
SOURCES/binutils-nfp.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
--- binutils.orig/binutils/objcopy.c 2018-08-06 09:11:02.053503486 +0100
+++ binutils-2.30/binutils/objcopy.c 2018-08-06 09:11:23.296329566 +0100
@@ -2174,7 +2174,7 @@ merge_gnu_build_notes (bfd * abfd, asect
3. Eliminate any NT_GNU_BUILD_ATTRIBUTE_OPEN notes that have the same
full name field as the immediately preceeding note with the same type
of name and whose address ranges coincide.
- IE - it there are gaps in the coverage of the notes, then these gaps
+ IE - if there are gaps in the coverage of the notes, then these gaps
must be preserved.
4. Combine the numeric value of any NT_GNU_BUILD_ATTRIBUTE_OPEN notes
of type GNU_BUILD_ATTRIBUTE_STACK_SIZE.
@@ -2182,16 +2182,47 @@ merge_gnu_build_notes (bfd * abfd, asect
its description field is empty then the nearest preceeding OPEN note
with a non-empty description field must also be preserved *OR* the
description field of the note must be changed to contain the starting
- address to which it refers. */
+ address to which it refers.
+ 6. Notes with the same start and end address can be deleted. */
for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++)
{
int note_type;
objcopy_internal_note * back;
objcopy_internal_note * prev_open_with_range = NULL;
+ /* Rule 6 - delete 0-range notes. */
+ if (pnote->start == pnote->end)
+ {
+ duplicate_found = TRUE;
+ pnote->note.type = 0;
+ continue;
+ }
+
/* Rule 2 - preserve function notes. */
if (! is_open_note (pnote))
- continue;
+ {
+ int iter;
+
+ /* Check to see if there is an identical previous function note.
+ This can happen with overlays for example. */
+ for (iter = 0, back = pnote -1; back >= pnotes; back --)
+ {
+ if (back->start == pnote->start
+ && back->end == pnote->end
+ && back->note.namesz == pnote->note.namesz
+ && memcmp (back->note.namedata, pnote->note.namedata, pnote->note.namesz) == 0)
+ {
+ duplicate_found = TRUE;
+ pnote->note.type = 0;
+ break;
+ }
+
+ /* Don't scan too far back however. */
+ if (iter ++ > 16)
+ break;
+ }
+ continue;
+ }
note_type = pnote->note.namedata[attribute_type_byte];

View File

@ -0,0 +1,97 @@
diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.30/binutils/doc/binutils.texi
--- binutils.orig/binutils/doc/binutils.texi 2020-04-07 16:11:52.164358203 +0100
+++ binutils-2.30/binutils/doc/binutils.texi 2020-04-07 16:14:37.759171936 +0100
@@ -1586,7 +1586,9 @@ recognized names are @samp{alloc}, @samp
for a section which does not have contents, but it is not meaningful
to clear the @samp{contents} flag of a section which does have
contents--just remove the section instead. Not all flags are
-meaningful for all object file formats.
+meaningful for all object file formats. In particular the
+@samp{share} flag is only meaningful for COFF format files and not for
+ELF format files.
@item --add-section @var{sectionname}=@var{filename}
Add a new section named @var{sectionname} while copying the file. The
@@ -1637,7 +1639,8 @@ Rename a section from @var{oldname} to @
changing the section's flags to @var{flags} in the process. This has
the advantage over using a linker script to perform the rename in that
the output stays as an object file and does not become a linked
-executable.
+executable. This option accepts the same set of flags as the
+@option{--sect-section-flags} option.
This option is particularly helpful when the input format is binary,
since this will always create a section called .data. If for example,
diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2020-04-07 16:11:52.177358110 +0100
+++ binutils-2.30/binutils/objcopy.c 2020-04-07 16:16:15.736470047 +0100
@@ -2514,6 +2514,23 @@ merge_gnu_build_notes (bfd * ab
return size;
}
+static flagword
+check_new_section_flags (flagword flags, bfd * abfd, const char * secname)
+{
+ /* Only set the SEC_COFF_SHARED flag on COFF files.
+ The same bit value is used by ELF targets to indicate
+ compressed sections, and setting that flag here breaks
+ things. */
+ if ((flags & SEC_COFF_SHARED)
+ && bfd_get_flavour (abfd) != bfd_target_coff_flavour)
+ {
+ non_fatal (_("%s[%s]: Note - dropping 'share' flag as output format is not COFF"),
+ bfd_get_filename (abfd), secname);
+ flags &= ~ SEC_COFF_SHARED;
+ }
+ return flags;
+}
+
/* Copy object file IBFD onto OBFD.
Returns TRUE upon success, FALSE otherwise. */
@@ -2755,7 +2772,10 @@ copy_object (bfd *ibfd, bfd *obfd, const
pset = find_section_list (padd->name, FALSE,
SECTION_CONTEXT_SET_FLAGS);
if (pset != NULL)
- flags = pset->flags | SEC_HAS_CONTENTS;
+ {
+ flags = pset->flags | SEC_HAS_CONTENTS;
+ flags = check_new_section_flags (flags, obfd, padd->name);
+ }
else
flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DATA;
@@ -3867,6 +3887,7 @@ setup_section (bfd *ibfd, sec_ptr isecti
flagword flags;
const char *err;
const char * name;
+ const char * new_name;
char *prefix = NULL;
bfd_boolean make_nobits;
@@ -3876,7 +3897,12 @@ setup_section (bfd *ibfd, sec_ptr isecti
/* Get the, possibly new, name of the output section. */
name = bfd_section_name (ibfd, isection);
flags = bfd_get_section_flags (ibfd, isection);
- name = find_section_rename (name, &flags);
+ new_name = find_section_rename (name, &flags);
+ if (new_name != name)
+ {
+ name = new_name;
+ flags = check_new_section_flags (flags, obfd, name);
+ }
/* Prefix sections. */
if ((prefix_alloc_sections_string)
@@ -3900,7 +3926,10 @@ setup_section (bfd *ibfd, sec_ptr isecti
p = find_section_list (bfd_section_name (ibfd, isection), FALSE,
SECTION_CONTEXT_SET_FLAGS);
if (p != NULL)
- flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
+ {
+ flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
+ flags = check_new_section_flags (flags, obfd, bfd_section_name (ibfd, isection));
+ }
else if (strip_symbols == STRIP_NONDEBUG
&& (flags & (SEC_ALLOC | SEC_GROUP)) != 0
&& !is_nondebug_keep_contents_section (ibfd, isection))

View File

@ -0,0 +1,77 @@
diff --git a/bfd/elf.c b/bfd/elf.c
index c132098558..325bdd545a 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4727,33 +4727,35 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
the previous section, then we need a new segment. */
new_segment = TRUE;
}
+ else if ((abfd->flags & D_PAGED) != 0
+ && (((last_hdr->lma + last_size - 1) & -maxpagesize)
+ == (hdr->lma & -maxpagesize)))
+ {
+ /* If we are demand paged then we can't map two disk
+ pages onto the same memory page. */
+ new_segment = FALSE;
+ }
/* In the next test we have to be careful when last_hdr->lma is close
to the end of the address space. If the aligned address wraps
around to the start of the address space, then there are no more
pages left in memory and it is OK to assume that the current
section can be included in the current segment. */
- else if ((BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize
- > last_hdr->lma)
- && (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize
- <= hdr->lma))
+ else if ((BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
+ + maxpagesize > last_hdr->lma)
+ && (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
+ + maxpagesize <= hdr->lma))
{
/* If putting this section in this segment would force us to
skip a page in the segment, then we need a new segment. */
new_segment = TRUE;
}
else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0
- && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0
- && ((abfd->flags & D_PAGED) == 0
- || (((last_hdr->lma + last_size - 1) & -maxpagesize)
- != (hdr->lma & -maxpagesize))))
+ && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
{
/* We don't want to put a loaded section after a
nonloaded (ie. bss style) section in the same segment
as that will force the non-loaded section to be loaded.
- Consider .tbss sections as loaded for this purpose.
- However, like the writable/non-writable case below,
- if they are on the same page then they must be put
- in the same segment. */
+ Consider .tbss sections as loaded for this purpose. */
new_segment = TRUE;
}
else if ((abfd->flags & D_PAGED) == 0)
@@ -4769,21 +4771,11 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
{
new_segment = TRUE;
}
- else if (! writable
- && (hdr->flags & SEC_READONLY) == 0
- && ((info != NULL
- && info->relro_end > info->relro_start)
- || (((last_hdr->lma + last_size - 1) & -maxpagesize)
- != (hdr->lma & -maxpagesize))))
+ else if (! writable
+ && (hdr->flags & SEC_READONLY) == 0)
{
/* We don't want to put a writable section in a read only
- segment, unless they are on the same page in memory
- anyhow and there is no RELRO segment. We already
- know that the last section does not bring us past the
- current section on the page, so the only case in which
- the new section is not on the same page as the previous
- section is when the previous section ends precisely on
- a page boundary. */
+ segment. */
new_segment = TRUE;
}
else

View File

@ -0,0 +1,212 @@
diff -rup binutils.orig/bfd/elflink.c binutils-2.30/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2021-03-18 14:33:03.462295923 +0000
+++ binutils-2.30/bfd/elflink.c 2021-03-18 14:37:34.110465450 +0000
@@ -4661,7 +4661,10 @@ error_free_dyn:
object and a shared object. */
bfd_boolean dynsym = FALSE;
- if (! dynamic)
+ /* Plugin symbols aren't normal. Don't set def/ref flags. */
+ if ((abfd->flags & BFD_PLUGIN) != 0)
+ ;
+ else if (!dynamic)
{
if (! definition)
{
@@ -4678,14 +4681,6 @@ error_free_dyn:
h->ref_dynamic = 1;
}
}
-
- /* If the indirect symbol has been forced local, don't
- make the real symbol dynamic. */
- if ((h == hi || !hi->forced_local)
- && (bfd_link_dll (info)
- || h->def_dynamic
- || h->ref_dynamic))
- dynsym = TRUE;
}
else
{
@@ -4699,14 +4694,25 @@ error_free_dyn:
h->def_dynamic = 1;
hi->def_dynamic = 1;
}
+ }
- /* If the indirect symbol has been forced local, don't
- make the real symbol dynamic. */
- if ((h == hi || !hi->forced_local)
- && (h->def_regular
- || h->ref_regular
- || (h->is_weakalias
- && weakdef (h)->dynindx != -1)))
+ /* If an indirect symbol has been forced local, don't
+ make the real symbol dynamic. */
+ if (h != hi && hi->forced_local)
+ ;
+ else if (!dynamic)
+ {
+ if (bfd_link_dll (info)
+ || h->def_dynamic
+ || h->ref_dynamic)
+ dynsym = TRUE;
+ }
+ else
+ {
+ if (h->def_regular
+ || h->ref_regular
+ || (h->is_weakalias
+ && weakdef (h)->dynindx != -1))
dynsym = TRUE;
}
@@ -4841,6 +4847,10 @@ error_free_dyn:
&& !bfd_link_relocatable (info))
dynsym = FALSE;
+ /* Nor should we make plugin symbols dynamic. */
+ if ((abfd->flags & BFD_PLUGIN) != 0)
+ dynsym = FALSE;
+
if (definition)
{
h->target_internal = isym->st_target_internal;
@@ -4866,8 +4876,8 @@ error_free_dyn:
nondeflt_vers[nondeflt_vers_cnt++] = h;
}
}
-
- if (dynsym && (abfd->flags & BFD_PLUGIN) == 0 && h->dynindx == -1)
+
+ if (dynsym && h->dynindx == -1)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;
@@ -4897,9 +4907,10 @@ error_free_dyn:
&& matched
&& definition
&& ((dynsym
- && h->ref_regular_nonweak
- && (old_bfd == NULL
- || (old_bfd->flags & BFD_PLUGIN) == 0))
+ && h->ref_regular_nonweak)
+ || (old_bfd != NULL
+ && (old_bfd->flags & BFD_PLUGIN) != 0
+ && bind != STB_WEAK)
|| (h->ref_dynamic_nonweak
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
&& !on_needed_list (elf_dt_name (abfd),
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19.h
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19c.c
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2021-03-18 14:33:02.366303344 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2021-03-18 14:41:51.419725611 +0000
@@ -133,7 +133,16 @@ set lto_link_tests [list \
{lto-15a.c} {} ""] \
[list "Build liblto-15.a" \
"$plug_opt" "-flto" \
- {lto-15b.c} {} "liblto-15.a"] \
+ {lto-15b.c} {} "liblto-15.a"] \
+ [list {liblto-19.a} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19a.c} {} {liblto-19.a}] \
+ [list {compile lto-19b.c} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19b.c} {} {} {c}] \
+ [list {liblto-19.so} \
+ {-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
+ {dummy.c} {} {liblto-19.so}] \
[list "PR ld/12696" \
"-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" \
{pr12696-1.cc} {} "pr12696-1r.o" "c++"] \
@@ -244,6 +253,9 @@ set lto_link_tests [list \
{dummy.c} \
{{error_output "pr26267.err"}} \
"pr26267b"] \
+ [list {pr26806.so} \
+ {-shared} {-fpic -O2 -flto} \
+ {pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
]
if { [at_least_gcc_version 4 7] } {
@@ -438,6 +450,10 @@ set lto_run_elf_shared_tests [list \
[list {pr22220b} \
{-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \
{dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \
+ [list {lto-19} \
+ {-Wl,--as-needed,-R,tmpdir} {} \
+ {lto-19a.c lto-19b.c lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
+ {tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
]
# LTO run-time tests for ELF
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26806.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26806.d
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19.h 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,6 @@
+struct re_dfa_t {
+ const int *sb_char;
+};
+struct re_dfa_t *xregcomp (void);
+struct re_dfa_t *rpl_regcomp (void);
+void rpl_regfree (struct re_dfa_t *);
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19a.c 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "lto-19.h"
+
+static const int utf8_sb_map[4] = { 0x12, 0x34, 0x56, 0x78 };
+
+struct re_dfa_t *
+rpl_regcomp ()
+{
+ struct re_dfa_t *dfa = malloc (sizeof (struct re_dfa_t));
+ dfa->sb_char = utf8_sb_map;
+ return dfa;
+}
+
+void
+rpl_regfree (struct re_dfa_t *dfa)
+{
+ puts (dfa->sb_char == utf8_sb_map ? "PASS" : "FAIL");
+}
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19b.c 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,7 @@
+#include "lto-19.h"
+
+struct re_dfa_t *
+xregcomp (void)
+{
+ return rpl_regcomp ();
+}
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19c.c 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,9 @@
+#include "lto-19.h"
+
+int
+main ()
+{
+ struct re_dfa_t *dfa = xregcomp ();
+ rpl_regfree (dfa);
+ return 0;
+}
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26806.c 2021-03-18 14:39:16.319774345 +0000
@@ -0,0 +1,2 @@
+#include <unistd.h>
+int foo (int x) { if (__builtin_constant_p (x)) return getpid (); return 0; }
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26806.d 2021-03-18 14:39:16.319774345 +0000
@@ -0,0 +1,4 @@
+#failif
+#...
+.* _*getpid[@ ].*
+#...

View File

@ -0,0 +1,138 @@
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-09 11:46:13.571665439 +0100
+++ binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp 2020-10-09 11:47:59.113302758 +0100
@@ -319,27 +319,6 @@ set lto_link_elf_tests [list \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
- [list "Build libpr15146a.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146a.c} {} "lib15146a.a"] \
- [list "Build pr15146b.so" \
- "-shared" "-O2 -fpic" \
- {pr15146b.c} {} "pr15146b.so" "c"] \
- [list "Build pr15146c.so" \
- "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic" \
- {pr15146c.c} {} "pr15146c.so" "c"] \
- [list "PR ld/15146 (1)" \
- "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
- {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
- [list "Build libpr15146d.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146d.c} {} "lib15146d.a"] \
- [list "Build libpr16746a.a" \
- "" "" \
- {pr16746a.c pr16746b.c} {} "lib15146a.a"] \
- [list "Build libpr16746b.a" \
- "$plug_opt" "-O2 -flto" \
- {pr16746c.c pr16746d.c} {} "lib15146b.a"] \
[list "PR ld/16746 (1)" \
"-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
{dummy.c} {} "pr16746a.exe"] \
@@ -602,13 +581,6 @@ run_cc_link_tests $lto_compile_elf_tests
# Restrict these to ELF targets that support shared libs and PIC.
if { [is_elf_format] && [check_lto_shared_available] } {
run_cc_link_tests $lto_link_elf_tests
- set testname "PR ld/15146 (2)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
- if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
set testname "PR ld/16746 (3)"
set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
diff -rup binutils.orig/bfd/elflink.c binutils-2.35.1/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2020-10-09 11:46:14.151663446 +0100
+++ binutils-2.35.1/bfd/elflink.c 2020-10-09 11:46:27.222618528 +0100
@@ -4970,11 +4970,7 @@ elf_link_add_object_symbols (bfd *abfd,
object and a shared object. */
bfd_boolean dynsym = FALSE;
- /* Plugin symbols aren't normal. Don't set def_regular or
- ref_regular for them, or make them dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- ;
- else if (! dynamic)
+ if (! dynamic)
{
if (! definition)
{
@@ -5155,10 +5151,6 @@ elf_link_add_object_symbols (bfd *abfd,
&& !bfd_link_relocatable (info))
dynsym = FALSE;
- /* Nor should we make plugin symbols dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- dynsym = FALSE;
-
if (definition)
{
h->target_internal = isym->st_target_internal;
@@ -5185,7 +5177,7 @@ elf_link_add_object_symbols (bfd *abfd,
}
}
- if (dynsym && h->dynindx == -1)
+ if (dynsym && (abfd->flags & BFD_PLUGIN) == 0 && h->dynindx == -1)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:23:49.034685727 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:24:48.288484833 +0000
@@ -265,12 +265,6 @@ set lto_link_elf_tests [list \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
- [list "PR ld/16746 (1)" \
- "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
- {dummy.c} {} "pr16746a.exe"] \
- [list "PR ld/16746 (2)" \
- "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
- {dummy.c} {} "pr16746b.exe"] \
[list "Build pr21382a.o" \
"" "-O2 -flto" \
{pr21382a.c} {} "" "c"] \
@@ -424,25 +418,6 @@ run_cc_link_tests $lto_link_tests
# by some elf tests besides shared libs tests. So, always compile them.
run_cc_link_tests $lto_compile_elf_tests
-# Restrict these to ELF targets that support shared libs and PIC.
-if { [is_elf_format] && [check_lto_shared_available] } {
- run_cc_link_tests $lto_link_elf_tests
- set testname "PR ld/16746 (3)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
- if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
- set testname "PR ld/16746 (4)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"]
- if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
-}
-
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:47:18.581911539 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:50:25.048280769 +0000
@@ -418,6 +418,11 @@ run_cc_link_tests $lto_link_tests
# by some elf tests besides shared libs tests. So, always compile them.
run_cc_link_tests $lto_compile_elf_tests
+# Restrict these to ELF targets that support shared libs and PIC.
+if { [is_elf_format] && [check_lto_shared_available] } {
+ run_cc_link_tests $lto_link_elf_tests
+}
+
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]

View File

@ -0,0 +1,42 @@
--- binutils.orig/binutils/objcopy.c 2021-02-18 11:35:48.062479490 +0000
+++ binutils-2.30/binutils/objcopy.c 2021-02-18 11:36:52.207071148 +0000
@@ -2224,6 +2224,11 @@ merge_gnu_build_notes (bfd * ab
goto done;
}
+ if (start > end)
+ /* This can happen with PPC64LE binaries where empty notes are
+ encoded as start = end + 4. */
+ start = end;
+
if (is_open_note (pnote))
{
if (start)
--- binutils.orig/binutils/objcopy.c 2021-02-22 16:04:09.390542219 +0000
+++ binutils-2.30/binutils/objcopy.c 2021-02-22 16:04:32.214392597 +0000
@@ -2195,23 +2195,8 @@ merge_gnu_build_notes (bfd * ab
break;
case 8:
- if (! is_64bit (abfd))
- {
- start = bfd_get_32 (abfd, pnote->note.descdata);
- end = bfd_get_32 (abfd, pnote->note.descdata + 4);
- }
- else
- {
- start = bfd_get_64 (abfd, pnote->note.descdata);
- /* FIXME: For version 1 and 2 notes we should try to
- calculate the end address by finding a symbol whose
- value is START, and then adding in its size.
-
- For now though, since v1 and v2 was not intended to
- handle gaps, we chose an artificially large end
- address. */
- end = (bfd_vma) 0x7ffffffffffffffUL;
- }
+ start = bfd_get_32 (abfd, pnote->note.descdata);
+ end = bfd_get_32 (abfd, pnote->note.descdata + 4);
break;
case 16:

View File

@ -0,0 +1,66 @@
diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-12-12 16:24:19.571221194 +0000
+++ binutils-2.29/binutils/readelf.c 2017-12-12 16:27:26.997979803 +0000
@@ -11018,12 +11018,14 @@ print_dynamic_symbol (bfd_vma si, unsign
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very
rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %3.3s ", get_symbol_index_type (filedata, psym->st_shndx));
@@ -11031,6 +11033,15 @@ print_dynamic_symbol (bfd_vma si, unsign
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
else
printf (_(" <corrupt: %14ld>"), psym->st_name);
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s]", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
}
--- binutils.orig/binutils/readelf.c 2017-12-12 16:36:21.806561149 +0000
+++ binutils-2.29.1/binutils/readelf.c 2017-12-12 16:38:17.763168514 +0000
@@ -11548,11 +11548,13 @@ process_symbol_table (FILE * file)
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
print_symbol (25, psym->st_name < strtab_size
@@ -11571,7 +11573,15 @@ process_symbol_table (FILE * file)
printf (sym_info == symbol_hidden ? "@%s" : "@@%s",
version_string);
}
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL

View File

@ -0,0 +1,314 @@
diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c
--- binutils.orig/bfd/elfxx-x86.c 2018-07-30 16:01:04.881710127 +0100
+++ binutils-2.30/bfd/elfxx-x86.c 2018-07-30 16:01:28.809447800 +0100
@@ -2320,13 +2320,34 @@ _bfd_x86_elf_merge_gnu_properties (struc
{
number = aprop->u.number;
aprop->u.number = number | bprop->u.number;
- updated = number != (unsigned int) aprop->u.number;
+ /* Remove the property if ISA bits are empty. */
+ if (aprop->u.number == 0)
+ {
+ aprop->pr_kind = property_remove;
+ updated = TRUE;
+ }
+ else
+ updated = number != (unsigned int) aprop->u.number;
}
else
{
- /* Return TRUE if APROP is NULL to indicate that BPROP should
- be added to ABFD. */
- updated = aprop == NULL;
+ /* Only one of APROP and BPROP can be NULL. */
+ if (aprop != NULL)
+ {
+ if (aprop->u.number == 0)
+ {
+ /* Remove APROP if ISA bits are empty. */
+ aprop->pr_kind = property_remove;
+ updated = TRUE;
+ }
+ }
+ else
+ {
+ /* Return TRUE if APROP is NULL and ISA bits of BPROP
+ aren't empty to indicate that BPROP should be added
+ to ABFD. */
+ updated = bprop->u.number != 0;
+ }
}
break;
diff -rup binutils.orig/ld/testsuite/ld-i386/i386.exp binutils-2.30/ld/testsuite/ld-i386/i386.exp
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2018-07-30 16:00:54.241826775 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/i386.exp 2018-07-30 16:02:58.911459984 +0100
@@ -450,6 +450,8 @@ run_dump_test "pr22115-1b"
run_dump_test "pr22115-1c"
run_dump_test "pr22115-1d"
run_dump_test "pr22135"
+run_dump_test "pr23372a"
+run_dump_test "pr23372b"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2018-07-30 16:00:55.340814726 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2018-07-30 16:03:32.624090383 +0100
@@ -379,6 +379,10 @@ run_dump_test "pr22115-1c-x32"
run_dump_test "pr22115-1d"
run_dump_test "pr22115-1d-x32"
run_dump_test "pr22135"
+run_dump_test "pr23372a"
+run_dump_test "pr23372a-x32"
+run_dump_test "pr23372b"
+run_dump_test "pr23372b-x32"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return
diff --git a/ld/testsuite/ld-i386/pr23372a.d b/ld/testsuite/ld-i386/pr23372a.d
new file mode 100644
index 0000000000..b75523bdc3
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23372a.d
@@ -0,0 +1,5 @@
+#source: pr23372a.s
+#source: pr23372b.s
+#as: --32
+#ld: -r -m elf_i386
+#readelf: -n
diff --git a/ld/testsuite/ld-i386/pr23372a.s b/ld/testsuite/ld-i386/pr23372a.s
new file mode 100644
index 0000000000..9849d620a1
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23372a.s
@@ -0,0 +1,18 @@
+ .section ".note.gnu.property", "a"
+ .p2align 2
+ .long 1f - 0f /* name length. */
+ .long 4f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+ .p2align 2
+ /* GNU_PROPERTY_X86_ISA_1_USED */
+ .long 0xc0000000 /* pr_type. */
+ .long 3f - 2f /* pr_datasz. */
+2:
+ .long 0x0
+3:
+ .p2align 2
+4:
diff --git a/ld/testsuite/ld-i386/pr23372b.d b/ld/testsuite/ld-i386/pr23372b.d
new file mode 100644
index 0000000000..a8e9c819a4
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23372b.d
@@ -0,0 +1,5 @@
+#source: pr23372a.s
+#source: pr23372c.s
+#as: --32
+#ld: -r -m elf_i386
+#readelf: -n
diff --git a/ld/testsuite/ld-i386/pr23372b.s b/ld/testsuite/ld-i386/pr23372b.s
new file mode 100644
index 0000000000..9849d620a1
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23372b.s
@@ -0,0 +1,18 @@
+ .section ".note.gnu.property", "a"
+ .p2align 2
+ .long 1f - 0f /* name length. */
+ .long 4f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+ .p2align 2
+ /* GNU_PROPERTY_X86_ISA_1_USED */
+ .long 0xc0000000 /* pr_type. */
+ .long 3f - 2f /* pr_datasz. */
+2:
+ .long 0x0
+3:
+ .p2align 2
+4:
diff --git a/ld/testsuite/ld-i386/pr23372c.s b/ld/testsuite/ld-i386/pr23372c.s
new file mode 100644
index 0000000000..3470dce649
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23372c.s
@@ -0,0 +1,18 @@
+ .section ".note.gnu.property", "a"
+ .p2align 2
+ .long 1f - 0f /* name length. */
+ .long 4f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+ .p2align 2
+ /* GNU_PROPERTY_X86_ISA_1_NEEDED */
+ .long 0xc0000001 /* pr_type. */
+ .long 3f - 2f /* pr_datasz. */
+2:
+ .long 0x0
+3:
+ .p2align 2
+4:
diff --git a/ld/testsuite/ld-x86-64/pr23372a-x32.d b/ld/testsuite/ld-x86-64/pr23372a-x32.d
new file mode 100644
index 0000000000..9f93642364
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr23372a-x32.d
@@ -0,0 +1,5 @@
+#source: pr23372a.s
+#source: pr23372b.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
diff --git a/ld/testsuite/ld-x86-64/pr23372a.d b/ld/testsuite/ld-x86-64/pr23372a.d
new file mode 100644
index 0000000000..ee688fc2e2
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr23372a.d
@@ -0,0 +1,5 @@
+#source: pr23372a.s
+#source: pr23372b.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -m elf_x86_64
+#readelf: -n
diff --git a/ld/testsuite/ld-x86-64/pr23372a.s b/ld/testsuite/ld-x86-64/pr23372a.s
new file mode 100644
index 0000000000..639fc26de4
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr23372a.s
@@ -0,0 +1,30 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length. */
+ .long 4f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ /* GNU_PROPERTY_X86_ISA_1_USED */
+ .long 0xc0000000 /* pr_type. */
+ .long 3f - 2f /* pr_datasz. */
+2:
+ .long 0x0
+3:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+4:
diff --git a/ld/testsuite/ld-x86-64/pr23372b-x32.d b/ld/testsuite/ld-x86-64/pr23372b-x32.d
new file mode 100644
index 0000000000..5b0cf98618
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr23372b-x32.d
@@ -0,0 +1,5 @@
+#source: pr23372a.s
+#source: pr23372c.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
diff --git a/ld/testsuite/ld-x86-64/pr23372b.d b/ld/testsuite/ld-x86-64/pr23372b.d
new file mode 100644
index 0000000000..727afa8ab5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr23372b.d
@@ -0,0 +1,5 @@
+#source: pr23372a.s
+#source: pr23372c.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -m elf_x86_64
+#readelf: -n
diff --git a/ld/testsuite/ld-x86-64/pr23372b.s b/ld/testsuite/ld-x86-64/pr23372b.s
new file mode 100644
index 0000000000..639fc26de4
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr23372b.s
@@ -0,0 +1,30 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length. */
+ .long 4f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ /* GNU_PROPERTY_X86_ISA_1_USED */
+ .long 0xc0000000 /* pr_type. */
+ .long 3f - 2f /* pr_datasz. */
+2:
+ .long 0x0
+3:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+4:
diff --git a/ld/testsuite/ld-x86-64/pr23372c.s b/ld/testsuite/ld-x86-64/pr23372c.s
new file mode 100644
index 0000000000..b4eaf69777
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr23372c.s
@@ -0,0 +1,30 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length. */
+ .long 4f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ /* GNU_PROPERTY_X86_ISA_1_NEEDED */
+ .long 0xc0000001 /* pr_type. */
+ .long 3f - 2f /* pr_datasz. */
+2:
+ .long 0x0
+3:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+4:

View File

@ -0,0 +1,749 @@
diff -rup binutils.orig/bfd/elf32-ppc.c binutils-2.30/bfd/elf32-ppc.c
--- binutils.orig/bfd/elf32-ppc.c 2018-02-08 10:49:07.649185371 +0000
+++ binutils-2.30/bfd/elf32-ppc.c 2018-02-08 10:50:11.058395459 +0000
@@ -69,7 +69,7 @@ static bfd_reloc_status_type ppc_elf_unh
/* For new-style .glink and .plt. */
#define GLINK_PLTRESOLVE 16*4
#define GLINK_ENTRY_SIZE(htab, h) \
- (((!htab->params->speculate_indirect_jumps ? 6*4 : 4*4) \
+ ((4*4 \
+ (h != NULL \
&& h == htab->tls_get_addr \
&& !htab->params->no_tls_get_addr_opt ? 8*4 : 0) \
@@ -155,8 +155,6 @@ static const bfd_vma ppc_elf_vxworks_pic
#define BA 0x48000002
#define BCL_20_31 0x429f0005
#define BCTR 0x4e800420
-#define CRSETEQ 0x4c421242
-#define BEQCTRM 0x4dc20420
#define BEQLR 0x4d820020
#define CMPWI_11_0 0x2c0b0000
#define LIS_11 0x3d600000
@@ -2880,14 +2878,15 @@ ppc_elf_final_write_processing (bfd *abf
static bfd_boolean
is_nonpic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
{
- bfd_byte buf[3 * 4];
+ bfd_byte buf[4 * 4];
if (!bfd_get_section_contents (abfd, glink, buf, off, sizeof buf))
return FALSE;
return ((bfd_get_32 (abfd, buf + 0) & 0xffff0000) == LIS_11
&& (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
- && bfd_get_32 (abfd, buf + 8) == MTCTR_11);
+ && bfd_get_32 (abfd, buf + 8) == MTCTR_11
+ && bfd_get_32 (abfd, buf + 12) == BCTR);
}
static bfd_boolean
@@ -3366,7 +3365,7 @@ ppc_elf_link_hash_table_create (bfd *abf
{
struct ppc_elf_link_hash_table *ret;
static struct ppc_elf_params default_params
- = { PLT_OLD, 0, 1, 0, 1, 0, 0, 12, 0, 0, 0 };
+ = { PLT_OLD, 0, 0, 1, 0, 0, 12, 0, 0, 0 };
ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table));
if (ret == NULL)
@@ -7171,8 +7170,6 @@ ppc_elf_relax_section (bfd *abfd,
size = 4 * ARRAY_SIZE (stub_entry);
insn_offset = 0;
}
- if (!htab->params->speculate_indirect_jumps)
- size += 8;
stub_rtype = R_PPC_RELAX;
if (tsec == htab->elf.splt
|| tsec == htab->glink)
@@ -7454,26 +7451,6 @@ elf_finish_pointer_linker_section (bfd *
#define PPC_HI(v) (((v) >> 16) & 0xffff)
#define PPC_HA(v) PPC_HI ((v) + 0x8000)
-static inline bfd_byte *
-output_bctr (struct ppc_elf_link_hash_table *htab, bfd *obfd, bfd_byte *p)
-{
- if (!htab->params->speculate_indirect_jumps)
- {
- bfd_put_32 (obfd, CRSETEQ, p);
- p += 4;
- bfd_put_32 (obfd, BEQCTRM, p);
- p += 4;
- bfd_put_32 (obfd, B, p);
- p += 4;
- }
- else
- {
- bfd_put_32 (obfd, BCTR, p);
- p += 4;
- }
- return p;
-}
-
static void
write_glink_stub (struct elf_link_hash_entry *h, struct plt_entry *ent,
asection *plt_sec, unsigned char *p,
@@ -7541,7 +7518,8 @@ write_glink_stub (struct elf_link_hash_e
p += 4;
bfd_put_32 (output_bfd, MTCTR_11, p);
p += 4;
- p = output_bctr (htab, output_bfd, p);
+ bfd_put_32 (output_bfd, BCTR, p);
+ p += 4;
while (p < end)
{
bfd_put_32 (output_bfd, htab->params->ppc476_workaround ? BA : NOP, p);
@@ -8979,7 +8957,6 @@ ppc_elf_relocate_section (bfd *output_bf
stub = stub_entry;
size = ARRAY_SIZE (stub_entry);
}
- --size;
relocation += addend;
if (bfd_link_relocatable (info))
@@ -9004,7 +8981,6 @@ ppc_elf_relocate_section (bfd *output_bf
bfd_put_32 (input_bfd, insn, contents + insn_offset);
insn_offset += 4;
}
- output_bctr (htab, input_bfd, contents + insn_offset);
/* Rewrite the reloc and convert one of the trailing nop
relocs to describe this relocation. */
@@ -10713,7 +10689,8 @@ ppc_elf_finish_dynamic_sections (bfd *ou
p += 4;
bfd_put_32 (output_bfd, ADD_11_0_11, p);
p += 4;
- p = output_bctr (htab, output_bfd, p);
+ bfd_put_32 (output_bfd, BCTR, p);
+ p += 4;
while (p < endp)
{
bfd_put_32 (output_bfd,
diff -rup binutils.orig/bfd/elf32-ppc.h binutils-2.30/bfd/elf32-ppc.h
--- binutils.orig/bfd/elf32-ppc.h 2018-02-08 10:49:07.644185433 +0000
+++ binutils-2.30/bfd/elf32-ppc.h 2018-02-08 10:50:11.058395459 +0000
@@ -35,9 +35,6 @@ struct ppc_elf_params
/* Set if individual PLT call stubs should be aligned. */
int plt_stub_align;
- /* Clear if PLT call stubs should use a speculative execution barrier. */
- int speculate_indirect_jumps;
-
/* Whether to emit symbols for stubs. */
int emit_stub_syms;
diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c
--- binutils.orig/bfd/elf64-ppc.c 2018-02-08 10:49:07.645185421 +0000
+++ binutils-2.30/bfd/elf64-ppc.c 2018-02-08 10:50:11.060395434 +0000
@@ -161,10 +161,6 @@ static bfd_vma opd_entry_value
#define LD_R11_0R11 0xe96b0000 /* ld %r11,xxx+16@l(%r11) */
#define BCTR 0x4e800420 /* bctr */
-#define CRSETEQ 0x4c421242 /* crset 4*%cr0+%eq */
-#define BEQCTRM 0x4dc20420 /* beqctr- */
-#define BEQCTRLM 0x4dc20421 /* beqctrl- */
-
#define ADDI_R11_R11 0x396b0000 /* addi %r11,%r11,off@l */
#define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */
#define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */
@@ -193,8 +189,7 @@ static bfd_vma opd_entry_value
/* __glink_PLTresolve stub instructions. We enter with the index in R0. */
#define GLINK_PLTRESOLVE_SIZE(htab) \
- (8u + (htab->opd_abi ? 11 * 4 : 14 * 4) \
- + (!htab->params->speculate_indirect_jumps ? 2 * 4 : 0))
+ (8u + (htab->opd_abi ? 11 * 4 : 14 * 4))
/* 0: */
/* .quad plt0-1f */
/* __glink: */
@@ -9886,8 +9881,6 @@ size_global_entry_stubs (struct elf_link
unsigned int align_power;
stub_size = 16;
- if (!htab->params->speculate_indirect_jumps)
- stub_size += 8;
stub_off = s->size;
if (htab->params->plt_stub_align >= 0)
align_power = htab->params->plt_stub_align;
@@ -10453,8 +10446,6 @@ plt_stub_size (struct ppc_link_hash_tabl
size += 4;
if (PPC_HA (off) != 0)
size += 4;
- if (!htab->params->speculate_indirect_jumps)
- size += 8;
if (htab->opd_abi)
{
size += 4;
@@ -10476,11 +10467,7 @@ plt_stub_size (struct ppc_link_hash_tabl
size += 7 * 4;
if (ALWAYS_EMIT_R2SAVE
|| stub_entry->stub_type == ppc_stub_plt_call_r2save)
- {
- size += 6 * 4;
- if (!htab->params->speculate_indirect_jumps)
- size -= 4;
- }
+ size += 6 * 4;
}
return size;
}
@@ -10515,26 +10502,6 @@ plt_stub_pad (struct ppc_link_hash_table
return 0;
}
-static inline bfd_byte *
-output_bctr (struct ppc_link_hash_table *htab, bfd *obfd, bfd_byte *p)
-{
- if (!htab->params->speculate_indirect_jumps)
- {
- bfd_put_32 (obfd, CRSETEQ, p);
- p += 4;
- bfd_put_32 (obfd, BEQCTRM, p);
- p += 4;
- bfd_put_32 (obfd, B_DOT, p);
- p += 4;
- }
- else
- {
- bfd_put_32 (obfd, BCTR, p);
- p += 4;
- }
- return p;
-}
-
/* Build a .plt call stub. */
static inline bfd_byte *
@@ -10555,7 +10522,6 @@ build_plt_stub (struct ppc_link_hash_tab
if (!ALWAYS_USE_FAKE_DEP
&& plt_load_toc
&& plt_thread_safe
- && htab->params->speculate_indirect_jumps
&& !((stub_entry->h == htab->tls_get_addr_fd
|| stub_entry->h == htab->tls_get_addr)
&& htab->params->tls_get_addr_opt))
@@ -10710,7 +10676,7 @@ build_plt_stub (struct ppc_link_hash_tab
bfd_put_32 (obfd, B_DOT | (cmp_branch_off & 0x3fffffc), p), p += 4;
}
else
- p = output_bctr (htab, obfd, p);
+ bfd_put_32 (obfd, BCTR, p), p += 4;
return p;
}
@@ -10754,13 +10720,7 @@ build_tls_get_addr_stub (struct ppc_link
if (r != NULL)
r[0].r_offset += 2 * 4;
p = build_plt_stub (htab, stub_entry, p, offset, r);
- if (!htab->params->speculate_indirect_jumps)
- {
- p -= 4;
- bfd_put_32 (obfd, BEQCTRLM, p - 4);
- }
- else
- bfd_put_32 (obfd, BCTRL, p - 4);
+ bfd_put_32 (obfd, BCTRL, p - 4);
bfd_put_32 (obfd, LD_R2_0R1 + STK_TOC (htab), p), p += 4;
bfd_put_32 (obfd, LD_R11_0R1 + STK_LINKER (htab), p), p += 4;
@@ -11113,7 +11073,8 @@ ppc_build_one_stub (struct bfd_hash_entr
p += 4;
bfd_put_32 (htab->params->stub_bfd, MTCTR_R12, p);
p += 4;
- p = output_bctr (htab, htab->params->stub_bfd, p);
+ bfd_put_32 (htab->params->stub_bfd, BCTR, p);
+ p += 4;
break;
case ppc_stub_plt_call:
@@ -11446,8 +11407,6 @@ ppc_size_one_stub (struct bfd_hash_entry
if (PPC_LO (r2off) != 0)
size += 4;
}
- if (!htab->params->speculate_indirect_jumps)
- size += 8;
}
else if (info->emitrelocations)
{
@@ -13089,7 +13048,7 @@ build_global_entry_stubs (struct elf_lin
p += 4;
bfd_put_32 (s->owner, MTCTR_R12, p);
p += 4;
- output_bctr (htab, s->owner, p);
+ bfd_put_32 (s->owner, BCTR, p);
break;
}
return TRUE;
@@ -13218,7 +13177,8 @@ ppc64_elf_build_stubs (struct bfd_link_i
bfd_put_32 (htab->glink->owner, LD_R11_0R11 | 8, p);
p += 4;
}
- p = output_bctr (htab, htab->glink->owner, p);
+ bfd_put_32 (htab->glink->owner, BCTR, p);
+ p += 4;
BFD_ASSERT (p == htab->glink->contents + GLINK_PLTRESOLVE_SIZE (htab));
/* Build the .glink lazy link call stubs. */
diff -rup binutils.orig/bfd/elf64-ppc.h binutils-2.30/bfd/elf64-ppc.h
--- binutils.orig/bfd/elf64-ppc.h 2018-02-08 10:49:07.637185520 +0000
+++ binutils-2.30/bfd/elf64-ppc.h 2018-02-08 10:50:11.060395434 +0000
@@ -51,9 +51,6 @@ struct ppc64_elf_params
/* Set if PLT call stubs for localentry:0 functions should omit r2 save. */
int plt_localentry0;
- /* Clear if PLT call stubs should use a speculative execution barrier. */
- int speculate_indirect_jumps;
-
/* Whether to canonicalize .opd so that there are no overlapping
.opd entries. */
int non_overlapping_opd;
diff -rup binutils.orig/gold/options.h binutils-2.30/gold/options.h
--- binutils.orig/gold/options.h 2018-02-08 10:49:07.354189045 +0000
+++ binutils-2.30/gold/options.h 2018-02-08 10:50:11.060395434 +0000
@@ -1108,10 +1108,6 @@ class General_options
N_("(PowerPC64 only) Optimize calls to ELFv2 localentry:0 functions"),
N_("(PowerPC64 only) Don't optimize ELFv2 calls"));
- DEFINE_bool(speculate_indirect_jumps, options::TWO_DASHES, '\0', true,
- N_("(PowerPC only) PLT call stubs without speculation barrier"),
- N_("(PowerPC only) PLT call stubs with speculation barrier"));
-
DEFINE_bool(plt_static_chain, options::TWO_DASHES, '\0', false,
N_("(PowerPC64 only) PLT call stubs should load r11"),
N_("(PowerPC64 only) PLT call stubs should not load r11"));
diff -rup binutils.orig/gold/powerpc.cc binutils-2.30/gold/powerpc.cc
--- binutils.orig/gold/powerpc.cc 2018-02-08 10:49:07.355189033 +0000
+++ binutils-2.30/gold/powerpc.cc 2018-02-08 10:50:11.061395422 +0000
@@ -3781,8 +3781,6 @@ static const uint32_t b = 0x48000000;
static const uint32_t bcl_20_31 = 0x429f0005;
static const uint32_t bctr = 0x4e800420;
static const uint32_t bctrl = 0x4e800421;
-static const uint32_t beqctrm = 0x4dc20420;
-static const uint32_t beqctrlm = 0x4dc20421;
static const uint32_t beqlr = 0x4d820020;
static const uint32_t blr = 0x4e800020;
static const uint32_t bnectr_p4 = 0x4ce20420;
@@ -3792,7 +3790,6 @@ static const uint32_t cmpdi_11_0 = 0x2c2
static const uint32_t cmpwi_11_0 = 0x2c0b0000;
static const uint32_t cror_15_15_15 = 0x4def7b82;
static const uint32_t cror_31_31_31 = 0x4ffffb82;
-static const uint32_t crseteq = 0x4c421242;
static const uint32_t ld_0_1 = 0xe8010000;
static const uint32_t ld_0_12 = 0xe80c0000;
static const uint32_t ld_2_1 = 0xe8410000;
@@ -4168,24 +4165,6 @@ write_insn(unsigned char* p, uint32_t v)
elfcpp::Swap<32, big_endian>::writeval(p, v);
}
-template<bool big_endian>
-static unsigned char*
-output_bctr(unsigned char* p)
-{
- if (!parameters->options().speculate_indirect_jumps())
- {
- write_insn<big_endian>(p, crseteq);
- p += 4;
- write_insn<big_endian>(p, beqctrm);
- p += 4;
- write_insn<big_endian>(p, b);
- }
- else
- write_insn<big_endian>(p, bctr);
- p += 4;
- return p;
-}
-
template<int size>
static inline unsigned int
param_plt_align()
@@ -4454,7 +4433,6 @@ class Stub_table : public Output_relaxed
{
const Symbol* gsym = p->first.sym_;
return (4 * 4
- + (!parameters->options().speculate_indirect_jumps() ? 2 * 4 : 0)
+ (this->targ_->is_tls_get_addr_opt(gsym) ? 8 * 4 : 0));
}
@@ -4470,8 +4448,6 @@ class Stub_table : public Output_relaxed
got_addr += ppcobj->toc_base_offset();
Address off = plt_addr - got_addr;
unsigned int bytes = 4 * 4 + 4 * (ha(off) != 0);
- if (!parameters->options().speculate_indirect_jumps())
- bytes += 2 * 4;
const Symbol* gsym = p->first.sym_;
if (this->targ_->is_tls_get_addr_opt(gsym))
bytes += 13 * 4;
@@ -4502,8 +4478,6 @@ class Stub_table : public Output_relaxed
if (p->first.dest_ - loc + (1 << 25) < 2 << 25)
return 4;
unsigned int bytes = 16;
- if (!parameters->options().speculate_indirect_jumps())
- bytes += 8;
if (size == 32 && parameters->options().output_is_position_independent())
bytes += 16;
return bytes;
@@ -4955,8 +4929,7 @@ class Output_data_glink : public Output_
{
if (size == 64)
return (8
- + (this->targ_->abiversion() < 2 ? 11 * 4 : 14 * 4)
- + (!parameters->options().speculate_indirect_jumps() ? 2 * 4 : 0));
+ + (this->targ_->abiversion() < 2 ? 11 * 4 : 14 * 4));
return 16 * 4;
}
@@ -5033,8 +5006,7 @@ Output_data_glink<size, big_endian>::add
std::pair<typename Global_entry_stub_entries::iterator, bool> p
= this->global_entry_stubs_.insert(std::make_pair(gsym, off));
if (p.second)
- this->ge_size_
- = off + 16 + (!parameters->options().speculate_indirect_jumps() ? 8 : 0);
+ this->ge_size_ = off + 16;
}
template<int size, bool big_endian>
@@ -5223,10 +5195,7 @@ Stub_table<size, big_endian>::do_write(O
= plt_load_toc && this->targ_->plt_thread_safe();
bool use_fake_dep = false;
Address cmp_branch_off = 0;
- if (thread_safe
- && !parameters->options().speculate_indirect_jumps())
- use_fake_dep = true;
- else if (thread_safe)
+ if (thread_safe)
{
unsigned int pltindex
= ((pltoff - this->targ_->first_plt_entry_offset())
@@ -5274,7 +5243,7 @@ Stub_table<size, big_endian>::do_write(O
+ this->targ_->stk_linker()));
p += 4;
}
- use_fake_dep |= thread_safe;
+ use_fake_dep = thread_safe;
}
if (ha(off) != 0)
{
@@ -5365,14 +5334,7 @@ Stub_table<size, big_endian>::do_write(O
if (!cs->second.localentry0_
&& this->targ_->is_tls_get_addr_opt(gsym))
{
- if (!parameters->options().speculate_indirect_jumps())
- {
- write_insn<big_endian>(p, crseteq);
- p += 4;
- write_insn<big_endian>(p, beqctrlm);
- }
- else
- write_insn<big_endian>(p, bctrl);
+ write_insn<big_endian>(p, bctrl);
p += 4;
write_insn<big_endian>(p, ld_2_1 + this->targ_->stk_toc());
p += 4;
@@ -5391,7 +5353,7 @@ Stub_table<size, big_endian>::do_write(O
write_insn<big_endian>(p, b | (cmp_branch_off & 0x3fffffc));
}
else
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
@@ -5426,7 +5388,7 @@ Stub_table<size, big_endian>::do_write(O
write_insn<big_endian>(p, ld_12_12 + l(brltoff)), p += 4;
}
write_insn<big_endian>(p, mtctr_12), p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
}
@@ -5522,7 +5484,7 @@ Stub_table<size, big_endian>::do_write(O
p += 4;
write_insn<big_endian>(p, mtctr_11);
p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
@@ -5563,7 +5525,7 @@ Stub_table<size, big_endian>::do_write(O
p += 4;
write_insn<big_endian>(p, mtctr_12);
p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
if (this->need_save_res_)
@@ -5630,7 +5592,7 @@ Output_data_glink<size, big_endian>::do_
write_insn<big_endian>(p, mtctr_12), p += 4;
write_insn<big_endian>(p, ld_11_11 + 8), p += 4;
}
- p = output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr), p += 4;
gold_assert(p == oview + this->pltresolve_size());
// Write lazy link call stubs.
@@ -5686,7 +5648,7 @@ Output_data_glink<size, big_endian>::do_
write_insn<big_endian>(p, addis_12_12 + ha(off)), p += 4;
write_insn<big_endian>(p, ld_12_12 + l(off)), p += 4;
write_insn<big_endian>(p, mtctr_12), p += 4;
- output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
}
}
else
@@ -5778,7 +5740,8 @@ Output_data_glink<size, big_endian>::do_
write_insn<big_endian>(p, add_11_0_11);
}
p += 4;
- p = output_bctr<big_endian>(p);
+ write_insn<big_endian>(p, bctr);
+ p += 4;
while (p < end_p)
{
write_insn<big_endian>(p, nop);
diff -rup binutils.orig/ld/emultempl/ppc32elf.em binutils-2.30/ld/emultempl/ppc32elf.em
--- binutils.orig/ld/emultempl/ppc32elf.em 2018-02-08 10:49:07.192191063 +0000
+++ binutils-2.30/ld/emultempl/ppc32elf.em 2018-02-08 10:50:11.062395410 +0000
@@ -38,7 +38,7 @@ static int notlsopt = 0;
/* Choose the correct place for .got. */
static int old_got = 0;
-static struct ppc_elf_params params = { PLT_UNSET, 0, 1, -1,
+static struct ppc_elf_params params = { PLT_UNSET, 0, -1,
0, 0, 0, 0, 0, 0, 0 };
static void
@@ -246,8 +246,6 @@ enum ppc32_opt
OPTION_NO_TLS_GET_ADDR_OPT,
OPTION_NEW_PLT,
OPTION_OLD_PLT,
- OPTION_SPECULATE_INDIRECT_JUMPS,
- OPTION_NO_SPECULATE_INDIRECT_JUMPS,
OPTION_PLT_ALIGN,
OPTION_NO_PLT_ALIGN,
OPTION_OLD_GOT,
@@ -269,8 +267,6 @@ if test -z "$VXWORKS_BASE_EM_FILE" ; the
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
{ "secure-plt", no_argument, NULL, OPTION_NEW_PLT },
{ "bss-plt", no_argument, NULL, OPTION_OLD_PLT },
- { "speculate-indirect-jumps", no_argument, NULL, OPTION_SPECULATE_INDIRECT_JUMPS },
- { "no-speculate-indirect-jumps", no_argument, NULL, OPTION_NO_SPECULATE_INDIRECT_JUMPS },
{ "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN },
{ "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN },
{ "sdata-got", no_argument, NULL, OPTION_OLD_GOT },'
@@ -304,12 +300,6 @@ if test -z "$VXWORKS_BASE_EM_FILE" ; the
--bss-plt Force old-style BSS PLT.\n"
));
fprintf (file, _("\
- --speculate-indirect-jumps PLT call stubs without speculation barrier.\n"
- ));
- fprintf (file, _("\
- --no-speculate-indirect-jumps PLT call stubs with speculation barrier.\n"
- ));
- fprintf (file, _("\
--plt-align Align PLT call stubs to fit cache lines.\n"
));
fprintf (file, _("\
@@ -360,14 +350,6 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI
params.plt_style = PLT_OLD;
break;
- case OPTION_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 1;
- break;
-
- case OPTION_NO_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 0;
- break;
-
case OPTION_PLT_ALIGN:
if (optarg != NULL)
{
diff -rup binutils.orig/ld/emultempl/ppc64elf.em binutils-2.30/ld/emultempl/ppc64elf.em
--- binutils.orig/ld/emultempl/ppc64elf.em 2018-02-08 10:49:07.192191063 +0000
+++ binutils-2.30/ld/emultempl/ppc64elf.em 2018-02-08 10:50:11.062395410 +0000
@@ -38,7 +38,7 @@ static struct ppc64_elf_params params =
&ppc_layout_sections_again,
1, -1, 0,
${DEFAULT_PLT_STATIC_CHAIN-0}, -1, 5,
- -1, 1, 0, -1, -1, 0};
+ -1, 0, -1, -1, 0};
/* Fake input file for stubs. */
static lang_input_statement_type *stub_file;
@@ -692,8 +692,6 @@ enum ppc64_opt
OPTION_NO_PLT_STATIC_CHAIN,
OPTION_PLT_THREAD_SAFE,
OPTION_NO_PLT_THREAD_SAFE,
- OPTION_SPECULATE_INDIRECT_JUMPS,
- OPTION_NO_SPECULATE_INDIRECT_JUMPS,
OPTION_PLT_ALIGN,
OPTION_NO_PLT_ALIGN,
OPTION_PLT_LOCALENTRY,
@@ -721,8 +719,6 @@ PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST
{ "no-plt-static-chain", no_argument, NULL, OPTION_NO_PLT_STATIC_CHAIN },
{ "plt-thread-safe", no_argument, NULL, OPTION_PLT_THREAD_SAFE },
{ "no-plt-thread-safe", no_argument, NULL, OPTION_NO_PLT_THREAD_SAFE },
- { "speculate-indirect-jumps", no_argument, NULL, OPTION_SPECULATE_INDIRECT_JUMPS },
- { "no-speculate-indirect-jumps", no_argument, NULL, OPTION_NO_SPECULATE_INDIRECT_JUMPS },
{ "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN },
{ "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN },
{ "plt-localentry", optional_argument, NULL, OPTION_PLT_LOCALENTRY },
@@ -764,13 +760,7 @@ PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_
--plt-thread-safe PLT call stubs with load-load barrier.\n"
));
fprintf (file, _("\
- --no-plt-thread-safe PLT call stubs without load-load barrier.\n"
- ));
- fprintf (file, _("\
- --speculate-indirect-jumps PLT call stubs without speculation barrier.\n"
- ));
- fprintf (file, _("\
- --no-speculate-indirect-jumps PLT call stubs with speculation barrier.\n"
+ --no-plt-thread-safe PLT call stubs without barrier.\n"
));
fprintf (file, _("\
--plt-align [=<align>] Align PLT call stubs to fit cache lines.\n"
@@ -860,14 +850,6 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI
params.plt_thread_safe = 0;
break;
- case OPTION_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 1;
- break;
-
- case OPTION_NO_SPECULATE_INDIRECT_JUMPS:
- params.speculate_indirect_jumps = 0;
- break;
-
case OPTION_PLT_ALIGN:
if (optarg != NULL)
{
diff -rup binutils.orig/ld/ld.texinfo binutils-2.30/ld/ld.texinfo
--- binutils.orig/ld/ld.texinfo 2018-02-08 10:49:07.203190926 +0000
+++ binutils-2.30/ld/ld.texinfo 2018-02-08 10:50:11.063395397 +0000
@@ -7646,15 +7646,6 @@ looks for calls to commonly used functio
seen, adds the necessary barriers. Use these options to change the
default behaviour.
-@cindex PowerPC64 PLT call stub speculative execution barrier
-@kindex --speculate-indirect-jumps
-@kindex --no-speculate-indirect-jumps
-@item --speculate-indirect-jumps
-@itemx --no-speculate-indirect-jumps
-Use these options to control whether all indirect branch instructions
-emitted by @code{ld}, such as those in the PLT, have a speculative
-execution barrier to mitigate Spectre variant 2 attacks.
-
@cindex PowerPC64 ELFv2 PLT localentry optimization
@kindex --plt-localentry
@kindex --no-plt-localentry
diff -rup binutils.orig/ld/testsuite/ld-powerpc/elfv2exe.d binutils-2.30/ld/testsuite/ld-powerpc/elfv2exe.d
--- binutils.orig/ld/testsuite/ld-powerpc/elfv2exe.d 2018-02-08 10:49:07.261190203 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/elfv2exe.d 2018-02-08 10:50:11.063395397 +0000
@@ -1,6 +1,6 @@
#source: elfv2.s
#as: -a64
-#ld: -melf64ppc --speculate-indirect-jumps --defsym f2=0x1234 --defsym f3=0x10008888 --defsym f4=0x1200000 --defsym _start=f1
+#ld: -melf64ppc --defsym f2=0x1234 --defsym f3=0x10008888 --defsym f4=0x1200000 --defsym _start=f1
#objdump: -dr
.*
diff -rup binutils.orig/ld/testsuite/ld-powerpc/elfv2so.d binutils-2.30/ld/testsuite/ld-powerpc/elfv2so.d
--- binutils.orig/ld/testsuite/ld-powerpc/elfv2so.d 2018-02-08 10:49:07.264190166 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/elfv2so.d 2018-02-08 10:50:11.063395397 +0000
@@ -1,6 +1,6 @@
#source: elfv2.s
#as: -a64
-#ld: -melf64ppc -shared --speculate-indirect-jumps
+#ld: -melf64ppc -shared
#objdump: -dr
.*
diff -rup binutils.orig/ld/testsuite/ld-powerpc/powerpc.exp binutils-2.30/ld/testsuite/ld-powerpc/powerpc.exp
--- binutils.orig/ld/testsuite/ld-powerpc/powerpc.exp 2018-02-08 10:49:07.261190203 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/powerpc.exp 2018-02-08 10:50:11.063395397 +0000
@@ -121,11 +121,11 @@ set ppcelftests {
"tls32"}
{"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" "" {}
{} "libtlslib32.so"}
- {"TLS32 dynamic exec" "-melf32ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {}
+ {"TLS32 dynamic exec" "-melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {}
{{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
{objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
"tlsexe32"}
- {"TLS32 shared" "-shared -melf32ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {}
+ {"TLS32 shared" "-shared -melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {}
{{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
{objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
"tls32.so"}
@@ -147,7 +147,7 @@ set ppcelftests {
{"TLS32 DLL" "-shared -melf32ppc --version-script tlsdll.ver" ""
"-a32" {tlsdll_32.s}
{} "tlsdll32.so"}
- {"TLS32 opt 5" "-melf32ppc -shared --gc-sections --secure-plt --no-plt-align --speculate-indirect-jumps tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s}
+ {"TLS32 opt 5" "-melf32ppc -shared --gc-sections --secure-plt --no-plt-align tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s}
{{objdump -dr tlsopt5_32.d}}
"tlsopt5_32"}
{"Shared library with global symbol" "-shared -melf32ppc" "" "-a32" {sdalib.s}
@@ -174,15 +174,15 @@ set ppc64elftests {
{} "libtlslib.so"}
{"TLS helper old shared lib" "-shared -melf64ppc" "" "-a64" {oldtlslib.s}
{} "liboldlib.so"}
- {"TLS dynamic exec" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/libtlslib.so" "" "" {}
+ {"TLS dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/libtlslib.so" "" "" {}
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
"tlsexe"}
- {"TLS dynamic old" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/liboldlib.so" "" "" {}
+ {"TLS dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/liboldlib.so" "" "" {}
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
"tlsexeold"}
- {"TLS shared" "-shared -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {}
+ {"TLS shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {}
{{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
{objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
"tls.so"}
@@ -190,17 +190,17 @@ set ppc64elftests {
{{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
{objdump -sj.tdata tlstoc.t}}
"tlstoc"}
- {"TLSTOC dynamic exec" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/libtlslib.so" ""
+ {"TLSTOC dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/libtlslib.so" ""
"" {}
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
"tlsexetoc"}
- {"TLSTOC dynamic old" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/liboldlib.so" ""
+ {"TLSTOC dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/liboldlib.so" ""
"" {}
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
"tlsexetocold"}
- {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {}
+ {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {}
{{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
{objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
"tlstoc.so"}
@@ -221,7 +221,7 @@ set ppc64elftests {
"tlsopt4"}
{"TLS DLL" "-shared -melf64ppc --version-script tlsdll.ver" "" "-a64" {tlsdll.s}
{} "tlsdll.so"}
- {"TLS opt 5" "-melf64ppc --no-plt-align --speculate-indirect-jumps -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
+ {"TLS opt 5" "-melf64ppc --no-plt-align -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
{{objdump -dr tlsopt5.d} {readelf -wf tlsopt5.wf}}
"tlsopt5"}
{"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s}
diff -rup binutils.orig/ld/testsuite/ld-powerpc/relbrlt.d binutils-2.30/ld/testsuite/ld-powerpc/relbrlt.d
--- binutils.orig/ld/testsuite/ld-powerpc/relbrlt.d 2018-02-08 10:49:07.262190191 +0000
+++ binutils-2.30/ld/testsuite/ld-powerpc/relbrlt.d 2018-02-08 10:50:11.063395397 +0000
@@ -1,6 +1,6 @@
#source: relbrlt.s
#as: -a64
-#ld: -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --emit-relocs
+#ld: -melf64ppc --no-plt-align --no-ld-generated-unwind-info --emit-relocs
#objdump: -Dr
.*

View File

@ -0,0 +1,150 @@
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z13.d binutils-2.30/gas/testsuite/gas/s390/zarch-z13.d
--- binutils.orig/gas/testsuite/gas/s390/zarch-z13.d 2020-06-24 16:02:24.228446160 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z13.d 2020-06-24 16:02:35.952409554 +0100
@@ -17,7 +17,6 @@ Disassembly of section .text:
.*: e7 f0 fd fc 10 46 [ ]*vgmh %v15,253,252
.*: e7 f0 fd fc 20 46 [ ]*vgmf %v15,253,252
.*: e7 f0 fd fc 30 46 [ ]*vgmg %v15,253,252
-.*: e7 f6 9f a0 00 06 [ ]*vl %v15,4000\(%r6,%r9\)
.*: e7 f1 00 00 04 56 [ ]*vlr %v15,%v17
.*: e7 f6 9f a0 d0 05 [ ]*vlrep %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 00 05 [ ]*vlrepb %v15,4000\(%r6,%r9\)
@@ -42,7 +41,6 @@ Disassembly of section .text:
.*: e7 f6 9f a0 10 04 [ ]*vllezh %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 20 04 [ ]*vllezf %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 30 04 [ ]*vllezg %v15,4000\(%r6,%r9\)
-.*: e7 f1 6f a0 04 36 [ ]*vlm %v15,%v17,4000\(%r6\)
.*: e7 f6 9f a0 d0 07 [ ]*vlbb %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 22 [ ]*vlvg %v15,%r6,4000\(%r9\),13
.*: e7 f6 9f a0 00 22 [ ]*vlvgb %v15,%r6,4000\(%r9\)
@@ -98,12 +96,10 @@ Disassembly of section .text:
.*: e7 f1 00 00 04 5f [ ]*vsegb %v15,%v17
.*: e7 f1 00 00 14 5f [ ]*vsegh %v15,%v17
.*: e7 f1 00 00 24 5f [ ]*vsegf %v15,%v17
-.*: e7 f6 9f a0 00 0e [ ]*vst %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 d0 08 [ ]*vsteb %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 09 [ ]*vsteh %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 0b [ ]*vstef %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 0a [ ]*vsteg %v15,4000\(%r6,%r9\),13
-.*: e7 f1 6f a0 04 3e [ ]*vstm %v15,%v17,4000\(%r6\)
.*: e7 f6 9f a0 00 3f [ ]*vstl %v15,%r6,4000\(%r9\)
.*: e7 f1 00 00 d4 d7 [ ]*vuph %v15,%v17,13
.*: e7 f1 00 00 04 d7 [ ]*vuphb %v15,%v17
@@ -680,3 +676,11 @@ Disassembly of section .text:
.*: e3 69 b8 f0 fd 3b [ ]*lzrf %r6,-10000\(%r9,%r11\)
.*: e3 69 b8 f0 fd 2a [ ]*lzrg %r6,-10000\(%r9,%r11\)
.*: b9 3c 00 69 [ ]*prno %r6,%r9
+.*: e7 f6 9f a0 00 06 [ ]*vl %v15,4000\(%r6,%r9\)
+.*: e7 f6 9f a0 d0 06 [ ]*vl %v15,4000\(%r6,%r9\),13
+.*: e7 f1 6f a0 04 36 [ ]*vlm %v15,%v17,4000\(%r6\)
+.*: e7 f1 6f a0 d4 36 [ ]*vlm %v15,%v17,4000\(%r6\),13
+.*: e7 f6 9f a0 00 0e [ ]*vst %v15,4000\(%r6,%r9\)
+.*: e7 f6 9f a0 d0 0e [ ]*vst %v15,4000\(%r6,%r9\),13
+.*: e7 f1 6f a0 04 3e [ ]*vstm %v15,%v17,4000\(%r6\)
+.*: e7 f1 6f a0 d4 3e [ ]*vstm %v15,%v17,4000\(%r6\),13
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z13.s binutils-2.30/gas/testsuite/gas/s390/zarch-z13.s
--- binutils.orig/gas/testsuite/gas/s390/zarch-z13.s 2020-06-24 16:02:24.227446163 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z13.s 2020-06-24 16:02:35.952409554 +0100
@@ -11,7 +11,6 @@ foo:
vgmh %v15,253,252
vgmf %v15,253,252
vgmg %v15,253,252
- vl %v15,4000(%r6,%r9)
vlr %v15,%v17
vlrep %v15,4000(%r6,%r9),13
vlrepb %v15,4000(%r6,%r9)
@@ -36,7 +35,6 @@ foo:
vllezh %v15,4000(%r6,%r9)
vllezf %v15,4000(%r6,%r9)
vllezg %v15,4000(%r6,%r9)
- vlm %v15,%v17,4000(%r6)
vlbb %v15,4000(%r6,%r9),13
vlvg %v15,%r6,4000(%r9),13
vlvgb %v15,%r6,4000(%r9)
@@ -92,12 +90,10 @@ foo:
vsegb %v15,%v17
vsegh %v15,%v17
vsegf %v15,%v17
- vst %v15,4000(%r6,%r9)
vsteb %v15,4000(%r6,%r9),13
vsteh %v15,4000(%r6,%r9),13
vstef %v15,4000(%r6,%r9),13
vsteg %v15,4000(%r6,%r9),13
- vstm %v15,%v17,4000(%r6)
vstl %v15,%r6,4000(%r9)
vuph %v15,%v17,13
vuphb %v15,%v17
@@ -674,3 +670,11 @@ foo:
lzrf %r6,-10000(%r9,%r11)
lzrg %r6,-10000(%r9,%r11)
ppno %r6,%r9
+ vl %v15,4000(%r6,%r9)
+ vl %v15,4000(%r6,%r9),13
+ vlm %v15,%v17,4000(%r6)
+ vlm %v15,%v17,4000(%r6),13
+ vst %v15,4000(%r6,%r9)
+ vst %v15,4000(%r6,%r9),13
+ vstm %v15,%v17,4000(%r6)
+ vstm %v15,%v17,4000(%r6),13
diff -rup binutils.orig/opcodes/s390-opc.txt binutils-2.30/opcodes/s390-opc.txt
--- binutils.orig/opcodes/s390-opc.txt 2020-06-24 16:02:23.965446981 +0100
+++ binutils-2.30/opcodes/s390-opc.txt 2020-06-24 16:02:35.953409551 +0100
@@ -1159,7 +1159,6 @@ e70000000046 vgmb VRI_V0UU "vector gener
e70000001046 vgmh VRI_V0UU "vector generate mask halfword" z13 zarch vx
e70000002046 vgmf VRI_V0UU "vector generate mask word" z13 zarch vx
e70000003046 vgmg VRI_V0UU "vector generate mask double word" z13 zarch vx
-e70000000006 vl VRX_VRRD "vector memory load" z13 zarch vx
e70000000056 vlr VRX_VV "vector register load" z13 zarch vx
e70000000005 vlrep VRX_VRRDU "vector load and replicate" z13 zarch vx
e70000000005 vlrepb VRX_VRRD "vector load and replicate byte elements" z13 zarch vx
@@ -1184,7 +1183,6 @@ e70000000004 vllezb VRX_VRRD "vector loa
e70000001004 vllezh VRX_VRRD "vector load logical halfword element and zero" z13 zarch vx
e70000002004 vllezf VRX_VRRD "vector load logical word element and zero" z13 zarch vx
e70000003004 vllezg VRX_VRRD "vector load logical double word element and zero" z13 zarch vx
-e70000000036 vlm VRS_VVRD "vector load multiple" z13 zarch vx
e70000000007 vlbb VRX_VRRDU "vector load to block boundary" z13 zarch vx
e70000000022 vlvg VRS_VRRDU "vector load VR element from GR" z13 zarch vx
e70000000022 vlvgb VRS_VRRD "vector load VR byte element from GR" z13 zarch vx
@@ -1240,12 +1238,10 @@ e7000000005f vseg VRR_VV0U "vector sign
e7000000005f vsegb VRR_VV "vector sign extend byte to double word" z13 zarch vx
e7000000105f vsegh VRR_VV "vector sign extend halfword to double word" z13 zarch vx
e7000000205f vsegf VRR_VV "vector sign extend word to double word" z13 zarch vx
-e7000000000e vst VRX_VRRD "vector store" z13 zarch vx
e70000000008 vsteb VRX_VRRDU "vector store byte element" z13 zarch vx
e70000000009 vsteh VRX_VRRDU "vector store halfword element" z13 zarch vx
e7000000000b vstef VRX_VRRDU "vector store word element" z13 zarch vx
e7000000000a vsteg VRX_VRRDU "vector store double word element" z13 zarch vx
-e7000000003e vstm VRS_VVRD "vector store multiple" z13 zarch vx
e7000000003f vstl VRS_VRRD "vector store with length" z13 zarch vx
e700000000d7 vuph VRR_VV0U "vector unpack high" z13 zarch vx
e700000000d7 vuphb VRR_VV "vector unpack high byte" z13 zarch vx
@@ -1680,6 +1676,13 @@ e3000000003b lzrf RXY_RRRD "load and zer
e3000000002a lzrg RXY_RRRD "load and zero rightmost byte 64->64" z13 zarch
b93c ppno RRE_RR "perform pseudorandom number operation" z13 zarch
+# Aligned vector store hints
+
+e70000000006 vl VRX_VRRDU "vector memory load" z13 zarch optparm,vx
+e70000000036 vlm VRS_VVRDU "vector load multiple" z13 zarch optparm,vx
+e7000000000e vst VRX_VRRDU "vector store" z13 zarch optparm,vx
+e7000000003e vstm VRS_VVRDU "vector store multiple" z13 zarch optparm,vx
+
# arch12 instructions
# Vector Enhancements Facility 1
@@ -1882,14 +1885,6 @@ b9a1 tpei RRE_RR "test pending external
b9ac irbm RRE_RR "insert reference bits multiple" arch12 zarch
-# Aligned vector store hints
-
-e70000000006 vl VRX_VRRDU "vector memory load" arch12 zarch optparm
-e70000000036 vlm VRS_VVRDU "vector load multiple" arch12 zarch optparm
-e7000000000e vst VRX_VRRDU "vector store" arch12 zarch optparm
-e7000000003e vstm VRS_VVRDU "vector store multiple" arch12 zarch optparm
-
-
# arch13 instructions
Only in binutils-2.30/opcodes: s390-opc.txt.orig

View File

@ -0,0 +1,410 @@
diff -rup binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp
--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 13:46:34.057525248 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 14:06:44.964203913 +0100
@@ -315,7 +315,6 @@ proc visibility_run {visibility} {
&& ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "hidden_undef_def" ]
&& ![ string match $visibility "protected_undef" ] } {
- setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "sparc*-*-linux*"
}
@@ -353,7 +352,6 @@ proc visibility_run {visibility} {
|| [ string match $visibility "protected_weak" ]
|| [ string match $visibility "normal" ] } {
setup_xfail "powerpc-*-linux*"
- setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "sparc*-*-linux*"
}
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-04-06 14:10:02.634343536 +0100
@@ -222,7 +222,7 @@ if { [at_least_gcc_version 4 7] } {
"" "-flto -O2" \
{pr12942a.cc pr12942c.cc} {} "" "c++"] \
[list "Compile PR ld/12942 (2)" \
- "" "-O0" \
+ "" "-O2" \
{pr12942b.cc} {} "" "c++"] \
]]
}
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 14:22:06.280196979 +0100
@@ -34,5 +34,4 @@ hook called: claim_file tmpdir/libtext.a
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 14:22:24.789116715 +0100
@@ -38,5 +38,4 @@ hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.30/ld/testsuite/ld-plugin/plugin-12.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-12.d 2020-04-06 14:21:20.373396053 +0100
@@ -1,5 +1,5 @@
#...
-.*: symbol `.*unc' definition: 0, visibility: 0, resolution: 2
+.*: symbol `.*unc' definition: 0, visibility: 0, resolution: .
.*: symbol `.*unc1' definition: 0, visibility: 1, resolution: 3
.*: symbol `.*unc2' definition: 0, visibility: 2, resolution: 3
.*: symbol `.*unc3' definition: 0, visibility: 3, resolution: 3
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-13.d binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 14:17:17.134452335 +0100
@@ -23,5 +23,4 @@ hook called: claim_file tmpdir/main.o \[
hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
-.*main.c.*: undefined reference to `\.?func'
-#...
+
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-14.d binutils-2.30/ld/testsuite/ld-plugin/plugin-14.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-14.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-14.d 2020-04-06 14:17:47.544319974 +0100
@@ -27,7 +27,4 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-15.d binutils-2.30/ld/testsuite/ld-plugin/plugin-15.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-15.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-15.d 2020-04-06 14:18:24.091160900 +0100
@@ -28,7 +28,4 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 14:18:50.780044764 +0100
@@ -32,7 +32,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 14:19:16.601932787 +0100
@@ -33,5 +33,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.30/ld/testsuite/ld-plugin/plugin-18.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-18.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-18.d 2020-04-06 14:23:32.887821405 +0100
@@ -32,7 +32,6 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-19.d binutils-2.30/ld/testsuite/ld-plugin/plugin-19.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-19.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-19.d 2020-04-06 14:24:41.828522444 +0100
@@ -35,8 +35,7 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
-hook called: cleanup.
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-20.d binutils-2.30/ld/testsuite/ld-plugin/plugin-20.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-20.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-20.d 2020-04-06 14:26:04.548163731 +0100
@@ -2,6 +2,5 @@ hook called: all symbols read.
Input: func.c \(tmpdir/libfunc.a\)
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
+
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-21.d binutils-2.30/ld/testsuite/ld-plugin/plugin-21.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-21.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-21.d 2020-04-06 14:26:21.497090232 +0100
@@ -2,6 +2,4 @@ hook called: all symbols read.
Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\)
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-22.d binutils-2.30/ld/testsuite/ld-plugin/plugin-22.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-22.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-22.d 2020-04-06 14:27:04.766902593 +0100
@@ -2,6 +2,5 @@ Claimed: tmpdir/libfunc.a \[@.*
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
+
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-23.d binutils-2.30/ld/testsuite/ld-plugin/plugin-23.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-23.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-23.d 2020-04-06 14:27:21.482830104 +0100
@@ -2,6 +2,4 @@ Claimed: .*/ld/testsuite/ld-plugin/func.
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-24.d binutils-2.30/ld/testsuite/ld-plugin/plugin-24.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-24.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-24.d 2020-04-06 14:26:45.650985489 +0100
@@ -2,4 +2,4 @@ hook called: all symbols read.
Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\)
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-hook called: cleanup.
+#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-25.d binutils-2.30/ld/testsuite/ld-plugin/plugin-25.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-25.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-25.d 2020-04-06 14:27:37.112762325 +0100
@@ -2,4 +2,4 @@ Claimed: .*/ld/testsuite/ld-plugin/func.
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-hook called: cleanup.
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-28.d binutils-2.30/ld/testsuite/ld-plugin/plugin-28.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-28.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-28.d 2020-04-06 14:19:48.822793062 +0100
@@ -1 +1,2 @@
.*: error: Error
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-29.d binutils-2.30/ld/testsuite/ld-plugin/plugin-29.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-29.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-29.d 2020-04-06 14:20:03.559729155 +0100
@@ -1 +1,2 @@
.*: warning: Warning
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-30.d binutils-2.30/ld/testsuite/ld-plugin/plugin-30.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-30.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-30.d 2020-04-06 14:25:11.872392159 +0100
@@ -24,3 +24,4 @@ hook called: claim_file tmpdir/main.o \[
hook called: claim_file tmpdir/func.o \[@0/.* not claimed
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
hook called: claim_file tmpdir/libempty.a \[@.* not claimed
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-6.d binutils-2.30/ld/testsuite/ld-plugin/plugin-6.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-6.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-6.d 2020-04-06 14:13:00.297570240 +0100
@@ -27,7 +27,4 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-7.d binutils-2.30/ld/testsuite/ld-plugin/plugin-7.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-7.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-7.d 2020-04-06 14:13:51.209348643 +0100
@@ -28,7 +28,4 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 14:14:12.827254549 +0100
@@ -32,7 +32,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 14:16:35.548633342 +0100
@@ -33,5 +33,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/pr20070.d binutils-2.30/ld/testsuite/ld-plugin/pr20070.d
--- binutils.orig/ld/testsuite/ld-plugin/pr20070.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/pr20070.d 2020-04-06 14:28:01.634655986 +0100
@@ -5,5 +5,4 @@ Sym: 'weakdef' Resolution: LDPR_PREVAILI
Sym: 'undef' Resolution: LDPR_UNDEF
Sym: 'weakundef' Resolution: LDPR_UNDEF
Sym: 'common' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp
--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 15:33:40.650512019 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 15:40:03.806845232 +0100
@@ -323,6 +323,7 @@ proc visibility_run {visibility} {
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
+ setup_xfail "s390x-*-linux*"
if { ![istarget hppa*64*-*-linux*] } {
setup_xfail "hppa*-*-linux*"
}
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-04-06 15:41:32.348460063 +0100
@@ -538,6 +538,7 @@ if { [at_least_gcc_version 4 7] } {
]
}
set testname "PR ld/12942 (3)"
+ setup_xfail "*-*-*"
set exec_output [run_host_cmd "$CXX" "-O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"]
if { [ regexp "undefined reference to `\\.?link_error\\(\\)'" $exec_output ] } {
pass $testname
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 15:33:40.656511992 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 15:47:31.619894007 +0100
@@ -32,6 +32,6 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 15:48:31.738631248 +0100
@@ -35,7 +35,7 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-13.d binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 15:43:46.962874471 +0100
@@ -22,5 +22,4 @@ Hello from testplugin.
hook called: claim_file tmpdir/main.o \[@0/.* not claimed
hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
-#...
-
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 15:44:31.918678908 +0100
@@ -30,6 +30,6 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 15:33:40.655511997 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 15:45:08.899517790 +0100
@@ -31,6 +31,6 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 15:42:26.081226318 +0100
@@ -30,6 +30,6 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 15:33:40.654512001 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 15:43:01.761071105 +0100
@@ -31,6 +31,6 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.30/ld/testsuite/ld-plugin/plugin.exp
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2020-04-06 15:33:40.655511997 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2020-04-06 15:46:30.704160249 +0100
@@ -268,7 +268,7 @@ set plugin_extra_elf_tests [list \
-plugin-opt add:tmpdir/func2i.o \
-plugin-opt add:tmpdir/func3h.o \
$testobjfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \
- {readelf -s plugin-vis-1.d}} "main.x" ] \
+ } "main.x" ] \
[list "plugin set symbol visibility with source" \
"-plugin $plugin_path $regclm $regas $regcln \
-plugin-opt claim:$srcdir/$subdir/func.c \
@@ -282,7 +282,7 @@ set plugin_extra_elf_tests [list \
-plugin-opt add:tmpdir/func2i.o \
-plugin-opt add:tmpdir/func3h.o \
$testsrcfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \
- {readelf -s plugin-vis-1.d}} "main.x" ] \
+ } "main.x" ] \
]
if { !$can_compile || $failed_compile } {
diff -rup binutils.orig/ld/testsuite/ld-shared/shared.exp binutils-2.30/ld/testsuite/ld-shared/shared.exp
--- binutils.orig/ld/testsuite/ld-shared/shared.exp 2020-04-06 15:33:40.688511853 +0100
+++ binutils-2.30/ld/testsuite/ld-shared/shared.exp 2020-04-06 15:34:38.645259733 +0100
@@ -275,7 +275,6 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
- setup_xfail "s390x-*-linux*"
if [ string match $shared_needs_pic "yes" ] {
setup_xfail "arm*-*-linux*"
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,899 @@
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c
--- binutils.orig/bfd/elf64-s390.c 2019-03-11 14:41:06.432547033 +0000
+++ binutils-2.30/bfd/elf64-s390.c 2019-03-11 14:45:42.066369572 +0000
@@ -475,7 +475,7 @@ elf_s390_is_local_label_name (bfd *abfd,
#define RELA_ENTRY_SIZE sizeof (Elf64_External_Rela)
-/* The first three entries in a procedure linkage table are reserved,
+/* The first three entries in a global offset table are reserved,
and the initial contents are unimportant (we zero them out).
Subsequent entries look like this. See the SVR4 ABI 386
supplement to see how this works. */
@@ -505,8 +505,8 @@ elf_s390_is_local_label_name (bfd *abfd,
LG 1,0(1) # 6 bytes Load address from GOT in r1
BCR 15,1 # 2 bytes Jump to address
RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
- LGF 1,12(1) # 6 bytes Load offset in symbl table in r1
- BRCL 15,-x # 6 bytes Jump to start of PLT
+ LGF 1,12(1) # 6 bytes Load rela.plt offset into r1
+ BRCL 15,-x # 6 bytes Jump to first PLT entry
.long ? # 4 bytes offset into .rela.plt
Total = 32 bytes per PLT entry
@@ -1599,8 +1599,7 @@ allocate_dynrelocs (struct elf_link_hash
/* Make room for this entry. */
s->size += PLT_ENTRY_SIZE;
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
+ /* We also need to make an entry in the .got.plt section. */
htab->elf.sgotplt->size += GOT_ENTRY_SIZE;
/* We also need to make an entry in the .rela.plt section. */
@@ -1825,6 +1824,20 @@ elf_s390_size_dynamic_sections (bfd *out
}
}
+ if (htab->elf.sgot && s390_gotplt_after_got_p (info))
+ {
+ /* _bfd_elf_create_got_section adds the got header size always
+ to .got.plt but we need it in .got if this section comes
+ first. */
+ htab->elf.sgot->size += 3 * GOT_ENTRY_SIZE;
+ htab->elf.sgotplt->size -= 3 * GOT_ENTRY_SIZE;
+
+ /* Make the _GLOBAL_OFFSET_TABLE_ symbol point to the .got
+ instead of .got.plt. */
+ htab->elf.hgot->root.u.def.section = htab->elf.sgot;
+ htab->elf.hgot->root.u.def.value = 0;
+ }
+
/* Set up .got offsets for local syms, and space for local dynamic
relocs. */
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
@@ -2125,7 +2138,6 @@ elf_s390_relocate_section (bfd *output_b
bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
int tls_type;
- asection *base_got = htab->elf.sgot;
bfd_boolean resolved_to_zero;
r_type = ELF64_R_TYPE (rel->r_info);
@@ -2166,7 +2178,7 @@ elf_s390_relocate_section (bfd *output_b
case R_390_PLTOFF16:
case R_390_PLTOFF32:
case R_390_PLTOFF64:
- relocation -= htab->elf.sgot->output_section->vma;
+ relocation -= s390_got_pointer (info);
break;
case R_390_GOTPLT12:
case R_390_GOTPLT16:
@@ -2186,10 +2198,10 @@ elf_s390_relocate_section (bfd *output_b
htab->elf.sgot->contents +
local_got_offsets[r_symndx]);
relocation = (local_got_offsets[r_symndx] +
- htab->elf.sgot->output_offset);
+ s390_got_offset (info));
if (r_type == R_390_GOTENT || r_type == R_390_GOTPLTENT)
- relocation += htab->elf.sgot->output_section->vma;
+ relocation += s390_got_pointer (info);
break;
}
default:
@@ -2248,25 +2260,23 @@ elf_s390_relocate_section (bfd *output_b
if (s390_is_ifunc_symbol_p (h))
{
+ /* Entry indices of .iplt and .igot.plt match
+ 1:1. No magic PLT first entry here. */
plt_index = h->plt.offset / PLT_ENTRY_SIZE;
- relocation = (plt_index * GOT_ENTRY_SIZE +
- htab->elf.igotplt->output_offset);
- if (r_type == R_390_GOTPLTENT)
- relocation += htab->elf.igotplt->output_section->vma;
+ relocation = (plt_index * GOT_ENTRY_SIZE
+ + s390_gotplt_offset (info)
+ + htab->elf.igotplt->output_offset);
}
else
{
- /* Calc. index no.
- Current offset - size first entry / entry size. */
- plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
- PLT_ENTRY_SIZE;
-
- /* Offset in GOT is PLT index plus GOT headers(3)
- times 8, addr & GOT addr. */
- relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
- if (r_type == R_390_GOTPLTENT)
- relocation += htab->elf.sgot->output_section->vma;
+ plt_index = ((h->plt.offset - PLT_FIRST_ENTRY_SIZE)
+ / PLT_ENTRY_SIZE);
+
+ relocation = (plt_index * GOT_ENTRY_SIZE
+ + s390_gotplt_offset (info));
}
+ if (r_type == R_390_GOTPLTENT)
+ relocation += s390_got_pointer (info);
unresolved_reloc = FALSE;
break;
}
@@ -2280,7 +2290,7 @@ elf_s390_relocate_section (bfd *output_b
case R_390_GOTENT:
/* Relocation is to the entry for this symbol in the global
offset table. */
- if (base_got == NULL)
+ if (htab->elf.sgot == NULL)
abort ();
if (h != NULL)
@@ -2297,8 +2307,19 @@ elf_s390_relocate_section (bfd *output_b
{
/* No explicit GOT usage so redirect to the
got.iplt slot. */
- base_got = htab->elf.igotplt;
- off = h->plt.offset / PLT_ENTRY_SIZE * GOT_ENTRY_SIZE;
+ relocation = (s390_gotplt_offset (info)
+ + htab->elf.igotplt->output_offset
+ + (h->plt.offset / PLT_ENTRY_SIZE
+ * GOT_ENTRY_SIZE));
+
+ /* For @GOTENT the relocation is against the offset between
+ the instruction and the symbols entry in the GOT and not
+ between the start of the GOT and the symbols entry. We
+ add the vma of the GOT to get the correct value. */
+ if (r_type == R_390_GOTENT || r_type == R_390_GOTPLTENT)
+ relocation += s390_got_pointer (info);
+
+ break;
}
else
{
@@ -2331,7 +2352,7 @@ elf_s390_relocate_section (bfd *output_b
else
{
bfd_put_64 (output_bfd, relocation,
- base_got->contents + off);
+ htab->elf.sgot->contents + off);
h->got.offset |= 1;
}
@@ -2413,7 +2434,7 @@ elf_s390_relocate_section (bfd *output_b
if (off >= (bfd_vma) -2)
abort ();
- relocation = base_got->output_offset + off;
+ relocation = s390_got_offset (info) + off;
/* For @GOTENT the relocation is against the offset between
the instruction and the symbols entry in the GOT and not
@@ -2421,7 +2442,7 @@ elf_s390_relocate_section (bfd *output_b
add the vma of the GOT to get the correct value. */
if ( r_type == R_390_GOTENT
|| r_type == R_390_GOTPLTENT)
- relocation += base_got->output_section->vma;
+ relocation += s390_got_pointer (info);
break;
@@ -2439,22 +2460,17 @@ elf_s390_relocate_section (bfd *output_b
relocation = (htab->elf.iplt->output_section->vma
+ htab->elf.iplt->output_offset
+ h->plt.offset
- - htab->elf.sgot->output_section->vma);
+ - s390_got_pointer (info));
goto do_relocation;
}
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- defined _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- relocation -= htab->elf.sgot->output_section->vma;
+ relocation -= s390_got_pointer (info);
break;
case R_390_GOTPC:
case R_390_GOTPCDBL:
/* Use global offset table as symbol value. */
- relocation = htab->elf.sgot->output_section->vma;
+ relocation = s390_got_pointer (info);
unresolved_reloc = FALSE;
break;
@@ -2503,7 +2519,7 @@ elf_s390_relocate_section (bfd *output_b
|| h->plt.offset == (bfd_vma) -1
|| (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h)))
{
- relocation -= htab->elf.sgot->output_section->vma;
+ relocation -= s390_got_pointer (info);
break;
}
@@ -2511,12 +2527,12 @@ elf_s390_relocate_section (bfd *output_b
relocation = (htab->elf.iplt->output_section->vma
+ htab->elf.iplt->output_offset
+ h->plt.offset
- - htab->elf.sgot->output_section->vma);
+ - s390_got_pointer (info));
else
relocation = (htab->elf.splt->output_section->vma
+ htab->elf.splt->output_offset
+ h->plt.offset
- - htab->elf.sgot->output_section->vma);
+ - s390_got_pointer (info));
unresolved_reloc = FALSE;
break;
@@ -3289,7 +3305,7 @@ elf_s390_finish_dynamic_symbol (bfd *out
if (h->plt.offset != (bfd_vma) -1)
{
bfd_vma plt_index;
- bfd_vma got_offset;
+ bfd_vma gotplt_offset;
Elf_Internal_Rela rela;
bfd_byte *loc;
@@ -3318,18 +3334,25 @@ elf_s390_finish_dynamic_symbol (bfd *out
Current offset - size first entry / entry size. */
plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
- /* Offset in GOT is PLT index plus GOT headers(3) times 8,
- addr & GOT addr. */
- got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
+ /* The slots in the .got.plt correspond to the PLT slots in
+ the same order. */
+ gotplt_offset = plt_index * GOT_ENTRY_SIZE;
+
+ /* If .got.plt comes first it needs to contain the 3 header
+ entries. */
+ if (!s390_gotplt_after_got_p (info))
+ gotplt_offset += 3 * GOT_ENTRY_SIZE;
/* Fill in the blueprint of a PLT. */
memcpy (htab->elf.splt->contents + h->plt.offset, elf_s390x_plt_entry,
PLT_ENTRY_SIZE);
- /* Fixup the relative address to the GOT entry */
+ /* The first instruction in the PLT entry is a LARL loading
+ the address of the GOT slot. We write the 4 byte
+ immediate operand of the LARL instruction here. */
bfd_put_32 (output_bfd,
(htab->elf.sgotplt->output_section->vma +
- htab->elf.sgotplt->output_offset + got_offset
+ htab->elf.sgotplt->output_offset + gotplt_offset
- (htab->elf.splt->output_section->vma +
htab->elf.splt->output_offset +
h->plt.offset))/2,
@@ -3349,12 +3372,12 @@ elf_s390_finish_dynamic_symbol (bfd *out
+ htab->elf.splt->output_offset
+ h->plt.offset
+ 14),
- htab->elf.sgotplt->contents + got_offset);
+ htab->elf.sgotplt->contents + gotplt_offset);
/* Fill in the entry in the .rela.plt section. */
rela.r_offset = (htab->elf.sgotplt->output_section->vma
+ htab->elf.sgotplt->output_offset
- + got_offset);
+ + gotplt_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_JMP_SLOT);
rela.r_addend = 0;
loc = htab->elf.srelplt->contents + plt_index *
@@ -3561,8 +3584,8 @@ elf_s390_finish_dynamic_sections (bfd *o
continue;
case DT_PLTGOT:
- s = htab->elf.sgotplt;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ /* DT_PLTGOT matches _GLOBAL_OFFSET_TABLE_ */
+ dyn.d_un.d_ptr = s390_got_pointer (info);
break;
case DT_JMPREL:
@@ -3599,10 +3622,11 @@ elf_s390_finish_dynamic_sections (bfd *o
/* fill in blueprint for plt 0 entry */
memcpy (htab->elf.splt->contents, elf_s390x_first_plt_entry,
PLT_FIRST_ENTRY_SIZE);
- /* Fixup relative address to start of GOT */
+ /* The second instruction in the first PLT entry is a LARL
+ loading the GOT pointer. Fill in the LARL immediate
+ address. */
bfd_put_32 (output_bfd,
- (htab->elf.sgotplt->output_section->vma
- + htab->elf.sgotplt->output_offset
+ (s390_got_pointer (info)
- htab->elf.splt->output_section->vma
- htab->elf.splt->output_offset - 6)/2,
htab->elf.splt->contents + 8);
@@ -3612,21 +3636,22 @@ elf_s390_finish_dynamic_sections (bfd *o
= PLT_ENTRY_SIZE;
}
- if (htab->elf.sgotplt)
+ if (htab->elf.hgot && htab->elf.hgot->root.u.def.section)
{
/* Fill in the first three entries in the global offset table. */
- if (htab->elf.sgotplt->size > 0)
+ if (htab->elf.hgot->root.u.def.section->size > 0)
{
bfd_put_64 (output_bfd,
(sdyn == NULL ? (bfd_vma) 0
: sdyn->output_section->vma + sdyn->output_offset),
- htab->elf.sgotplt->contents);
+ htab->elf.hgot->root.u.def.section->contents);
/* One entry for shared object struct ptr. */
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + 8);
+ bfd_put_64 (output_bfd, (bfd_vma) 0,
+ htab->elf.hgot->root.u.def.section->contents + 8);
/* One entry for _dl_runtime_resolve. */
- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + 16);
+ bfd_put_64 (output_bfd, (bfd_vma) 0,
+ htab->elf.hgot->root.u.def.section->contents + 16);
}
-
elf_section_data (htab->elf.sgot->output_section)
->this_hdr.sh_entsize = 8;
}
diff -rup binutils.orig/bfd/elf-s390-common.c binutils-2.30/bfd/elf-s390-common.c
--- binutils.orig/bfd/elf-s390-common.c 2019-03-11 14:41:06.444546938 +0000
+++ binutils-2.30/bfd/elf-s390-common.c 2019-03-11 14:45:42.065369580 +0000
@@ -30,6 +30,87 @@ s390_is_ifunc_symbol_p (struct elf_link_
return h->type == STT_GNU_IFUNC || eh->ifunc_resolver_address != 0;
}
+/* Return true if .got.plt is supposed to be emitted after .got. */
+
+static inline bfd_boolean
+s390_gotplt_after_got_p (struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info);
+
+ if (!htab->elf.sgot || !htab->elf.sgotplt)
+ return TRUE;
+
+ if (htab->elf.sgot->output_section == htab->elf.sgotplt->output_section)
+ {
+ if (htab->elf.sgot->output_offset < htab->elf.sgotplt->output_offset)
+ return TRUE;
+ }
+ else
+ {
+ if (htab->elf.sgot->output_section->vma
+ <= htab->elf.sgotplt->output_section->vma)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* Return the value of the _GLOBAL_OFFSET_TABLE_ symbol. */
+
+static inline bfd_vma
+s390_got_pointer (struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info);
+ bfd_vma got_pointer;
+
+ BFD_ASSERT (htab && htab->elf.hgot);
+
+ got_pointer = (htab->elf.hgot->root.u.def.section->output_section->vma
+ + htab->elf.hgot->root.u.def.section->output_offset);
+ /* Our ABI requires the GOT pointer to point at the very beginning
+ of the global offset table. */
+ BFD_ASSERT (got_pointer
+ <= (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset));
+ BFD_ASSERT (got_pointer
+ <= (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset));
+
+ return got_pointer;
+}
+
+
+/* Return the offset of the .got versus _GLOBAL_OFFSET_TABLE_. */
+
+static inline bfd_vma
+s390_got_offset (struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info);
+
+ /* The absolute address of the .got in the target image. */
+ bfd_vma got_address = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset);
+
+ /* GOT offset must not be negative. */
+ BFD_ASSERT (s390_got_pointer (info) <= got_address);
+ return got_address - s390_got_pointer (info);
+}
+
+/* Return the offset of the .got.plt versus _GLOBAL_OFFSET_TABLE_. */
+
+static inline bfd_vma
+s390_gotplt_offset (struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info);
+
+ /* The absolute address of the .got.plt in the target image. */
+ bfd_vma gotplt_address = (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset);
+
+ /* GOT offset must not be negative. */
+ BFD_ASSERT (s390_got_pointer (info) <= gotplt_address);
+ return gotplt_address - s390_got_pointer (info);
+}
+
/* Create sections needed by STT_GNU_IFUNC symbol. */
static bfd_boolean
diff -rup binutils.orig/ld/emulparams/elf64_s390.sh binutils-2.30/ld/emulparams/elf64_s390.sh
--- binutils.orig/ld/emulparams/elf64_s390.sh 2019-03-11 14:41:05.978550619 +0000
+++ binutils-2.30/ld/emulparams/elf64_s390.sh 2019-03-11 14:45:42.066369572 +0000
@@ -11,9 +11,12 @@ NOP=0x07070707
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
+GENERATE_RELRO_SCRIPT=yes
NO_SMALL_DATA=yes
EXTRA_EM_FILE=s390
IREL_IN_PLT=
+SEPARATE_GOTPLT=0
+test -z "$RELRO" && unset SEPARATE_GOTPLT
# Treat a host that matches the target with the possible exception of "x"
# in the name as if it were native.
diff -rup binutils.orig/ld/emultempl/elf32.em binutils-2.30/ld/emultempl/elf32.em
--- binutils.orig/ld/emultempl/elf32.em 2019-03-11 14:41:05.971550675 +0000
+++ binutils-2.30/ld/emultempl/elf32.em 2019-03-11 14:45:42.064369587 +0000
@@ -2406,17 +2406,41 @@ echo ' && link_info.combrelo
echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xdceo >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c
echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdce >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xdco >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xdeo >> e${EMULATION_NAME}.c
+fi
fi
echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xde >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xdo >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_pie (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xd >> e${EMULATION_NAME}.c
fi
@@ -2432,17 +2456,41 @@ echo ' && link_info.combrelo
echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xsceo >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsce >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xsco >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xseo >> e${EMULATION_NAME}.c
+fi
fi
echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xse >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xso >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (bfd_link_dll (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c
fi
@@ -2455,14 +2503,34 @@ echo ' ; else if (link_info.combreloc'
echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xw >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xceo >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c
echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xce >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xco >> e${EMULATION_NAME}.c
+fi
echo ' ; else if (link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xc >> e${EMULATION_NAME}.c
fi
-echo ' ; else if (link_info.separate_code) return' >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (link_info.separate_code' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xeo >> e${EMULATION_NAME}.c
+fi
+echo ' ; else if (link_info.separate_code) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xe >> e${EMULATION_NAME}.c
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+echo ' ; else if (link_info.relro) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xo >> e${EMULATION_NAME}.c
+fi
echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> e${EMULATION_NAME}.c
@@ -2501,6 +2569,21 @@ fragment <<EOF
else
return "ldscripts/${EMULATION_NAME}.xdw";
}
+EOF
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (bfd_link_pie (&link_info)
+ && link_info.combreloc
+ && link_info.relro)
+ {
+ if (link_info.separate_code)
+ return "ldscripts/${EMULATION_NAME}.xdceo";
+ else
+ return "ldscripts/${EMULATION_NAME}.xdco";
+ }
+EOF
+fi
+fragment <<EOF
else if (bfd_link_pie (&link_info)
&& link_info.combreloc)
{
@@ -2511,6 +2594,18 @@ fragment <<EOF
}
EOF
fi
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (bfd_link_pie (&link_info)
+ && link_info.relro)
+ {
+ if (link_info.separate_code)
+ return "ldscripts/${EMULATION_NAME}.xdeo";
+ else
+ return "ldscripts/${EMULATION_NAME}.xdo";
+ }
+EOF
+fi
fragment <<EOF
else if (bfd_link_pie (&link_info))
{
@@ -2532,6 +2627,21 @@ fragment <<EOF
else
return "ldscripts/${EMULATION_NAME}.xsw";
}
+EOF
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (bfd_link_dll (&link_info)
+ && link_info.combreloc
+ && link_info.relro)
+ {
+ if (link_info.separate_code)
+ return "ldscripts/${EMULATION_NAME}.xsceo";
+ else
+ return "ldscripts/${EMULATION_NAME}.xsco";
+ }
+EOF
+fi
+fragment <<EOF
else if (bfd_link_dll (&link_info) && link_info.combreloc)
{
if (link_info.separate_code)
@@ -2541,6 +2651,18 @@ fragment <<EOF
}
EOF
fi
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (bfd_link_dll (&link_info)
+ && link_info.relro)
+ {
+ if (link_info.separate_code)
+ return "ldscripts/${EMULATION_NAME}.xseo";
+ else
+ return "ldscripts/${EMULATION_NAME}.xso";
+ }
+EOF
+fi
fragment <<EOF
else if (bfd_link_dll (&link_info))
{
@@ -2561,6 +2683,20 @@ fragment <<EOF
else
return "ldscripts/${EMULATION_NAME}.xw";
}
+EOF
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (link_info.combreloc
+ && link_info.relro)
+ {
+ if (link_info.separate_code)
+ return "ldscripts/${EMULATION_NAME}.xceo";
+ else
+ return "ldscripts/${EMULATION_NAME}.xco";
+ }
+EOF
+fi
+fragment <<EOF
else if (link_info.combreloc)
{
if (link_info.separate_code)
@@ -2570,6 +2706,17 @@ fragment <<EOF
}
EOF
fi
+if test -n "$GENERATE_RELRO_SCRIPT" ; then
+fragment <<EOF
+ else if (link_info.relro)
+ {
+ if (link_info.separate_code)
+ return "ldscripts/${EMULATION_NAME}.xeo";
+ else
+ return "ldscripts/${EMULATION_NAME}.xo";
+ }
+EOF
+fi
fragment <<EOF
else
{
diff -rup binutils.orig/ld/genscripts.sh binutils-2.30/ld/genscripts.sh
--- binutils.orig/ld/genscripts.sh 2019-03-11 14:41:05.983550579 +0000
+++ binutils-2.30/ld/genscripts.sh 2019-03-11 14:45:42.065369580 +0000
@@ -304,6 +304,20 @@ LD_FLAG=textonly
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xe
+if test -n "$GENERATE_RELRO_SCRIPT"; then
+ LD_FLAG=
+ RELRO=" "
+ ( echo "/* Script for -z relo: generate normal executables with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xo
+ LD_FLAG=textonly
+ ( echo "/* Script for -z separate-code -z relo: generate normal executables with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xeo
+ unset RELRO
+fi
LD_FLAG=n
DATA_ALIGNMENT=${DATA_ALIGNMENT_n}
( echo "/* Script for -n: mix text and data on same page */"
@@ -351,6 +365,25 @@ if test -n "$GENERATE_COMBRELOC_SCRIPT";
rm -f ${COMBRELOC}
COMBRELOC=
unset RELRO_NOW
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ LD_FLAG=c
+ RELRO=" "
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xco.tmp
+ ( echo "/* Script for -z combreloc -z relro: combine and sort reloc sections */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xco
+ rm -f ${COMBRELOC}
+ LD_FLAG=ctextonly
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xceo.tmp
+ ( echo "/* Script for -z combreloc -z separate-code -z relro: combine and sort reloc sections */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xceo
+ rm -f ${COMBRELOC}
+ COMBRELOC=
+ unset RELRO
+ fi
fi
if test -n "$GENERATE_SHLIB_SCRIPT"; then
@@ -368,6 +401,23 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; the
. ${CUSTOMIZER_SCRIPT}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xse
+
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ RELRO=" "
+ LD_FLAG=shared
+ (
+ echo "/* Script for ld --shared -z relro: link shared library */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xso
+ LD_FLAG=sharedtextonly
+ (
+ echo "/* Script for ld --shared -z relro -z separate-code: link shared library with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xseo
+ unset RELRO
+ fi
if test -n "$GENERATE_COMBRELOC_SCRIPT"; then
DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}}
LD_FLAG=cshared
@@ -399,8 +449,27 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; the
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xswe
rm -f ${COMBRELOC}
- COMBRELOC=
unset RELRO_NOW
+
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ LD_FLAG=wshared
+ RELRO=" "
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xsco.tmp
+ ( echo "/* Script for --shared -z combreloc -z relro: shared library, combine & sort relocs with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsco
+ rm -f ${COMBRELOC}
+ LD_FLAG=wsharedtextonly
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xsceo.tmp
+ ( echo "/* Script for --shared -z combreloc -z relro -z separate-code: shared library, combine & sort relocs with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsceo
+ rm -f ${COMBRELOC}
+ unset RELRO
+ fi
+ COMBRELOC=
fi
unset CREATE_SHLIB
fi
@@ -420,6 +489,22 @@ if test -n "$GENERATE_PIE_SCRIPT"; then
. ${CUSTOMIZER_SCRIPT}
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xde
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ RELRO=" "
+ LD_FLAG=pie
+ (
+ echo "/* Script for ld -pie -z relro: link position independent executable */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdo
+ LD_FLAG=pietextonly
+ (
+ echo "/* Script for ld -pie -z relro -z separate-code: link position independent executable with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdeo
+ unset RELRO
+ fi
if test -n "$GENERATE_COMBRELOC_SCRIPT"; then
DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}}
COMBRELOC=ldscripts/${EMULATION_NAME}.xdc.tmp
@@ -451,8 +536,28 @@ if test -n "$GENERATE_PIE_SCRIPT"; then
. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdwe
rm -f ${COMBRELOC}
- COMBRELOC=
unset RELRO_NOW
+
+ if test -n "$GENERATE_RELRO_SCRIPT"; then
+ LD_FLAG=wpie
+ RELRO=" "
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xdco.tmp
+ ( echo "/* Script for -pie -z combreloc -z relro: position independent executable, combine & sort relocs with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdco
+ rm -f ${COMBRELOC}
+ LD_FLAG=wpietextonly
+ COMBRELOC=ldscripts/${EMULATION_NAME}.xdceo.tmp
+ ( echo "/* Script for -pie -z combreloc -z relro -z separate-code: position independent executable, combine & sort relocs with separate code segment */"
+ . ${CUSTOMIZER_SCRIPT}
+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdceo
+ rm -f ${COMBRELOC}
+
+ unset RELRO
+ fi
+ COMBRELOC=
fi
unset CREATE_PIE
fi
diff -rup binutils.orig/ld/testsuite/ld-s390/s390.exp binutils-2.30/ld/testsuite/ld-s390/s390.exp
--- binutils.orig/ld/testsuite/ld-s390/s390.exp 2019-03-11 14:41:06.029550216 +0000
+++ binutils-2.30/ld/testsuite/ld-s390/s390.exp 2019-03-11 14:45:42.066369572 +0000
@@ -70,10 +70,15 @@ set s390xtests {
{{readelf -WSsrl tlsbin_64.rd} {objdump -dzrj.text tlsbin_64.dd}
{objdump -sj.got tlsbin_64.sd} {objdump -sj.tdata tlsbin_64.td}}
"tlsbin_64"}
- {"GOT: symbol address load from got to larl"
- "-shared -melf64_s390 --hash-style=sysv --version-script=gotreloc-1.ver" ""
+ {"GOT: norelro symbol address load from got to larl"
+ "-shared -melf64_s390 -z norelro --hash-style=sysv --version-script=gotreloc-1.ver" ""
"-m64" {gotreloc-1.s}
- {{objdump -dzrj.text gotreloc_64-1.dd}}
+ {{objdump -dzrj.text gotreloc_64-norelro-1.dd}}
+ "gotreloc_64-1"}
+ {"GOT: relro symbol address load from got to larl"
+ "-shared -melf64_s390 -z relro --hash-style=sysv --version-script=gotreloc-1.ver" ""
+ "-m64" {gotreloc-1.s}
+ {{objdump -dzrj.text gotreloc_64-relro-1.dd}}
"gotreloc_64-1"}
{"PLT: offset test"
"-shared -m elf64_s390 -dT pltoffset-1.ld" ""
--- /dev/null 2019-03-11 08:49:22.227998809 +0000
+++ binutils-2.30/ld/testsuite/ld-s390/gotreloc_64-relro-1.dd 2019-03-11 14:53:27.144667759 +0000
@@ -0,0 +1,12 @@
+tmpdir/gotreloc_64-1: file format elf64-s390
+
+Disassembly of section .text:
+
+.* <foo>:
+.*: c0 10 00 00 00 0e [ ]*larl %r1,.* <bar>
+.*: c0 10 00 00 00 0b [ ]*larl %r1,.* <bar>
+.*: c4 1d 00 00 .. .. [ ]*lrl %r1,.* <_GLOBAL_OFFSET_TABLE_\+0x18>
+.*: 58 10 c0 18 [ ]*l %r1,24\(%r12\)
+.*: e3 10 c0 18 00 58 [ ]*ly %r1,24\(%r12\)
+.* <bar>:
+.*: 00 00 01 23 .long 0x00000123
--- /dev/null 2019-03-11 08:49:22.227998809 +0000
+++ binutils-2.30/ld/testsuite/ld-s390/gotreloc_64-norelro-1.dd 2019-03-11 14:45:42.066369572 +0000
@@ -0,0 +1,12 @@
+tmpdir/gotreloc_64-1: file format elf64-s390
+
+Disassembly of section .text:
+
+.* <foo>:
+.*: c0 10 00 00 00 0e [ ]*larl %r1,.* <bar>
+.*: c0 10 00 00 00 0b [ ]*larl %r1,.* <bar>
+.*: c4 1d 00 00 08 86 [ ]*lrl %r1,.* <_GLOBAL_OFFSET_TABLE_\+0x18>
+.*: 58 10 c0 18 [ ]*l %r1,24\(%r12\)
+.*: e3 10 c0 18 00 58 [ ]*ly %r1,24\(%r12\)
+.* <bar>:
+.*: 00 00 01 23 .long 0x00000123

View File

@ -0,0 +1,43 @@
--- binutils.orig/bfd/elf64-s390.c 2020-06-15 11:01:54.671940830 +0100
+++ binutils-2.30/bfd/elf64-s390.c 2020-06-15 11:04:44.663343784 +0100
@@ -2335,6 +2335,9 @@ elf_s390_relocate_section (bfd *output_b
&& SYMBOL_REFERENCES_LOCAL (info, h))
|| resolved_to_zero)
{
+ Elf_Internal_Sym *isym;
+ asection *sym_sec;
+
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
locally, or the symbol was forced to be local
@@ -2356,6 +2359,10 @@ elf_s390_relocate_section (bfd *output_b
h->got.offset |= 1;
}
+ /* When turning a GOT slot dereference into a direct
+ reference using larl we have to make sure that
+ the symbol is 1. properly aligned and 2. it is no
+ ABS symbol or will become one. */
if ((h->def_regular
&& bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
@@ -2370,8 +2377,17 @@ elf_s390_relocate_section (bfd *output_b
contents + rel->r_offset - 2)
& 0xff00f000) == 0xe300c000
&& bfd_get_8 (input_bfd,
- contents + rel->r_offset + 3) == 0x04)))
-
+ contents + rel->r_offset + 3) == 0x04))
+ && (isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+ input_bfd, r_symndx))
+ && isym->st_shndx != SHN_ABS
+ && h != htab->elf.hdynamic
+ && h != htab->elf.hgot
+ && h != htab->elf.hplt
+ && !(isym->st_value & 1)
+ && (sym_sec = bfd_section_from_elf_index (input_bfd,
+ isym->st_shndx))
+ && sym_sec->alignment_power)
{
unsigned short new_insn =
(0xc000 | (bfd_get_8 (input_bfd,

View File

@ -0,0 +1,11 @@
diff -rup binutils.orig/config/plugins.m4 binutils-2.30/config/plugins.m4
--- binutils.orig/config/plugins.m4 2019-02-18 16:11:38.392440473 +0000
+++ binutils-2.30/config/plugins.m4 2019-02-18 16:11:44.715393846 +0000
@@ -16,6 +16,6 @@ AC_DEFUN([AC_PLUGINS],
[plugins=$maybe_plugins]
)
if test "$plugins" = "yes"; then
- AC_SEARCH_LIBS([dlopen], [dl])
+ AC_SEARCH_LIBS([dlsym], [dl])
fi
])

View File

@ -0,0 +1,13 @@
--- binutils.orig/binutils/dwarf.c 2018-02-08 10:49:07.154191536 +0000
+++ binutils-2.30/binutils/dwarf.c 2018-02-08 12:53:32.649380368 +0000
@@ -9851,6 +9851,10 @@ load_dwo_file (const char * main_filenam
void *
load_separate_debug_file (void * file, const char * filename)
{
+ /* Skip this operation if we are not interested in debug links. */
+ if (! do_follow_links && ! do_debug_links)
+ return NULL;
+
/* See if there is a dwo link. */
if (load_debug_section (str, file)
&& load_debug_section (abbrev, file)

View File

@ -0,0 +1,97 @@
--- binutils.orig/binutils/objdump.c 2018-03-05 17:04:19.901619738 +0000
+++ binutils-2.29/binutils/objdump.c 2018-03-05 17:10:08.334643096 +0000
@@ -664,9 +664,7 @@ slurp_dynamic_symtab (bfd *abfd)
static bfd_boolean
is_significant_symbol_name (const char * name)
{
- return strcmp (name, ".plt") == 0
- || strcmp (name, ".got") == 0
- || strcmp (name, ".plt.got") == 0;
+ return strncmp (name, ".plt", 4) == 0 || strcmp (name, ".got") == 0;
}
/* Filter out (in place) symbols that are useless for disassembly.
@@ -937,6 +935,7 @@ find_symbol_for_address (bfd_vma vma,
asection *sec;
unsigned int opb;
bfd_boolean want_section;
+ long rel_count;
if (sorted_symcount < 1)
return NULL;
@@ -1065,33 +1064,59 @@ find_symbol_for_address (bfd_vma vma,
and we have dynamic relocations available, then we can produce
a better result by matching a relocation to the address and
using the symbol associated with that relocation. */
+ rel_count = aux->dynrelcount;
if (!want_section
- && aux->dynrelbuf != NULL
&& sorted_syms[thisplace]->value != vma
+ && rel_count > 0
+ && aux->dynrelbuf != NULL
+ && aux->dynrelbuf[0]->address <= vma
+ && aux->dynrelbuf[rel_count - 1]->address >= vma
/* If we have matched a synthetic symbol, then stick with that. */
&& (sorted_syms[thisplace]->flags & BSF_SYNTHETIC) == 0)
{
- long rel_count;
- arelent ** rel_pp;
+ arelent ** rel_low;
+ arelent ** rel_high;
- for (rel_count = aux->dynrelcount, rel_pp = aux->dynrelbuf;
- rel_count--;)
+ rel_low = aux->dynrelbuf;
+ rel_high = rel_low + rel_count - 1;
+ while (rel_low <= rel_high)
{
- arelent * rel = rel_pp[rel_count];
+ arelent ** rel_mid = &rel_low[(rel_high - rel_low) / 2];
+ arelent * rel = *rel_mid;
- if (rel->address == vma
- && rel->sym_ptr_ptr != NULL
- /* Absolute relocations do not provide a more helpful symbolic address. */
- && ! bfd_is_abs_section ((* rel->sym_ptr_ptr)->section))
+ if (rel->address == vma)
{
- if (place != NULL)
- * place = thisplace;
- return * rel->sym_ptr_ptr;
+ /* Absolute relocations do not provide a more helpful
+ symbolic address. Find a non-absolute relocation
+ with the same address. */
+
+ arelent **rel_vma = rel_mid;
+
+ for (rel_mid--;
+ rel_mid >= rel_low && rel_mid[0]->address == vma;
+ rel_mid--)
+ rel_vma = rel_mid;
+
+ for (; rel_vma <= rel_high && rel_vma[0]->address == vma;
+ rel_vma++)
+ {
+ rel = *rel_vma;
+ if (rel->sym_ptr_ptr != NULL
+ && ! bfd_is_abs_section ((* rel->sym_ptr_ptr)->section))
+ {
+ if (place != NULL)
+ * place = thisplace;
+ return * rel->sym_ptr_ptr;
+ }
+ }
+ break;
}
- /* We are scanning backwards, so if we go below the target address
- we have failed. */
- if (rel_pp[rel_count]->address < vma)
+ if (vma < rel->address)
+ rel_high = rel_mid;
+ else if (vma >= rel_mid[1]->address)
+ rel_low = rel_mid + 1;
+ else
break;
}
}

View File

@ -0,0 +1,19 @@
--- binutils.orig/binutils/objcopy.c 2020-10-30 14:21:10.448328799 +0000
+++ binutils-2.30/binutils/objcopy.c 2020-10-30 14:22:08.406136672 +0000
@@ -3257,14 +3257,12 @@ copy_object (bfd *ibfd, bfd *obfd, const
/* It is likely that output sections are in the same order
as the input sections, but do not assume that this is
the case. */
- if (strcmp (bfd_section_name (obfd, merged->sec),
- bfd_section_name (obfd, osec)) != 0)
+ if (merged->sec->output_section != osec)
{
for (merged = merged_note_sections;
merged != NULL;
merged = merged->next)
- if (strcmp (bfd_section_name (obfd, merged->sec),
- bfd_section_name (obfd, osec)) == 0)
+ if (merged->sec->output_section == osec)
break;
if (merged == NULL)

View File

@ -0,0 +1,107 @@
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c
--- binutils.orig/bfd/elf32-i386.c 2018-02-27 17:25:53.961140597 +0000
+++ binutils-2.30/bfd/elf32-i386.c 2018-02-27 17:27:14.115133477 +0000
@@ -383,7 +383,7 @@ elf_i386_rtype_to_howto (bfd *abfd, unsi
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) r_type);
- indx = R_386_NONE;
+ return NULL;
}
/* PR 17512: file: 0f67f69d. */
if (elf_howto_table [indx].type != r_type)
diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c
--- binutils.orig/bfd/elf64-ppc.c 2018-02-27 17:25:53.969140496 +0000
+++ binutils-2.30/bfd/elf64-ppc.c 2018-02-27 17:27:56.213604518 +0000
@@ -2516,9 +2516,10 @@ ppc64_elf_info_to_howto (bfd *abfd, arel
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) type);
- type = R_PPC64_NONE;
+ cache_ptr->howto = NULL;
}
- cache_ptr->howto = ppc64_elf_howto_table[type];
+ else
+ cache_ptr->howto = ppc64_elf_howto_table[type];
}
/* Handle the R_PPC64_ADDR16_HA and similar relocs. */
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c
--- binutils.orig/bfd/elf64-s390.c 2018-02-27 17:25:53.968140509 +0000
+++ binutils-2.30/bfd/elf64-s390.c 2018-02-27 17:28:24.632247443 +0000
@@ -372,9 +372,10 @@ elf_s390_info_to_howto (bfd *abfd ATTRIB
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) r_type);
- r_type = R_390_NONE;
+ cache_ptr->howto = NULL;
}
- cache_ptr->howto = &elf_howto_table[r_type];
+ else
+ cache_ptr->howto = &elf_howto_table[r_type];
}
}
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-02-27 17:25:53.964140559 +0000
+++ binutils-2.30/bfd/elf64-x86-64.c 2018-02-27 17:29:12.554645307 +0000
@@ -284,7 +284,7 @@ elf_x86_64_rtype_to_howto (bfd *abfd, un
/* xgettext:c-format */
_bfd_error_handler (_("%B: invalid relocation type %d"),
abfd, (int) r_type);
- r_type = R_X86_64_NONE;
+ return NULL;
}
i = r_type;
}
@@ -347,8 +347,6 @@ elf_x86_64_info_to_howto (bfd *abfd ATTR
&& r_type != (unsigned int) R_X86_64_GNU_VTENTRY)
r_type &= ~R_X86_64_converted_reloc_bit;
cache_ptr->howto = elf_x86_64_rtype_to_howto (abfd, r_type);
-
- BFD_ASSERT (r_type == cache_ptr->howto->type || cache_ptr->howto->type == R_X86_64_NONE);
}
/* Support for core dump NOTE sections. */
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2018-02-27 17:25:53.964140559 +0000
+++ binutils-2.30/bfd/elfcode.h 2018-02-27 17:26:57.234345581 +0000
@@ -1474,6 +1474,12 @@ elf_slurp_reloc_table_from_section (bfd
(*ebd->elf_info_to_howto) (abfd, relent, &rela);
else
(*ebd->elf_info_to_howto_rel) (abfd, relent, &rela);
+
+ if (relent->howto == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
}
if (allocated != NULL)
diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2018-02-27 17:25:53.185150347 +0000
+++ binutils-2.30/binutils/objcopy.c 2018-02-27 17:30:05.806976202 +0000
@@ -3022,10 +3022,19 @@ copy_object (bfd *ibfd, bfd *obfd, const
haven't been set yet. mark_symbols_used_in_relocations will
ignore input sections which have no corresponding output
section. */
+ bfd_set_error (bfd_error_no_error);
if (strip_symbols != STRIP_ALL)
- bfd_map_over_sections (ibfd,
- mark_symbols_used_in_relocations,
- isympp);
+ {
+ bfd_map_over_sections (ibfd,
+ mark_symbols_used_in_relocations,
+ isympp);
+ if (bfd_get_error () != bfd_error_no_error)
+ {
+ status = 1;
+ return FALSE;
+ }
+ }
+
osympp = (asymbol **) xmalloc ((symcount + add_symbols + 1) * sizeof (asymbol *));
symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount);
}

View File

@ -0,0 +1,210 @@
# Do not enable IBT when an object file contains code but no GNU Property notes. (#1687774)
diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c
--- binutils.orig/bfd/elfxx-x86.c 2019-03-13 10:19:07.715406452 +0000
+++ binutils-2.30/bfd/elfxx-x86.c 2019-03-13 10:20:01.255975385 +0000
@@ -2377,6 +2377,9 @@ _bfd_x86_elf_merge_gnu_properties (struc
}
else
{
+ /* There should be no AND properties since some input doesn't
+ have them. Set IBT and SHSTK properties for -z ibt and -z
+ shstk if needed. */
features = 0;
if (info->ibt)
features = GNU_PROPERTY_X86_FEATURE_1_IBT;
@@ -2384,18 +2387,15 @@ _bfd_x86_elf_merge_gnu_properties (struc
features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
if (features)
{
- /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
- GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
if (aprop != NULL)
{
- number = aprop->u.number;
- aprop->u.number = number | features;
- updated = number != (unsigned int) aprop->u.number;
+ updated = features != (unsigned int) aprop->u.number;
+ aprop->u.number = features;
}
else
{
- bprop->u.number |= features;
updated = TRUE;
+ bprop->u.number = features;
}
}
else if (aprop != NULL)
diff -rup binutils.orig/ld/testsuite/ld-i386/i386.exp binutils-2.30/ld/testsuite/ld-i386/i386.exp
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2019-03-13 10:19:07.258410131 +0000
+++ binutils-2.30/ld/testsuite/ld-i386/i386.exp 2019-03-13 10:20:32.995719837 +0000
@@ -473,6 +473,8 @@ run_dump_test "pr18815"
run_dump_test "pr19939a"
run_dump_test "pr19939b"
run_dump_test "tlsdesc2"
+run_dump_test "pr24322a"
+run_dump_test "pr24322b"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2019-03-13 10:19:07.323409608 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2019-03-13 10:21:11.938406302 +0000
@@ -593,6 +593,10 @@ run_dump_test "pr20253-5a"
run_dump_test "pr20253-5b"
run_dump_test "tlsdesc2"
run_dump_test "pr22048"
+run_dump_test "pr24322a"
+run_dump_test "pr24322a-x32"
+run_dump_test "pr24322b"
+run_dump_test "pr24322b-x32"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-i386/pr24322a.d 2019-03-13 11:05:58.557068529 +0000
@@ -0,0 +1,11 @@
+#source: ../ld-x86-64/pr24322a.s
+#source: ../ld-x86-64/pr24322b.s
+#as: --32
+#ld: -z shstk -m elf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
+
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-i386/pr24322b.d 2019-03-13 11:07:19.837414751 +0000
@@ -0,0 +1,11 @@
+#source: ../ld-x86-64/pr24322c.s
+#source: ../ld-x86-64/pr24322b.s
+#as: --32
+#ld: -z shstk -m elf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
+
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322a.s 2019-03-13 10:20:01.256975377 +0000
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x3
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322a.d 2019-03-13 11:07:47.228194433 +0000
@@ -0,0 +1,10 @@
+#source: pr24322a.s
+#source: pr24322b.s
+#as: --64 -defsym __64_bit__=1
+#ld: -z shstk -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322a-x32.d 2019-03-13 11:10:46.635235620 +0000
@@ -0,0 +1,10 @@
+#source: pr24322a.s
+#source: pr24322b.s
+#as: --x32
+#ld: -z shstk -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322b.s 2019-03-13 10:20:01.257975369 +0000
@@ -0,0 +1,4 @@
+ .text
+ .global _start
+_start:
+ ret
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322b.d 2019-03-13 11:08:03.948059948 +0000
@@ -0,0 +1,10 @@
+#source: pr24322c.s
+#source: pr24322b.s
+#as: --64 -defsym __64_bit__=1
+#ld: -z shstk -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322b-x32.d 2019-03-13 11:13:13.626524410 +0000
@@ -0,0 +1,10 @@
+#source: pr24322c.s
+#source: pr24322b.s
+#as: --x32
+#ld: -z shstk -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x000000.. NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
--- /dev/null 2019-03-13 08:01:41.976955507 +0000
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr24322c.s 2019-03-13 10:20:01.257975369 +0000
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x0
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:

View File

@ -0,0 +1,116 @@
--- binutils.orig/gas/config/tc-i386.c 2020-08-21 10:21:00.595678097 +0100
+++ binutils-2.30/gas/config/tc-i386.c 2020-08-21 10:22:15.009449340 +0100
@@ -8035,7 +8035,8 @@ output_disp (fragS *insn_start_frag, off
int size = disp_size (n);
offsetT val = i.op[n].disps->X_add_number;
- val = offset_in_range (val >> i.memshift, size);
+ val = offset_in_range (val >> (size == 1 ? i.memshift : 0),
+ size);
p = frag_more (size);
md_number_to_chars (p, val, size);
}
--- binutils.orig/gas/testsuite/gas/i386/i386.exp 2020-08-21 10:21:00.669677873 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/i386.exp 2020-08-21 10:39:22.921167674 +0100
@@ -216,6 +216,7 @@ if [expr ([istarget "i*86-*-*"] || [ist
run_dump_test "evex-lig512-intel"
run_dump_test "evex-wig1"
run_dump_test "evex-wig1-intel"
+ run_dump_test "evex-no-scale-32"
run_dump_test "sse2avx"
run_list_test "inval-avx" "-al"
run_list_test "inval-avx512f" "-al"
@@ -692,6 +693,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-avx256int-intel"
run_dump_test "x86-64-avx2"
run_dump_test "x86-64-avx2-intel"
+ run_dump_test "evex-no-scale-64"
run_dump_test "x86-64-avx-gather"
run_dump_test "x86-64-avx-gather-intel"
run_dump_test "x86-64-avx512f"
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 10:41:30.411757740 +0100
@@ -0,0 +1,18 @@
+ .allow_index_reg
+ .struct
+ inc %eax
+.equiv is_64bit, . > 1
+
+ .text
+disp:
+.if is_64bit
+ vmovaps -1024(%rip), %zmm0
+ vmovaps 64(,%rax), %zmm0
+ vmovaps 64(,%riz), %zmm0
+.endif
+ vmovaps 64(,%eax), %zmm0
+ vmovaps 64(,%eiz), %zmm0
+ vmovaps 64, %zmm0
+.if !is_64bit
+ addr16 vmovaps 64, %zmm0
+.endif
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-32.d 2020-08-21 10:41:37.347735430 +0100
@@ -0,0 +1,14 @@
+#source: evex-no-scale.s
+#objdump: -dw
+#name: ix86 EVEX no disp scaling
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <disp>:
+ +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 05 40 00 00 00 vmovaps 0x40,%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 06 40 00 vmovaps 0x40,%zmm0
+#pass
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 10:41:42.539718727 +0100
@@ -0,0 +1,16 @@
+#source: evex-no-scale.s
+#objdump: -dw
+#name: x86-64 EVEX no disp scaling
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <disp>:
+ +[a-f0-9]+: 62 f1 7c 48 28 05 00 fc ff ff vmovaps -0x400\(%rip\),%zmm0 # .*
+ +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%rax,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+#pass
--- binutils.orig/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 12:48:57.859030235 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 12:53:26.631149341 +0100
@@ -5,7 +5,7 @@
.text
disp:
-.if is_64bit
+.ifdef x86_64
vmovaps -1024(%rip), %zmm0
vmovaps 64(,%rax), %zmm0
vmovaps 64(,%riz), %zmm0
@@ -13,6 +13,6 @@ disp:
vmovaps 64(,%eax), %zmm0
vmovaps 64(,%eiz), %zmm0
vmovaps 64, %zmm0
-.if !is_64bit
+.ifndef x86_64
addr16 vmovaps 64, %zmm0
.endif
--- binutils.orig/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 12:48:57.860030232 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 13:20:59.174525430 +0100
@@ -11,6 +11,6 @@ Disassembly of section .text:
+[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%rax,1\),%zmm0
+[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+[a-f0-9]+: 67 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
- +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 addr32 vmovaps 0x40,%zmm0
+[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
#pass

View File

@ -0,0 +1,64 @@
--- binutils.orig/bfd/elfxx-x86.c 2018-05-14 12:22:29.149657093 +0100
+++ binutils-2.30/bfd/elfxx-x86.c 2018-05-14 12:25:16.244700009 +0100
@@ -839,6 +839,33 @@ _bfd_x86_elf_compare_relocs (const void
return 0;
}
+/* Mark symbol, NAME, as locally defined by linker if it is referenced
+ and not defined in a relocatable object file. */
+
+static void
+elf_x86_linker_defined (struct bfd_link_info *info, const char *name)
+{
+ struct elf_link_hash_entry *h;
+
+ h = elf_link_hash_lookup (elf_hash_table (info), name,
+ FALSE, FALSE, FALSE);
+ if (h == NULL)
+ return;
+
+ while (h->root.type == bfd_link_hash_indirect)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->root.type == bfd_link_hash_new
+ || h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_common
+ || (!h->def_regular && h->def_dynamic))
+ {
+ elf_x86_hash_entry (h)->local_ref = 2;
+ elf_x86_hash_entry (h)->linker_def = 1;
+ }
+}
+
bfd_boolean
_bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info)
{
@@ -869,18 +896,16 @@ _bfd_x86_elf_link_check_relocs (bfd *abf
/* "__ehdr_start" will be defined by linker as a hidden symbol
later if it is referenced and not defined. */
- h = elf_link_hash_lookup (elf_hash_table (info),
- "__ehdr_start",
- FALSE, FALSE, FALSE);
- if (h != NULL
- && (h->root.type == bfd_link_hash_new
- || h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_common))
+ elf_x86_linker_defined (info, "__ehdr_start");
+
+ if (bfd_link_executable (info))
{
- elf_x86_hash_entry (h)->local_ref = 2;
- elf_x86_hash_entry (h)->linker_def = 1;
- }
+ /* References to __bss_start, _end and _edata should be
+ locally resolved within executables. */
+ elf_x86_linker_defined (info, "__bss_start");
+ elf_x86_linker_defined (info, "_end");
+ elf_x86_linker_defined (info, "_edata");
+ }
}
}

View File

@ -0,0 +1,58 @@
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2018-06-01 09:10:37.866552789 +0100
+++ binutils-2.30/bfd/elf.c 2018-06-01 09:16:23.159605609 +0100
@@ -707,11 +707,23 @@ setup_group (bfd *abfd, Elf_Internal_Shd
|= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
break;
}
- if (idx >= shnum)
+ if (idx < shnum)
+ {
+ dest->shdr = elf_elfsections (abfd)[idx];
+ /* PR binutils/23199: All sections in a
+ section group should be marked with
+ SHF_GROUP. But some tools generate
+ broken objects without SHF_GROUP. Fix
+ them up here. */
+ dest->shdr->sh_flags |= SHF_GROUP;
+ }
+ if (idx >= shnum
+ || dest->shdr->sh_type == SHT_GROUP)
{
_bfd_error_handler
- (_("%B: invalid SHT_GROUP entry"), abfd);
- idx = 0;
+ (_("%B: invalid entry in SHT_GROUP section [%u]"),
+ abfd, i);
+ dest->shdr = NULL;
}
dest->shdr = elf_elfsections (abfd)[idx];
}
@@ -779,7 +791,8 @@ setup_group (bfd *abfd, Elf_Internal_Shd
idx = (Elf_Internal_Group *) shdr->contents;
n_elt = shdr->sh_size / 4;
while (--n_elt != 0)
- if ((s = (++idx)->shdr->bfd_section) != NULL
+ if ((++idx)->shdr != NULL
+ && (s = idx->shdr->bfd_section) != NULL
&& elf_next_in_group (s) != NULL)
break;
if (n_elt != 0)
diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c
--- binutils.orig/bfd/elfxx-x86.c 2018-06-01 09:10:37.854552926 +0100
+++ binutils-2.30/bfd/elfxx-x86.c 2018-06-01 09:21:10.570323575 +0100
@@ -1976,7 +1976,13 @@ _bfd_x86_elf_link_symbol_references_loca
return TRUE;
}
- eh->local_ref = 1;
+ /* Symbols created by HIDDEN and PROVIDE_HIDDEN assignments in linker
+ script aren't forced local here yet. bfd_hide_sym_by_version
+ can't be used to check if a versioned symbol is hidden. It has to
+ be syncd with _bfd_elf_link_assign_sym_version to get the correct
+ answer. */
+ if (!h->root.ldscript_def && h->versioned == unversioned)
+ eh->local_ref = 1;
return FALSE;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,137 @@
--- binutils.orig/bfd/elfxx-x86.c 2018-09-05 14:08:23.331182323 +0100
+++ binutils-2.30/bfd/elfxx-x86.c 2018-09-05 16:14:15.331921741 +0100
@@ -108,6 +108,7 @@ elf_x86_allocate_dynrelocs (struct elf_l
resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh);
+#if 0 /* Never optimize away PLT entries. They are needed by tools like rtld-audit and ltrace. */
/* We can't use the GOT PLT if pointer equality is needed since
finish_dynamic_symbol won't clear symbol value and the dynamic
linker won't update the GOT slot. We will get into an infinite
@@ -125,6 +126,7 @@ elf_x86_allocate_dynrelocs (struct elf_l
/* Use the GOT PLT. */
eh->plt_got.refcount = 1;
}
+#endif
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
here if it is defined and referenced in a non-shared object. */
diff -rup binutils.orig/ld/testsuite/ld-i386/i386.exp binutils-2.30/ld/testsuite/ld-i386/i386.exp
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2018-09-12 15:59:03.969158148 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/i386.exp 2018-09-12 16:23:41.579837859 +0100
@@ -1434,9 +1434,9 @@ run_ld_link_tests [list \
]
# Linux only tests
-run_dump_test "pltgot-1"
-run_dump_test "pltgot-2"
-run_dump_test "pr20830"
+# run_dump_test "pltgot-1"
+# run_dump_test "pltgot-2"
+# run_dump_test "pr20830"
run_dump_test "ibt-plt-1"
run_dump_test "ibt-plt-2a"
run_dump_test "ibt-plt-2b"
diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d binutils-2.30/ld/testsuite/ld-i386/pr19636-2d.d
--- binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d 2018-09-12 15:59:03.968158156 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/pr19636-2d.d 2018-09-12 16:20:30.046301550 +0100
@@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse
[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func
-
+#...
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
#...
diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d binutils-2.30/ld/testsuite/ld-i386/pr19636-2e.d
--- binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d 2018-09-12 15:59:03.966158171 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/pr19636-2e.d 2018-09-12 16:20:18.301391306 +0100
@@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse
[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func
-
+#...
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.30/ld/testsuite/ld-x86-64/plt-main-bnd.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2018-09-12 15:59:04.038157619 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2018-09-12 16:43:58.243317284 +0100
@@ -1,3 +1,4 @@
+#pass
#...
Disassembly of section .plt.got:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd binutils-2.30/ld/testsuite/ld-x86-64/plt-main-ibt.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2018-09-12 15:59:04.027157703 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2018-09-12 16:46:42.417060121 +0100
@@ -1,3 +1,4 @@
+#pass
#...
Disassembly of section .plt.got:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.30/ld/testsuite/ld-x86-64/plt-main.rd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd 2018-09-12 15:59:04.037157626 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/plt-main.rd 2018-09-12 16:34:34.950619373 +0100
@@ -1,4 +1,3 @@
-#failif
#...
[0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +bar \+ 0
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr19636-2e.d binutils-2.30/ld/testsuite/ld-x86-64/pr19636-2e.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr19636-2e.d 2018-09-12 15:59:04.034157649 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr19636-2e.d 2018-09-12 16:17:08.687840318 +0100
@@ -11,7 +11,7 @@ Relocation section '\.rela\.dyn' at offs
Relocation section '\.rela\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +func3 \+ 0
-
+#...
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2018-09-12 15:59:04.023157734 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2018-09-12 16:47:08.880857470 +0100
@@ -59,7 +59,7 @@ set x86_64tests {
"-shared -melf_x86_64 --no-ld-generated-unwind-info --hash-style=sysv" ""
"--64 -mrelax-relocations=yes"
{tlspic3.s tlspic2.s}
- {{readelf -WSsrl tlspic2.rd} {objdump -drj.text\ -Mintel64 tlspic2.dd}
+ {{objdump -drj.text\ -Mintel64 tlspic2.dd}
{objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
"libtlspic2.so"}
{"TLS descriptor -fpic -shared transitions"
@@ -1837,18 +1837,18 @@ if { "$LD_CLASS" == "64bit" } then {
# This test needs 64-bit linker.
run_dump_test "pr17618"
}
-run_dump_test "pltgot-1"
-run_dump_test "pltgot-2"
-run_dump_test "pr20830a"
-run_dump_test "pr20830b"
-run_dump_test "pr21038a"
-run_dump_test "pr21038b"
-run_dump_test "pr21038c"
-run_dump_test "pr20830a-now"
-run_dump_test "pr20830b-now"
-run_dump_test "pr21038a-now"
-run_dump_test "pr21038b-now"
-run_dump_test "pr21038c-now"
+# run_dump_test "pltgot-1"
+# run_dump_test "pltgot-2"
+# run_dump_test "pr20830a"
+# run_dump_test "pr20830b"
+# run_dump_test "pr21038a"
+# run_dump_test "pr21038b"
+# run_dump_test "pr21038c"
+# run_dump_test "pr20830a-now"
+# run_dump_test "pr20830b-now"
+# run_dump_test "pr21038a-now"
+# run_dump_test "pr21038b-now"
+# run_dump_test "pr21038c-now"
run_dump_test "ibt-plt-1"
run_dump_test "ibt-plt-1-x32"
run_dump_test "ibt-plt-2a"

View File

@ -0,0 +1,77 @@
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-10-08 15:24:17.980797510 +0100
+++ binutils-2.30/bfd/elf64-x86-64.c 2018-10-08 15:25:02.643458607 +0100
@@ -4399,15 +4399,23 @@ elf_x86_64_finish_dynamic_sections (bfd
if (htab->tlsdesc_plt)
{
+ /* The TLSDESC entry in a lazy procedure linkage table. */
+ static const bfd_byte tlsdesc_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+ {
+ 0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */
+ 0xff, 0x35, 8, 0, 0, 0, /* pushq GOT+8(%rip) */
+ 0xff, 0x25, 16, 0, 0, 0 /* jmpq *GOT+TDG(%rip) */
+ };
+
bfd_put_64 (output_bfd, (bfd_vma) 0,
htab->elf.sgot->contents + htab->tlsdesc_got);
memcpy (htab->elf.splt->contents + htab->tlsdesc_plt,
- htab->lazy_plt->plt0_entry,
- htab->lazy_plt->plt0_entry_size);
+ tlsdesc_plt_entry, LAZY_PLT_ENTRY_SIZE);
- /* Add offset for pushq GOT+8(%rip), since the
- instruction uses 6 bytes subtract this value. */
+ /* Add offset for pushq GOT+8(%rip), since ENDBR64 uses 4
+ bytes and the instruction uses 6 bytes, subtract these
+ values. */
bfd_put_32 (output_bfd,
(htab->elf.sgotplt->output_section->vma
+ htab->elf.sgotplt->output_offset
@@ -4415,14 +4423,13 @@ elf_x86_64_finish_dynamic_sections (bfd
- htab->elf.splt->output_section->vma
- htab->elf.splt->output_offset
- htab->tlsdesc_plt
- - 6),
+ - 4 - 6),
(htab->elf.splt->contents
+ htab->tlsdesc_plt
- + htab->lazy_plt->plt0_got1_offset));
- /* Add offset for the PC-relative instruction accessing
- GOT+TDG, where TDG stands for htab->tlsdesc_got,
- subtracting the offset to the end of that
- instruction. */
+ + 4 + 2));
+ /* Add offset for indirect branch via GOT+TDG, where TDG
+ stands for htab->tlsdesc_got, subtracting the offset
+ to the end of that instruction. */
bfd_put_32 (output_bfd,
(htab->elf.sgot->output_section->vma
+ htab->elf.sgot->output_offset
@@ -4430,10 +4437,9 @@ elf_x86_64_finish_dynamic_sections (bfd
- htab->elf.splt->output_section->vma
- htab->elf.splt->output_offset
- htab->tlsdesc_plt
- - htab->lazy_plt->plt0_got2_insn_end),
+ - 4 - 6 - 6),
(htab->elf.splt->contents
- + htab->tlsdesc_plt
- + htab->lazy_plt->plt0_got2_offset));
+ + htab->tlsdesc_plt + 4 + 6 + 2));
}
}
Only in binutils-2.30/bfd: elf64-x86-64.c.orig
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlsdesc.pd binutils-2.30/ld/testsuite/ld-x86-64/tlsdesc.pd
--- binutils.orig/ld/testsuite/ld-x86-64/tlsdesc.pd 2018-10-08 15:24:17.293802722 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/tlsdesc.pd 2018-10-08 15:25:07.515421664 +0100
@@ -13,7 +13,7 @@ Disassembly of section .plt:
[0-9a-f]+: ff 35 .. .. 20 00 pushq .*\(%rip\) # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
[0-9a-f]+: ff 25 .. .. 20 00 jmpq \*.*\(%rip\) # 201360 <_GLOBAL_OFFSET_TABLE_\+0x10>
[0-9a-f]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+ [0-9a-f]+: f3 0f 1e fa endbr64
[0-9a-f]+: ff 35 .. .. 20 00 pushq .*\(%rip\) # 201358 <_GLOBAL_OFFSET_TABLE_\+0x8>
[0-9a-f]+: ff 25 .. .. 20 00 jmpq \*.*\(%rip\) # 201348 <.*>
- [0-9a-f]+: 0f 1f 40 00 nopl 0x0\(%rax\)

File diff suppressed because it is too large Load Diff

3629
SPECS/binutils.spec Normal file

File diff suppressed because it is too large Load Diff