[m-dev.] for review: add `--pic' option, for GCC back-end

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Mar 1 02:24:39 AEDT 2001


Estimated hours taken: 0.5

Fix a problem where the nightly tests were failing the `--target asm'
tests, because they were passing `--pic-reg', and that option was
being used with different semantics for the gcc back-end.

compiler/options.m:
	Add new `--pic' option.

compiler/mlds_to_gcc.m:
	Use `--pic' rather than (ab)using `--pic-reg'.

doc/user_guide.texi:
	Document the new option.

Workspace: /home/venus/fjh/ws-venus2/mercury
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.32
diff -u -d -r1.32 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	2001/02/20 07:52:19	1.32
+++ compiler/mlds_to_gcc.m	2001/02/28 15:13:04
@@ -199,9 +199,7 @@
 		io__state::di, io__state::uo) is det.
 
 do_call_gcc_backend(ModuleName, Result) -->
-	% XXX should use new --pic option rather than
-	% reusing --pic-reg
-	globals__io_lookup_bool_option(pic_reg, Pic),
+	globals__io_lookup_bool_option(pic, Pic),
 	{ Pic = yes ->
 		PicExt = ".pic_s",
 		PicOpt = "-fpic "
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.313
diff -u -d -r1.313 options.m
--- compiler/options.m	2001/02/19 06:28:35	1.313
+++ compiler/options.m	2001/02/28 15:22:45
@@ -282,6 +282,7 @@
 		;	cflags_for_regs
 		;	cflags_for_gotos
 		;	cflags_for_threads
+		;	pic
 		;	target_debug	
 		;	c_include_directory
 		;	c_flag_to_name_object_file
@@ -655,6 +656,7 @@
 					% the `mmc' script will override the
 					% above three defaults with values
 					% determined at configuration time
+	pic			-	bool(no),
 	target_debug		-	bool(no),
 	c_include_directory	-	accumulating([]),
 					% the `mmc' script will override the
@@ -996,6 +998,7 @@
 % long_option("require-tracing",       require_tracing).
 long_option("use-trail",		use_trail).
 long_option("use-minimal-model",	use_minimal_model).
+long_option("pic",			pic).
 long_option("pic-reg",			pic_reg).
 long_option("tags",			tags).
 long_option("num-tag-bits",		num_tag_bits).
@@ -2199,6 +2202,12 @@
 		"\tthe Mercury compiler itself (and probably not even then).",
 		"\tCauses the generated code to become VERY big and VERY",
 		"\tinefficient.  Slows down compilation a LOT.",
+
+		"--pic",
+		"\tGenerate position-independent code.",
+		"\tThis option is only used by the `--target asm' back-end.",
+		"\tThe generated assembler code will be written to",
+		"\t`<module>.pic_s' rather than to `<module>.s'.",
 
 		"--target-debug",
 		"\tEnable debugging of the generated target code.",
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.241
diff -u -d -r1.241 user_guide.texi
--- doc/user_guide.texi	2001/02/19 06:28:40	1.241
+++ doc/user_guide.texi	2001/02/28 15:21:36
@@ -3722,6 +3722,13 @@
 inefficient, and slows down compilation a lot.
 
 @sp 1
+ at item @code{--pic}
+Generate position independent code.
+This option is only used by the @samp{--target asm} back-end.
+The generated assembler will be written to @samp{@var{module}.pic_s}
+rather than to @samp{@var{module}.s}.
+
+ at sp 1
 @item @code{--target-debug}
 Enable debugging of the generated target code.
 If the target language is C, this has the same effect as

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list