Print this page
crt: Need a position-independent CRT for PIE
- Implement the greatest possible part of the crt1 in C
- Implement SPARC versions of the ASM sections of crt1
- Build crt1 position-independently, minor ASM updates to be position
  independent
- Implement crt1 with the hook expected by modern GCC to support
  profiling, make gcrt1 a symlink for source compatibility (older GCC
  initializes profiling at firsnt use of _mcount if necessary, so
  doesn't need the gcrt)
- Split the CRT out of developer/library/lint into a separate c-runtime package

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/amd64/Makefile
          +++ new/usr/src/lib/libc/amd64/Makefile
↓ open down ↓ 973 lines elided ↑ open up ↑
 974  974          $(COMSYSOBJS)           \
 975  975          $(SYSOBJS)              \
 976  976          $(COMSYSOBJS64)         \
 977  977          $(SYSOBJS64)            \
 978  978          $(VALUES)
 979  979  
 980  980  TRACEOBJS=                      \
 981  981          plockstat.o
 982  982  
 983  983  # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
 984      -# modules whose source is provided in the $(SRC)/lib/common directory.
      984 +# modules whose source is provided in the $(SRC)/lib/crt directory.
 985  985  # This must be done because otherwise the Sun C compiler would insert
 986  986  # its own versions of these modules and those versions contain code
 987  987  # to call out to C++ initialization functions.  Such C++ initialization
 988  988  # functions can call back into libc before thread initialization is
 989  989  # complete and this leads to segmentation violations and other problems.
 990  990  # Since libc contains no C++ code, linking with the minimal crti.o and
 991  991  # crtn.o modules is safe and avoids the problems described above.
 992  992  OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
 993      -CRTSRCS= ../../common/amd64
      993 +CRTSRCS= ../../crt/amd64
 994  994  
 995  995  # include common library definitions
 996  996  include ../../Makefile.lib
 997  997  include ../../Makefile.lib.64
 998  998  
 999  999  CFLAGS64 += $(CTF_FLAGS)
1000 1000  
1001 1001  # This is necessary to avoid problems with calling _ex_unwind().
1002 1002  # We probably don't want any inlining anyway.
1003 1003  CFLAGS64 += -xinline=
↓ open down ↓ 253 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX