📄 glibc_with_ptt
字号:
============================================================================== Building glibc with both traditional NPTL and NPTL with PTT support==============================================================================This document is intended for Linux distribution maintainers who would liketo provide PTT to their users. It explains how to build the glibc with bothtraditional NPTL and instrumented NPTL for PTT support. 1) PTT patch for glibc 2) Glibc building options 3) Guidelines for building glibc with PTT support 4) Building PTT with a friendly system glibc============================================================================== 1) PTT patch for glibc==============================================================================PTT comes with 3 patches for glibc version 2.3.4 to 2.3.6 and an experimentalpatch for glibc 2.4. These patches include:- trace points inserted into NPTL routines.- PTT module files that define functions used to collect trace point data.- additionnal options in glibc configuration files (configure.in, configure, config.h.in, config.make.in).- a modified nptl/Makefile.All things added in NPTL code are enclosed in preprocessor directives:- trace points are enclosed in: #ifdef PTT_LIBPTHREAD /* trace point instruction */ #endif /* PTT_LIBPTHREAD */- new files are enclosed in: #ifdef PTT_NEW_FILES /* new file code */ #endif /* PTT_NEW_FILES */PTT patches can be applied like this:$ cat ptt_glibc-2.x.x.patch | patch -d $GLIBC_SRC -p1============================================================================== 2) Glibc building options==============================================================================Once the PTT patch has been applied to the glibc, you can build the glibc inthree different ways:- if nothing special is done, the above macros (PTT_LIBPTHREAD and PTT_NEW_FILES are not defined), thus original glibc is built.- using --with-ptt in the glibc ./configure script defines PTT_LIBPTHREAD and PTT_NEW_FILES, thus glibc is built with PTT support. Of course, NPTL must be enabled (--with-tls). Modified files are those which match libpthread* (mainly libpthread-2.x.x.so).- using --with-ptt and --with-ptt-trace-info in the glibc ./configure script builds glibc with PTT support and trace points for PTT internals. This should be useful only for PTT developpers.============================================================================== 3) Guidelines for building glibc with PTT support==============================================================================If you plan to build a glibc with PTT support, you should follow the followingsteps (patch_glibc/install_glibc.sh does the same):1. Patch the glibc: $ cat ptt_glibc-2.x.x.patch | patch -d $GLIBC_SRC -p12. Build glibc with --with-ptt option.3. Rename libpthread-2.x.x.so in libptread_ptt-2.x.x.so and create a symbolic link libpthread_ptt.so.0 -> lipthread_ptt-2.x.x.so.4. Build glibc without --with-ptt option (traditional build). Libraries created in step 2 will be overrided by traditional libraries.You now have a traditional glibc lib directory with 2 new elements:- the instrumented NPTL libpthread_ptt-2.x.x.so- a link to this library libpthread_ptt.so.0============================================================================== 4) Building PTT with a friendly system glibc==============================================================================PTT can now be built without running patch/install_glibc.sh before. You justhave to run the ./configure script with the --with-ptt-friendly-glibc option.This option assumes that the system glibc has support for PTT (that is tosay, includes libpthread_ptt-2.x.x.so and libpthread_ptt.so.0).Assuming that $LIB is the system directory where libpthreads are installed(generally /lib), PTT is built with the following commands:$ cd $PTT$ ./configure --prefix=$INSTALL --with-friendly-ptt-glibc=$LIB$ make$ make install
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -