#9871: Change compiler flags on Solaris to build without text relocations.
----------------------------+-----------------------------------------------
   Reporter:  drkirkby      |       Owner:  GeorgSWeber                         
        
       Type:  defect        |      Status:  needs_work                          
        
   Priority:  critical      |   Milestone:  sage-4.6                            
        
  Component:  build         |    Keywords:                                      
        
     Author:  David Kirkby  |    Upstream:  None of the above - read trac for 
reasoning.
   Reviewer:                |      Merged:                                      
        
Work_issues:                |  
----------------------------+-----------------------------------------------

Comment(by drkirkby):

 It looks like we need {{{-z text}}} to be passed to the linker. From the
 linker man page:

 {{{
     -z text

          In dynamic mode only, forces a fatal error if any  relo-
          cations   against   non-writable,  allocatable  sections
          remain. For historic  reasons,  this  mode  is  not  the
          default  when  building  an executable or shared object.
          However, its use is recommended to insure that the  text
          segment  of  the dynamic object being built is shareable
          between multiple running processes. A shared  text  seg-
          ment  incurs  the  least relocation overhead when loaded
          into memory.
 }}}

 Adding that to the linker flags avoids the issue:

 {{{
 (sage subshell) t2:src kirkby$ make
 gcc -m64  -DENABLE_LONG_OPTIONS -o cl.o -c cl.c
 gcc -m64    -c -o cliquer.o cliquer.c
 gcc -m64    -c -o graph.o graph.c
 gcc -m64    -c -o reorder.o reorder.c
 gcc -m64   -Wl,-ztext -o libcliquer.so cl.o cliquer.o graph.o reorder.o
 SAGE_ROOT=/rootpool2/local/kirkby/t2/64/sage-4.5.3.alpha2
 (sage subshell) t2:src kirkby$ elfdump -d libcliquer.so | grep TEXTRE
 SAGE_ROOT=/rootpool2/local/kirkby/t2/64/sage-4.5.3.alpha2
 }}}

 However, I have '''not''' checked if this produces a usable shared library
 or not. (Note, it is OK to use {{{-ztext}}} rather than {{{-z text}}}. It
 stops one having to put quotes around things and is perfectly acceptable
 to the Sun linker and in fact Sun tools in general.

 This '''could''' be the magic option needed to sort out R and ECL, both of
 which suffer this problem.

 Dave

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9871#comment:22>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to