[m-dev.] diff: GCC back-end: fix Mmake shared lib bug

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 24 17:19:13 AEDT 2001


Estimated hours taken: 0.75

Fix a bug in the Mmake support for shared libraries
for `--target asm'.

scripts/Mmake.rules:
	When generating the `.pic_s' file, pass `--pic-reg' to mmc.

compiler/mlds_to_gcc.m:
	If `--pic-reg' is passed, generate the output in a `.pic_s'
	file, rather than a `.s' file.
	(XXX we should perhaps use a different option,
	e.g. `--pic', for this.)

Workspace: /home/hg/fjh/gcc-cvs/gcc/mercury
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.25
diff -u -d -r1.25 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	2001/01/22 14:47:05	1.25
+++ compiler/mlds_to_gcc.m	2001/01/23 17:09:54
@@ -185,8 +185,18 @@
 		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),
+	{ Pic = yes ->
+		PicExt = ".pic_s",
+		PicOpt = "-fpic "
+	;
+		PicExt = ".s",
+		PicOpt = ""
+	},
 	module_name_to_file_name(ModuleName, ".m", no, SourceFileName),
-	module_name_to_file_name(ModuleName, ".s", yes, AsmFileName),
+	module_name_to_file_name(ModuleName, PicExt, yes, AsmFileName),
 	% XXX should use new gcc_* options rather than
 	% reusing cflags, c_optimize
 	globals__io_lookup_bool_option(statistics, Statistics),
@@ -212,7 +222,7 @@
 		C_Flags_List)) },
 	% Be careful with the order here.
 	% Also be careful that each option is separated by spaces.
-	{ string__append_list(["""<GCC back-end>"" ",
+	{ string__append_list(["""<GCC back-end>"" ", PicOpt,
 		QuietOption, OptimizeOpt, Target_DebugOpt, CFLAGS,
 		SourceFileName, " -o ", AsmFileName], CommandLine) },
 	globals__io_lookup_bool_option(verbose, Verbose),
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.88
diff -u -d -r1.88 Mmake.rules
--- scripts/Mmake.rules	2001/01/23 16:12:55	1.88
+++ scripts/Mmake.rules	2001/01/24 06:10:19
@@ -175,9 +175,10 @@
 	$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
 		$< > $*.err 2>&1
 
+# XXX we should probably use a new `--pic' option rather than `--pic-reg'
 $(ss_subdir)%.pic_s : %.m
 	$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
-		--cflags "$(GCCFLAGS_FOR_PIC)" $< > $*.err 2>&1
+		--pic-reg --cflags "$(GCCFLAGS_FOR_PIC)" $< > $*.err 2>&1
 
 $(os_subdir)%.$O : $(ss_subdir)%.s
 	$(AS) $< $(OBJFILE_OPT)$@

-- 
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