This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold patch committed: Add -z notext, use it in testsuite


One of the gold tests fails on Solaris because on Solaris gcc passes -z
text when using -shared.  The GNU linker does not support -z text and
simply ignores it (as is true of all unrecognized -z options).  Gold
does support -z text, which causes it to reject shared libraries with
dynamic relocations in the text segment.  Some of the tests are
specifically testing that that works, and those tests fails.  This patch
adds -z notext, which overrides a -z text appearing earlier on the
command line, and uses it for all tests which might need it.  Committed
to mainline.

Ian


2011-07-01  Ian Lance Taylor  <iant@google.com>

	PR gold/12525
	* options.h (class General_options): Support -z notext.
	* testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
	-Wl,-z,notext.
	(two_file_shared_nonpic.so): Likewise.
	(two_file_shared_mixed.so): Likewise.
	(two_file_shared_mixed_1.so): Likewise.
	(weak_undef_lib_nonpic.so): Likewise.
	(alt/weak_undef_lib_nonpic.so): Likewise.
	(tls_test_shared_nonpic.so): Likewise.
	* testsuite/Makefile.in: Rebuild.


Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.162
diff -u -p -r1.162 options.h
--- options.h	1 Jul 2011 22:05:01 -0000	1.162
+++ options.h	2 Jul 2011 00:37:09 -0000
@@ -1170,7 +1170,7 @@ class General_options
 	      N_("Don't mark variables read-only after relocation"));
   DEFINE_bool(text, options::DASH_Z, '\0', false,
 	      N_("Do not permit relocations in read-only segments"),
-	      NULL);
+	      N_("Permit relocations in read-only segments (default)"));
   DEFINE_bool_alias(textoff, text, options::DASH_Z, '\0',
 		    N_("Permit relocations in read-only segments (default)"),
 		    NULL, true);
Index: testsuite/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.am,v
retrieving revision 1.169
diff -u -p -r1.169 Makefile.am
--- testsuite/Makefile.am	2 Jul 2011 00:19:04 -0000	1.169
+++ testsuite/Makefile.am	2 Jul 2011 00:37:09 -0000
@@ -428,15 +428,15 @@ check_PROGRAMS += two_file_separate_shar
 check_PROGRAMS += two_file_mixed_shared_test
 check_PROGRAMS += two_file_mixed_2_shared_test
 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
-	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o
+	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
 	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
-	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o
+	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
-	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o
+	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
-	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so
+	$(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
 
 two_file_shared_1_nonpic_test_SOURCES = \
 	two_file_test_2.cc two_file_test_main.cc
@@ -620,10 +620,10 @@ weak_undef_file1_nonpic.o: weak_undef_fi
 weak_undef_file2_nonpic.o: weak_undef_file2.cc
 	$(CXXCOMPILE) -c -o $@ $<
 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
-	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o
+	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
 	test -d alt || mkdir -p alt
-	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o
+	$(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
 endif FN_PTRS_IN_SO_WITHOUT_PIC
 
 
@@ -809,7 +809,7 @@ endif
 if FN_PTRS_IN_SO_WITHOUT_PIC
 check_PROGRAMS += tls_shared_nonpic_test
 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
-	$(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
+	$(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
 
 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]