Changeset b157558 for chapter06/chapter06.xml
- Timestamp:
- 02/22/2004 10:32:27 PM (20 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.0, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, v5_1, v5_1_1, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- f89de33
- Parents:
- cd0c92d6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter06/chapter06.xml
rcd0c92d6 rb157558 503 503 504 504 505 <sect1 id="ch-system-aboutdebug"> 506 <title>About debugging symbols</title> 507 <?dbhtml filename="aboutdebug.html" dir="chapter06"?> 508 509 <para>Most programs and libraries are, by default, compiled with debugging 510 symbols included (with <command>gcc</command>'s <emphasis>-g</emphasis> 511 option). This means that, when debugging a program or library that was compiled 512 with debugging information included, the debugger can give you not only memory 513 addresses but also the names of the routines and variables.</para> 514 515 <para>The inclusion of these debugging symbols, however, enlarges a program or 516 library significantly. To get an idea of the amount of space these symbols 517 occupy, have a look at the following:</para> 518 519 <itemizedlist> 520 521 <listitem><para>a bash binary 522 with debugging symbols: 1200 KB</para></listitem> 523 524 <listitem><para>a bash binary 525 without debugging symbols: 480 KB</para></listitem> 526 527 <listitem><para>Glibc and GCC files (/lib and /usr/lib) 528 with debugging symbols: 87 MB</para></listitem> 529 530 <listitem><para>Glibc and GCC files 531 without debugging symbols: 16 MB</para></listitem> 532 533 </itemizedlist> 534 535 <para>Sizes may vary somewhat, depending on which compiler was used and which C 536 library, but when comparing programs with and without debugging symbols the 537 difference will generally be a factor between 2 and 5.</para> 538 539 <para>As most people will probably never use a debugger on their system 540 software, a lot of disk space can be regained by removing these symbols. For 541 your convenience, the next section shows how to strip all debugging symbols 542 from all programs and libraries. Information on other ways of optimizing your 543 system can be found in the hint at <ulink 544 url="&hints-root;optimization.txt"/>.</para> 545 546 </sect1> 547 548 549 <sect1 id="ch-system-strippingagain"> 550 <title>Stripping again</title> 551 <?dbhtml filename="strippingagain.html" dir="chapter06"?> 552 553 <para>If you are not a programmer and don't plan to do any debugging on your 554 system software, you can shrink your system by about 200 MB by removing the 555 debugging symbols from binaries and libraries. This causes no inconvenience 556 other than not being able to debug the software fully any more.</para> 557 558 <para>Most people who use the command mentioned below don't experience any 559 problems. But it is easy to make a typo and render your new system unusable, so 560 before running the strip command it is probably a good idea to make a backup of 561 the current situation.</para> 562 563 <para>If you are going to perform the stripping, special care is needed to 564 ensure you're not running any of the binaries that are about to be stripped. 565 If you're not sure whether you entered chroot with the command given in 566 <xref linkend="ch-system-chroot"/>, then now exit from chroot and reenter it 567 with the following commands:</para> 568 569 <screen><userinput>logout; chroot $LFS /tools/bin/env -i \ 570 HOME=/root TERM=$TERM PS1='\u:\w\$ ' \ 571 PATH=/bin:/usr/bin:/sbin:/usr/sbin \ 572 /tools/bin/bash --login</userinput></screen> 573 574 <para>Now you can safely strip the binaries and libraries:</para> 575 576 <screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ 577 -exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen> 578 579 <para>A large number of files will be reported as having their file format not 580 recognized. These warnings can be safely ignored, they just mean that those 581 files are scripts instead of binaries, no harm is done.</para> 582 583 <para>If you are really tight on disk space, you may want to use 584 <emphasis>--strip-all</emphasis> on the binaries in 585 <filename>/{,usr/}{bin,sbin}</filename> to gain several more megabytes. But do 586 <emphasis>not</emphasis> use this option on libraries: they would be 587 destroyed.</para> 588 589 </sect1> 590 591 505 592 <sect1 id="ch-system-revisedchroot"> 506 593 <title>Revised chroot command</title> 507 594 <?dbhtml filename="revisedchroot.html" dir="chapter06"?> 508 595 509 <para>From now on when you exit the chroot environment and wish to re -enter596 <para>From now on when you exit the chroot environment and wish to reenter 510 597 it, you should run the following modified chroot command:</para> 511 598 … … 522 609 </sect1> 523 610 524 525 &c6-aboutdebug;526 527 611 </chapter> 528 612
Note:
See TracChangeset
for help on using the changeset viewer.