+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-10-30 Alan Modra <amodra@gmail.com>
* powerpc.h (EF_PPC64_ABI): New enum constant.
R_X86_64_TLSDESC = 36, // 2 by 64-bit TLS descriptor
R_X86_64_IRELATIVE = 37, // Adjust indirectly 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.
R_X86_64_GNU_VTINHERIT = 250,
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>
* powerpc.cc (Target_powerpc::glink_section): Provide non-const
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 NATIVE_LINKER
@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@ 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@ 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_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@ 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_OBJECTS = basic_pic_test.$(OBJEXT)
basic_pic_test_LDADD = $(LDADD)
exception_test_OBJECTS = $(am_exception_test_OBJECTS)
exception_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(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@ exclude_libs_test.$(OBJEXT)
exclude_libs_test_OBJECTS = $(am_exclude_libs_test_OBJECTS)
$(exception_shared_1_test_SOURCES) \
$(exception_shared_2_test_SOURCES) \
$(exception_static_test_SOURCES) $(exception_test_SOURCES) \
+ $(exception_x86_64_bnd_test_SOURCES) \
$(exclude_libs_test_SOURCES) \
flagstest_compress_debug_sections.c flagstest_o_specialfile.c \
flagstest_o_specialfile_and_compress_debug_sections.c \
@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_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_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
all: $(BUILT_SOURCES)
exception_test$(EXEEXT): $(exception_test_OBJECTS) $(exception_test_DEPENDENCIES)
@rm -f exception_test$(EXEEXT)
$(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)
@rm -f exclude_libs_test$(EXEEXT)
$(exclude_libs_test_LINK) $(exclude_libs_test_OBJECTS) $(exclude_libs_test_LDADD) $(LIBS)
@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)
@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:
@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
@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@ $(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@ $(TEST_AS) -o $@ $<
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
case elfcpp::R_X86_64_PC64:
case elfcpp::R_X86_64_PC32:
+ case elfcpp::R_X86_64_PC32_BND:
case elfcpp::R_X86_64_PC16:
case elfcpp::R_X86_64_PC8:
case elfcpp::R_X86_64_GOTOFF64:
return Symbol::RELATIVE_REF;
case elfcpp::R_X86_64_PLT32:
+ case elfcpp::R_X86_64_PLT32_BND:
case elfcpp::R_X86_64_PLTOFF64:
return Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF;
// glibc supports these reloc types, but they can overflow.
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
// the symbol is defined locally.
if (gsym == NULL
object->error(_("requires dynamic R_X86_64_32 reloc which may "
"overflow at runtime; recompile with -fPIC"));
else
- object->error(_("requires dynamic %s reloc against '%s' which may "
- "overflow at runtime; recompile with -fPIC"),
- (r_type == elfcpp::R_X86_64_32
- ? "R_X86_64_32"
- : "R_X86_64_PC32"),
- gsym->name());
+ {
+ const char *r_name;
+ switch (r_type)
+ {
+ case elfcpp::R_X86_64_32:
+ 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;
return;
case elfcpp::R_X86_64_PC64:
case elfcpp::R_X86_64_PC32:
+ case elfcpp::R_X86_64_PC32_BND:
case elfcpp::R_X86_64_PC16:
case elfcpp::R_X86_64_PC8:
break;
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
// PC32 reloc.
break;
case elfcpp::R_X86_64_PC64:
case elfcpp::R_X86_64_PC32:
+ case elfcpp::R_X86_64_PC32_BND:
case elfcpp::R_X86_64_PC16:
case elfcpp::R_X86_64_PC8:
{
break;
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.
// Otherwise we need a PLT entry.
if (gsym->final_value_is_known())
if (this->skip_call_tls_get_addr_)
{
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)
|| gsym == NULL
|| strcmp(gsym->name(), "__tls_get_addr") != 0)
break;
case elfcpp::R_X86_64_PC32:
+ case elfcpp::R_X86_64_PC32_BND:
Relocate_functions<size, false>::pcrela32(view, object, psymval, addend,
address);
break;
break;
case elfcpp::R_X86_64_PLT32:
+ case elfcpp::R_X86_64_PLT32_BND:
gold_assert(gsym == NULL
|| gsym->has_plt_offset()
|| gsym->final_value_is_known()
case elfcpp::R_X86_64_32:
case elfcpp::R_X86_64_32S:
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_BND:
case elfcpp::R_X86_64_GOTPC32:
case elfcpp::R_X86_64_GOT32:
return 4;