diff options
author | Cary Coutant <ccoutant@google.com> | 2010-09-12 19:58:02 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2010-09-12 19:58:02 +0000 |
commit | d89051bdb1e0cf96b89a41c1e0bda50ee1bc288a (patch) | |
tree | ac956adca25f822cb2d6b8d51438e2ce2309a39b | |
parent | e866c49707d6b97b6763baddaa2773e4ee893102 (diff) | |
download | gdb-d89051bdb1e0cf96b89a41c1e0bda50ee1bc288a.zip gdb-d89051bdb1e0cf96b89a41c1e0bda50ee1bc288a.tar.gz gdb-d89051bdb1e0cf96b89a41c1e0bda50ee1bc288a.tar.bz2 |
* symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
position-independent executables to shared libraries need dynamic
relocations.
(Symbol::may_need_copy_reloc): Do not generate COPY relocs in
position-independent executables.
* testsuite/Makefile.am (two_file_mixed_pie_test): New test.
* testsuite/Makefile.in: Regenerate.
-rw-r--r-- | gold/ChangeLog | 10 | ||||
-rw-r--r-- | gold/symtab.h | 5 | ||||
-rw-r--r-- | gold/testsuite/Makefile.am | 5 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 28 |
4 files changed, 44 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index df34bcf..6c78bcf 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,13 @@ +2010-09-12 Cary Coutant <ccoutant@google.com> + + * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from + position-independent executables to shared libraries need dynamic + relocations. + (Symbol::may_need_copy_reloc): Do not generate COPY relocs in + position-independent executables. + * testsuite/Makefile.am (two_file_mixed_pie_test): New test. + * testsuite/Makefile.in: Regenerate. + 2010-09-10 Nick Clifton <nickc@redhat.com> PR gold/11997 diff --git a/gold/symtab.h b/gold/symtab.h index e64fa1a..e355b2a 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -657,7 +657,8 @@ class Symbol // shared library cannot use a PLT entry. if ((flags & FUNCTION_CALL) && this->has_plt_offset() - && !((flags & NON_PIC_REF) && parameters->options().shared())) + && !((flags & NON_PIC_REF) + && parameters->options().output_is_position_independent())) return false; // A reference to any PLT entry in a non-position-independent executable @@ -798,7 +799,7 @@ class Symbol bool may_need_copy_reloc() const { - return (!parameters->options().shared() + return (!parameters->options().output_is_position_independent() && parameters->options().copyreloc() && this->is_from_dynobj() && !this->is_func()); diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index c79c856..064f44d 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -461,6 +461,11 @@ two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_ two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so +check_PROGRAMS += two_file_mixed_pie_test +two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \ + two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld + $(CXXLINK) -Bgcctestdir/ -Wl,-R,. -pie two_file_test_1.o two_file_test_1b_pie.o two_file_test_main_pie.o two_file_shared_2.so + endif FN_PTRS_IN_SO_WITHOUT_PIC check_PROGRAMS += two_file_strip_test diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index cc591ef..7f62404 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -160,7 +160,8 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_nonpic_test \ @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test \ @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_shared_test \ -@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_2_shared_test +@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_2_shared_test \ +@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_pie_test @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_6 = two_file_strip_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_strip_test \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ common_test_1 common_test_2 \ @@ -592,7 +593,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_nonpic_test$(EXEEXT) \ @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_nonpic_test$(EXEEXT) \ @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_shared_test$(EXEEXT) \ -@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_2_shared_test$(EXEEXT) +@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_2_shared_test$(EXEEXT) \ +@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_pie_test$(EXEEXT) @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_3 = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_strip_test$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_strip_test$(EXEEXT) \ @@ -1269,6 +1271,12 @@ two_file_mixed_2_shared_test_OBJECTS = \ two_file_mixed_2_shared_test_LINK = $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(two_file_mixed_2_shared_test_LDFLAGS) $(LDFLAGS) \ -o $@ +two_file_mixed_pie_test_SOURCES = two_file_mixed_pie_test.c +two_file_mixed_pie_test_OBJECTS = two_file_mixed_pie_test.$(OBJEXT) +two_file_mixed_pie_test_LDADD = $(LDADD) +two_file_mixed_pie_test_DEPENDENCIES = libgoldtest.a ../libgold.a \ + ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_mixed_shared_test_OBJECTS = two_file_test_main.$(OBJEXT) two_file_mixed_shared_test_OBJECTS = \ $(am_two_file_mixed_shared_test_OBJECTS) @@ -1518,6 +1526,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \ $(tls_shared_nonpic_test_SOURCES) $(tls_shared_test_SOURCES) \ $(tls_static_pic_test_SOURCES) $(tls_static_test_SOURCES) \ $(tls_test_SOURCES) $(two_file_mixed_2_shared_test_SOURCES) \ + two_file_mixed_pie_test.c \ $(two_file_mixed_shared_test_SOURCES) \ $(two_file_pic_test_SOURCES) two_file_pie_test.c \ $(two_file_relocatable_test_SOURCES) \ @@ -2765,6 +2774,15 @@ tls_test$(EXEEXT): $(tls_test_OBJECTS) $(tls_test_DEPENDENCIES) two_file_mixed_2_shared_test$(EXEEXT): $(two_file_mixed_2_shared_test_OBJECTS) $(two_file_mixed_2_shared_test_DEPENDENCIES) @rm -f two_file_mixed_2_shared_test$(EXEEXT) $(two_file_mixed_2_shared_test_LINK) $(two_file_mixed_2_shared_test_OBJECTS) $(two_file_mixed_2_shared_test_LDADD) $(LIBS) +@FN_PTRS_IN_SO_WITHOUT_PIC_FALSE@two_file_mixed_pie_test$(EXEEXT): $(two_file_mixed_pie_test_OBJECTS) $(two_file_mixed_pie_test_DEPENDENCIES) +@FN_PTRS_IN_SO_WITHOUT_PIC_FALSE@ @rm -f two_file_mixed_pie_test$(EXEEXT) +@FN_PTRS_IN_SO_WITHOUT_PIC_FALSE@ $(LINK) $(two_file_mixed_pie_test_OBJECTS) $(two_file_mixed_pie_test_LDADD) $(LIBS) +@GCC_FALSE@two_file_mixed_pie_test$(EXEEXT): $(two_file_mixed_pie_test_OBJECTS) $(two_file_mixed_pie_test_DEPENDENCIES) +@GCC_FALSE@ @rm -f two_file_mixed_pie_test$(EXEEXT) +@GCC_FALSE@ $(LINK) $(two_file_mixed_pie_test_OBJECTS) $(two_file_mixed_pie_test_LDADD) $(LIBS) +@NATIVE_LINKER_FALSE@two_file_mixed_pie_test$(EXEEXT): $(two_file_mixed_pie_test_OBJECTS) $(two_file_mixed_pie_test_DEPENDENCIES) +@NATIVE_LINKER_FALSE@ @rm -f two_file_mixed_pie_test$(EXEEXT) +@NATIVE_LINKER_FALSE@ $(LINK) $(two_file_mixed_pie_test_OBJECTS) $(two_file_mixed_pie_test_LDADD) $(LIBS) two_file_mixed_shared_test$(EXEEXT): $(two_file_mixed_shared_test_OBJECTS) $(two_file_mixed_shared_test_DEPENDENCIES) @rm -f two_file_mixed_shared_test$(EXEEXT) $(two_file_mixed_shared_test_LINK) $(two_file_mixed_shared_test_OBJECTS) $(two_file_mixed_shared_test_LDADD) $(LIBS) @@ -2956,6 +2974,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test_file2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test_main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_mixed_pie_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_pie_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_strip_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_1.Po@am__quote@ @@ -3380,6 +3399,8 @@ two_file_mixed_shared_test.log: two_file_mixed_shared_test$(EXEEXT) @p='two_file_mixed_shared_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) two_file_mixed_2_shared_test.log: two_file_mixed_2_shared_test$(EXEEXT) @p='two_file_mixed_2_shared_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +two_file_mixed_pie_test.log: two_file_mixed_pie_test$(EXEEXT) + @p='two_file_mixed_pie_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) two_file_strip_test.log: two_file_strip_test$(EXEEXT) @p='two_file_strip_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) two_file_same_shared_strip_test.log: two_file_same_shared_strip_test$(EXEEXT) @@ -3877,6 +3898,9 @@ uninstall-am: @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so +@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \ +@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld +@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,-R,. -pie two_file_test_1.o two_file_test_1b_pie.o two_file_test_main_pie.o two_file_shared_2.so @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_strip_test: two_file_test @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_STRIP) -o two_file_strip_test two_file_test @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_strip.so: two_file_shared.so |