Commit 0659b387 authored by H.J. Lu's avatar H.J. Lu

Add R_X86_64_PC32_BND/R_X86_64_PLT32_BND suppor to gold

elfcpp/

	* x86_64.h (R_X86_64_PC32_BND): New.
	(R_X86_64_PLT32_BND): Likewise.

gold/

	* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
	Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
	R_X86_64_PC32 and R_X86_64_PLT32, respectively.
	(Target_x86_64<size>::Scan::local): Likewise.
	(Target_x86_64<size>::Scan::global): Likewise.
	(Target_x86_64<size>::Relocate::relocate): Likewise.
	(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
	Likewise.
	(Target_x86_64<size>::Scan::check_non_pic(): Handle
	R_X86_64_PC32_BND.

	* testsuite/Makefile.am (check_PROGRAMS): Add
	exception_x86_64_bnd_test.
	(exception_x86_64_bnd_test_SOURCES): New macro.
	(exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
	(exception_x86_64_bnd_test_LDFLAGS): Likewise.
	(exception_x86_64_bnd_test_LDADD): Likewise.
	(exception_x86_64_bnd_1.o): New rule.
	(exception_x86_64_bnd_2.o): Likewise.
	* testsuite/Makefile.in: Regenerated.
parent b3eb037d
2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.h (R_X86_64_PC32_BND): New.
(R_X86_64_PLT32_BND): Likewise.
2013-11-15 Alan Modra <amodra@gmail.com> 2013-11-15 Alan Modra <amodra@gmail.com>
Apply mainline changes to 2.24 Apply mainline changes to 2.24
......
...@@ -92,6 +92,8 @@ enum ...@@ -92,6 +92,8 @@ enum
R_X86_64_TLSDESC = 36, // 2 by 64-bit TLS descriptor R_X86_64_TLSDESC = 36, // 2 by 64-bit TLS descriptor
R_X86_64_IRELATIVE = 37, // Adjust indirectly by program base R_X86_64_IRELATIVE = 37, // Adjust indirectly by program base
R_X86_64_RELATIVE64 = 38, // 64-bit adjust by program base R_X86_64_RELATIVE64 = 38, // 64-bit adjust by program base
R_X86_64_PC32_BND = 39, // PC relative 32 bit signed with BND prefix
R_X86_64_PLT32_BND = 40, // 32 bit PLT address with BND prefix
// GNU vtable garbage collection extensions. // GNU vtable garbage collection extensions.
R_X86_64_GNU_VTINHERIT = 250, R_X86_64_GNU_VTINHERIT = 250,
R_X86_64_GNU_VTENTRY = 251 R_X86_64_GNU_VTENTRY = 251
......
2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
R_X86_64_PC32 and R_X86_64_PLT32, respectively.
(Target_x86_64<size>::Scan::local): Likewise.
(Target_x86_64<size>::Scan::global): Likewise.
(Target_x86_64<size>::Relocate::relocate): Likewise.
(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
Likewise.
(Target_x86_64<size>::Scan::check_non_pic(): Handle
R_X86_64_PC32_BND.
* testsuite/Makefile.am (check_PROGRAMS): Add
exception_x86_64_bnd_test.
(exception_x86_64_bnd_test_SOURCES): New macro.
(exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
(exception_x86_64_bnd_test_LDFLAGS): Likewise.
(exception_x86_64_bnd_test_LDADD): Likewise.
(exception_x86_64_bnd_1.o): New rule.
(exception_x86_64_bnd_2.o): Likewise.
* testsuite/Makefile.in: Regenerated.
2013-11-15 Alan Modra <amodra@gmail.com> 2013-11-15 Alan Modra <amodra@gmail.com>
Apply changes from mainline to 2.24 Apply changes from mainline to 2.24
......
...@@ -2249,6 +2249,19 @@ incremental_comdat_test_1: incr_comdat_test_1.o incr_comdat_test_2_v1.o incr_com ...@@ -2249,6 +2249,19 @@ incremental_comdat_test_1: incr_comdat_test_1.o incr_comdat_test_2_v1.o incr_com
endif DEFAULT_TARGET_X86_64 endif DEFAULT_TARGET_X86_64
if DEFAULT_TARGET_X86_64
check_PROGRAMS += exception_x86_64_bnd_test
exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
exception_x86_64_bnd_test_DEPENDENCIES = exception_x86_64_bnd_1.o \
exception_x86_64_bnd_2.o
exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
exception_x86_64_bnd_test_LDADD = $(exception_x86_64_bnd_test_DEPENDENCIES)
exception_x86_64_bnd_1.o: exception_test_1.cc
$(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
exception_x86_64_bnd_2.o: exception_test_2.cc
$(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
endif DEFAULT_TARGET_X86_64
endif GCC endif GCC
endif NATIVE_LINKER endif NATIVE_LINKER
......
...@@ -557,7 +557,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ ...@@ -557,7 +557,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_6 \ @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_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_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@ 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_71 = two_file_test_tmp_2.o \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_71 = 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@ two_file_test_tmp_3.o \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4.base \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4.base \
...@@ -893,7 +894,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) ...@@ -893,7 +894,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@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_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_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_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@ incremental_comdat_test_1$(EXEEXT) \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_x86_64_bnd_test$(EXEEXT)
basic_pic_test_SOURCES = basic_pic_test.c basic_pic_test_SOURCES = basic_pic_test.c
basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT) basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT)
basic_pic_test_LDADD = $(LDADD) basic_pic_test_LDADD = $(LDADD)
...@@ -1022,6 +1024,11 @@ exception_static_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ ...@@ -1022,6 +1024,11 @@ exception_static_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
exception_test_OBJECTS = $(am_exception_test_OBJECTS) exception_test_OBJECTS = $(am_exception_test_OBJECTS)
exception_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ exception_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(exception_test_LDFLAGS) $(LDFLAGS) -o $@ $(exception_test_LDFLAGS) $(LDFLAGS) -o $@
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exception_x86_64_bnd_test_OBJECTS = exception_test_main.$(OBJEXT)
exception_x86_64_bnd_test_OBJECTS = \
$(am_exception_x86_64_bnd_test_OBJECTS)
exception_x86_64_bnd_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(exception_x86_64_bnd_test_LDFLAGS) $(LDFLAGS) -o $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_exclude_libs_test_OBJECTS = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@am_exclude_libs_test_OBJECTS = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exclude_libs_test.$(OBJEXT) @GCC_TRUE@@NATIVE_LINKER_TRUE@ exclude_libs_test.$(OBJEXT)
exclude_libs_test_OBJECTS = $(am_exclude_libs_test_OBJECTS) exclude_libs_test_OBJECTS = $(am_exclude_libs_test_OBJECTS)
...@@ -1781,6 +1788,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \ ...@@ -1781,6 +1788,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
$(exception_shared_1_test_SOURCES) \ $(exception_shared_1_test_SOURCES) \
$(exception_shared_2_test_SOURCES) \ $(exception_shared_2_test_SOURCES) \
$(exception_static_test_SOURCES) $(exception_test_SOURCES) \ $(exception_static_test_SOURCES) $(exception_test_SOURCES) \
$(exception_x86_64_bnd_test_SOURCES) \
$(exclude_libs_test_SOURCES) \ $(exclude_libs_test_SOURCES) \
flagstest_compress_debug_sections.c flagstest_o_specialfile.c \ flagstest_compress_debug_sections.c flagstest_o_specialfile.c \
flagstest_o_specialfile_and_compress_debug_sections.c \ flagstest_o_specialfile_and_compress_debug_sections.c \
...@@ -2598,6 +2606,12 @@ LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ ...@@ -2598,6 +2606,12 @@ LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
@GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so @GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
@GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,. @GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
@GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncvar_LDADD = ifuncvar.so @GCC_TRUE@@IFUNC_TRUE@@NATIVE_LINKER_TRUE@ifuncvar_LDADD = ifuncvar.so
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_DEPENDENCIES = exception_x86_64_bnd_1.o \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ 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)
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_test_LDADD = $(exception_x86_64_bnd_test_DEPENDENCIES)
@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
all: $(BUILT_SOURCES) all: $(BUILT_SOURCES)
...@@ -2726,6 +2740,9 @@ exception_static_test$(EXEEXT): $(exception_static_test_OBJECTS) $(exception_sta ...@@ -2726,6 +2740,9 @@ exception_static_test$(EXEEXT): $(exception_static_test_OBJECTS) $(exception_sta
exception_test$(EXEEXT): $(exception_test_OBJECTS) $(exception_test_DEPENDENCIES) exception_test$(EXEEXT): $(exception_test_OBJECTS) $(exception_test_DEPENDENCIES)
@rm -f exception_test$(EXEEXT) @rm -f exception_test$(EXEEXT)
$(exception_test_LINK) $(exception_test_OBJECTS) $(exception_test_LDADD) $(LIBS) $(exception_test_LINK) $(exception_test_OBJECTS) $(exception_test_LDADD) $(LIBS)
exception_x86_64_bnd_test$(EXEEXT): $(exception_x86_64_bnd_test_OBJECTS) $(exception_x86_64_bnd_test_DEPENDENCIES)
@rm -f exception_x86_64_bnd_test$(EXEEXT)
$(exception_x86_64_bnd_test_LINK) $(exception_x86_64_bnd_test_OBJECTS) $(exception_x86_64_bnd_test_LDADD) $(LIBS)
exclude_libs_test$(EXEEXT): $(exclude_libs_test_OBJECTS) $(exclude_libs_test_DEPENDENCIES) exclude_libs_test$(EXEEXT): $(exclude_libs_test_OBJECTS) $(exclude_libs_test_DEPENDENCIES)
@rm -f exclude_libs_test$(EXEEXT) @rm -f exclude_libs_test$(EXEEXT)
$(exclude_libs_test_LINK) $(exclude_libs_test_OBJECTS) $(exclude_libs_test_LDADD) $(LIBS) $(exclude_libs_test_LINK) $(exclude_libs_test_OBJECTS) $(exclude_libs_test_LDADD) $(LIBS)
...@@ -4239,6 +4256,8 @@ incremental_common_test_1.log: incremental_common_test_1$(EXEEXT) ...@@ -4239,6 +4256,8 @@ incremental_common_test_1.log: incremental_common_test_1$(EXEEXT)
@p='incremental_common_test_1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) @p='incremental_common_test_1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
incremental_comdat_test_1.log: incremental_comdat_test_1$(EXEEXT) incremental_comdat_test_1.log: incremental_comdat_test_1$(EXEEXT)
@p='incremental_comdat_test_1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) @p='incremental_comdat_test_1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
exception_x86_64_bnd_test.log: exception_x86_64_bnd_test$(EXEEXT)
@p='exception_x86_64_bnd_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
.test.log: .test.log:
@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post) @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
@am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@.test$(EXEEXT).log:
...@@ -5392,6 +5411,10 @@ uninstall-am: ...@@ -5392,6 +5411,10 @@ uninstall-am:
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ @sleep 1
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_1.o: exception_test_1.cc
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_2.o: exception_test_2.cc
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10.o: script_test_10.s @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@ $(TEST_AS) -o $@ $<
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld @NATIVE_OR_CROSS_LINKER_TRUE@script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
......
...@@ -2113,12 +2113,14 @@ Target_x86_64<size>::Scan::get_reference_flags(unsigned int r_type) ...@@ -2113,12 +2113,14 @@ Target_x86_64<size>::Scan::get_reference_flags(unsigned int r_type)
case elfcpp::R_X86_64_PC64: case elfcpp::R_X86_64_PC64:
case elfcpp::R_X86_64_PC32: case elfcpp::R_X86_64_PC32:
case elfcpp::R_X86_64_PC32_BND:
case elfcpp::R_X86_64_PC16: case elfcpp::R_X86_64_PC16:
case elfcpp::R_X86_64_PC8: case elfcpp::R_X86_64_PC8:
case elfcpp::R_X86_64_GOTOFF64: case elfcpp::R_X86_64_GOTOFF64:
return Symbol::RELATIVE_REF; return Symbol::RELATIVE_REF;
case elfcpp::R_X86_64_PLT32: case elfcpp::R_X86_64_PLT32:
case elfcpp::R_X86_64_PLT32_BND:
case elfcpp::R_X86_64_PLTOFF64: case elfcpp::R_X86_64_PLTOFF64:
return Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF; return Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF;
...@@ -2200,6 +2202,7 @@ Target_x86_64<size>::Scan::check_non_pic(Relobj* object, unsigned int r_type, ...@@ -2200,6 +2202,7 @@ Target_x86_64<size>::Scan::check_non_pic(Relobj* object, unsigned int r_type,
// glibc supports these reloc types, but they can overflow. // glibc supports these reloc types, but they can overflow.
case elfcpp::R_X86_64_PC32: case elfcpp::R_X86_64_PC32:
case elfcpp::R_X86_64_PC32_BND:
// A PC relative reference is OK against a local symbol or if // A PC relative reference is OK against a local symbol or if
// the symbol is defined locally. // the symbol is defined locally.
if (gsym == NULL if (gsym == NULL
...@@ -2219,12 +2222,28 @@ Target_x86_64<size>::Scan::check_non_pic(Relobj* object, unsigned int r_type, ...@@ -2219,12 +2222,28 @@ Target_x86_64<size>::Scan::check_non_pic(Relobj* object, unsigned int r_type,
object->error(_("requires dynamic R_X86_64_32 reloc which may " object->error(_("requires dynamic R_X86_64_32 reloc which may "
"overflow at runtime; recompile with -fPIC")); "overflow at runtime; recompile with -fPIC"));
else else
object->error(_("requires dynamic %s reloc against '%s' which may " {
"overflow at runtime; recompile with -fPIC"), const char *r_name;
(r_type == elfcpp::R_X86_64_32 switch (r_type)
? "R_X86_64_32" {
: "R_X86_64_PC32"), case elfcpp::R_X86_64_32:
gsym->name()); r_name = "R_X86_64_32";
break;
case elfcpp::R_X86_64_PC32:
r_name = "R_X86_64_PC32";
break;
case elfcpp::R_X86_64_PC32_BND:
r_name = "R_X86_64_PC32_BND";
break;
default:
gold_unreachable();
break;
}
object->error(_("requires dynamic %s reloc against '%s' "
"which may overflow at runtime; recompile "
"with -fPIC"),
r_name, gsym->name());
}
this->issued_non_pic_error_ = true; this->issued_non_pic_error_ = true;
return; return;
...@@ -2368,11 +2387,13 @@ Target_x86_64<size>::Scan::local(Symbol_table* symtab, ...@@ -2368,11 +2387,13 @@ Target_x86_64<size>::Scan::local(Symbol_table* symtab,
case elfcpp::R_X86_64_PC64: case elfcpp::R_X86_64_PC64:
case elfcpp::R_X86_64_PC32: case elfcpp::R_X86_64_PC32:
case elfcpp::R_X86_64_PC32_BND:
case elfcpp::R_X86_64_PC16: case elfcpp::R_X86_64_PC16:
case elfcpp::R_X86_64_PC8: case elfcpp::R_X86_64_PC8:
break; break;
case elfcpp::R_X86_64_PLT32: case elfcpp::R_X86_64_PLT32:
case elfcpp::R_X86_64_PLT32_BND:
// Since we know this is a local symbol, we can handle this as a // Since we know this is a local symbol, we can handle this as a
// PC32 reloc. // PC32 reloc.
break; break;
...@@ -2765,6 +2786,7 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab, ...@@ -2765,6 +2786,7 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab,
case elfcpp::R_X86_64_PC64: case elfcpp::R_X86_64_PC64:
case elfcpp::R_X86_64_PC32: case elfcpp::R_X86_64_PC32:
case elfcpp::R_X86_64_PC32_BND:
case elfcpp::R_X86_64_PC16: case elfcpp::R_X86_64_PC16:
case elfcpp::R_X86_64_PC8: case elfcpp::R_X86_64_PC8:
{ {
...@@ -2869,6 +2891,7 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab, ...@@ -2869,6 +2891,7 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab,
break; break;
case elfcpp::R_X86_64_PLT32: case elfcpp::R_X86_64_PLT32:
case elfcpp::R_X86_64_PLT32_BND:
// If the symbol is fully resolved, this is just a PC32 reloc. // If the symbol is fully resolved, this is just a PC32 reloc.
// Otherwise we need a PLT entry. // Otherwise we need a PLT entry.
if (gsym->final_value_is_known()) if (gsym->final_value_is_known())
...@@ -3217,6 +3240,8 @@ Target_x86_64<size>::Relocate::relocate( ...@@ -3217,6 +3240,8 @@ Target_x86_64<size>::Relocate::relocate(
if (this->skip_call_tls_get_addr_) if (this->skip_call_tls_get_addr_)
{ {
if ((r_type != elfcpp::R_X86_64_PLT32 if ((r_type != elfcpp::R_X86_64_PLT32
&& r_type != elfcpp::R_X86_64_PLT32_BND
&& r_type != elfcpp::R_X86_64_PC32_BND
&& r_type != elfcpp::R_X86_64_PC32) && r_type != elfcpp::R_X86_64_PC32)
|| gsym == NULL || gsym == NULL
|| strcmp(gsym->name(), "__tls_get_addr") != 0) || strcmp(gsym->name(), "__tls_get_addr") != 0)
...@@ -3320,6 +3345,7 @@ Target_x86_64<size>::Relocate::relocate( ...@@ -3320,6 +3345,7 @@ Target_x86_64<size>::Relocate::relocate(
break; break;
case elfcpp::R_X86_64_PC32: case elfcpp::R_X86_64_PC32:
case elfcpp::R_X86_64_PC32_BND:
Relocate_functions<size, false>::pcrela32(view, object, psymval, addend, Relocate_functions<size, false>::pcrela32(view, object, psymval, addend,
address); address);
break; break;
...@@ -3343,6 +3369,7 @@ Target_x86_64<size>::Relocate::relocate( ...@@ -3343,6 +3369,7 @@ Target_x86_64<size>::Relocate::relocate(
break; break;
case elfcpp::R_X86_64_PLT32: case elfcpp::R_X86_64_PLT32:
case elfcpp::R_X86_64_PLT32_BND:
gold_assert(gsym == NULL gold_assert(gsym == NULL
|| gsym->has_plt_offset() || gsym->has_plt_offset()
|| gsym->final_value_is_known() || gsym->final_value_is_known()
...@@ -4151,7 +4178,9 @@ Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc( ...@@ -4151,7 +4178,9 @@ Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc(
case elfcpp::R_X86_64_32: case elfcpp::R_X86_64_32:
case elfcpp::R_X86_64_32S: case elfcpp::R_X86_64_32S:
case elfcpp::R_X86_64_PC32: case elfcpp::R_X86_64_PC32:
case elfcpp::R_X86_64_PC32_BND:
case elfcpp::R_X86_64_PLT32: case elfcpp::R_X86_64_PLT32:
case elfcpp::R_X86_64_PLT32_BND:
case elfcpp::R_X86_64_GOTPC32: case elfcpp::R_X86_64_GOTPC32:
case elfcpp::R_X86_64_GOT32: case elfcpp::R_X86_64_GOT32:
return 4; return 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment