[m-rev.] diff: improve PIC option handling
Simon Taylor
stayl at cs.mu.OZ.AU
Thu Feb 13 10:47:57 AEDT 2003
Estimated hours taken: 0.25
Branches: main
compiler/handle_options.m:
Make `--mercury-linkage shared' imply `--pic-reg'.
I don't think this actually fixes any bugs, because
compile_target_code.m worked out whether `--pic-reg'
was needed.
Index: handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.170
diff -u -u -r1.170 handle_options.m
--- handle_options.m 11 Feb 2003 04:32:46 -0000 1.170
+++ handle_options.m 12 Feb 2003 23:21:45 -0000
@@ -460,11 +460,28 @@
[]
),
+ %
+ % Set up options for position independent code.
+ %
+
+ % Shared libraries always use `--linkage shared'.
option_implies(compile_to_shared_lib, pic, bool(yes)),
- option_implies(pic, pic_reg, bool(yes)),
option_implies(compile_to_shared_lib, linkage, string("shared")),
option_implies(compile_to_shared_lib, mercury_linkage,
string("shared")),
+
+ % On x86, using PIC takes a register away from us.
+ option_implies(pic, pic_reg, bool(yes)),
+
+ % If we're linking with shared Mercury libraries, we need
+ % to use the same calling convention as those libraries.
+ globals__io_lookup_string_option(mercury_linkage, MercuryLinkage),
+ ( { MercuryLinkage = "shared" } ->
+ globals__io_set_option(pic_reg, bool(yes))
+ ;
+ []
+ ),
+
% --high-level-code disables the use of low-level gcc extensions
option_implies(highlevel_code, gcc_non_local_gotos, bool(no)),
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list