From 6026724d1abc45b7d14dbcc95c7a87933282dad3 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 15 Aug 2025 10:59:12 +0800 Subject: [PATCH] gcc-pass1: Explain -i.orig A frequently asked question is "why not using -i.orig instead of -i for ${some_random_sed_command_in_book}" but I really expect people to learn from this example and do it on their own if they really need... --- chapter05/gcc-pass1.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 6ea6d48b6..3a537e014 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -72,6 +72,23 @@ mv -v mpc-&mpc-version; mpc ;; esac + + + This example demonstrates the use of the + -i.orig switch. It makes the + sed copy the t-linux64 + to t-linux64.orig, and then edit the + t-linux64 inplace. So you may run + diff -u gcc/config/i386/t-linux64{.orig,} + to visualize the change done by the sed command + afterwards. We'll simply use -i (which just + edits the original file inplace without copying it) for all other + packages in the book, but you can change it to + -i.orig in any case you want to keep a copy + of the original file. + + + The GCC documentation recommends building GCC in a dedicated build directory: