Working with libraries: Difference between revisions
| (2 intermediate revisions by the same user not shown) | |||
| Line 16: | Line 16: | ||
==Building with libraries== | ==Building with libraries== | ||
* If the library supports [ | * If the library supports [[pkg-config]], and you're willing to depend on that tool being installed, proper compilation flags can be lifted from it: | ||
** <tt>pkg-config --cflags ''pkgname''</tt> will pull the preprocessor and compilation flags | ** <tt>pkg-config --cflags ''pkgname''</tt> will pull the preprocessor and compilation flags | ||
** <tt>pkg-config --libs ''pkgname''</tt> will pull the linking flags | ** <tt>pkg-config --libs ''pkgname''</tt> will pull the linking flags | ||
| Line 24: | Line 24: | ||
===Environment variables that control ld.so=== | ===Environment variables that control ld.so=== | ||
===Files that control ld.so=== | ===Files that control ld.so=== | ||
* The presence of <tt>/etc/ld.so.nohwcap</tt> precludes use of optimized library versions | |||
===Interpositioning=== | ===Interpositioning=== | ||
* Using the GNU linker, a particular object can wrap a symbol via <tt>-Wl,--wrap,symbolname</tt>. This will result in calls to <tt>symbolname</tt> resolving to <tt>__wrap_symbolname</tt>, and calls to <tt>__real_symbolname</tt> to resolve <tt>symbolname</tt>. | * Using the GNU linker, a particular object can wrap a symbol via <tt>-Wl,--wrap,symbolname</tt>. This will result in calls to <tt>symbolname</tt> resolving to <tt>__wrap_symbolname</tt>, and calls to <tt>__real_symbolname</tt> to resolve <tt>symbolname</tt>. | ||
| Line 30: | Line 32: | ||
===What the hell is linux-gate.so.1?=== | ===What the hell is linux-gate.so.1?=== | ||
The SYSENTER/SYSEXIT instructions of some Pentium processors provides a faster way to switch rings (a callgate, hence the name). [http://www.trilithium.com/johan/2005/08/linux-gate/ This page] explains pretty well what's going on. | The [[MSR|SYSENTER/SYSEXIT]] instructions of some Pentium processors provides a faster way to switch rings (a callgate, hence the name). [http://www.trilithium.com/johan/2005/08/linux-gate/ This page] explains pretty well what's going on. | ||
==Quality Assurance== | ==Quality Assurance== | ||