Replace The Macro In The GCC Link Script

Run gcc -E -D BOOTDIR=$(pwd) -P -x c boot/arch/riscv/boot0.lds

  • -E Preprocess only; do not compile, assemble or link.
  • -D Define macro.
  • -P Inhibit generation of linemarkers in the output from the preprocessor.[a]
  • -x c Specify the language of the following input files is c.(1)

pwd
/home/source/workspace/riscv-flare
sed -n '9,12p' boot/arch/riscv/boot0.lds 
        .head   :
        {
                BOOTDIR/boot0_head.o    (.rodata)
        }
gcc -E -D BOOTDIR=$(pwd) -P -x c boot/arch/riscv/boot0.lds | sed -n '8,11p'
 .head :
 {
  /home/source/workspace/riscv-flare/boot0_head.o (.rodata)
 }

(1) run gcc --help | grep "\-x".
K P​ A F D