<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 2/19/20 8:20 PM, Li Wang wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEemH2c9v87NWM6k_t4d9Vi3wAYYjwfEJp2Cw-zG9pPHvdtV-Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_quote">
          <div class="gmail_default" style="font-size:small">Hi Xiao,</div>
          <div class="gmail_default" style="font-size:small"><br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            Why don't you avoid libftest.o as well if you want to build
            test by new rule?</blockquote>
          <div><br>
          </div>
          <div>
            <div class="gmail_default" style="font-size:small">That
              should be generated because it is the local library. In
              LTP Makefile, the sequencing is to build the library first
              then compile&link to the testcase. We can avoid
              dumping the testname.o since it only exists in the last
              phase. <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p>Hi Li,</p>
    <p>Thanks for your detailed explanation.</p>
    <p>I think you try to change the building rule, as below:</p>
    <p>Previous rule: generate all object files and then link them at
      the last phase.</p>
    <p>---------------------------------------------</p>
    <p>gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
      -Wold-style-definition -D_FORTIFY_SOURCE=2
      -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -I../../../../include -I../../../../include
      -I../../../../include/old/  -c -o swapoff01.o swapoff01.c<br>
      gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
      -Wold-style-definition -D_FORTIFY_SOURCE=2
      -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -I../../../../include -I../../../../include
      -I../../../../include/old/  -c -o ../swapon/libswapon.o
      ../swapon/libswapon.c<br>
      gcc   -L/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -L../../../../lib  swapoff01.o ../swapon/libswapon.o   -lltp -o
      swapoff01<br>
    </p>
    <p>---------------------------------------------<br>
    </p>
    <p>Current rule: just generate some common object files(e.g.
      library) and then mix building and link at the last phase. <br>
    </p>
    <p>---------------------------------------------</p>
    <p>gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
      -Wold-style-definition -D_FORTIFY_SOURCE=2
      -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -I../../../../include -I../../../../include
      -I../../../../include/old/  -c -o ../swapon/libswapon.o
      ../swapon/libswapon.c<br>
      gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
      -Wold-style-definition -D_FORTIFY_SOURCE=2
      -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -I../../../../include -I../../../../include
      -I../../../../include/old/  
      -L/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -L../../../../lib  swapoff01.c ../swapon/libswapon.o   -lltp -o
      swapoff01<br>
    </p>
    <p>---------------------------------------------</p>
    <p>Why don't you remove all object files and mix building and link
      at the last phase?</p>
    <p>---------------------------------------------</p>
    <p>gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
      -Wold-style-definition -D_FORTIFY_SOURCE=2
      -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -I../../../../include -I../../../../include
      -I../../../../include/old/  
      -L/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/
      -L../../../../lib  swapoff01.c ../swapon/libswapon.c   -lltp -o
      swapoff01<br>
    </p>
    <p>---------------------------------------------<br>
    </p>
    <blockquote type="cite"
cite="mid:CAEemH2c9v87NWM6k_t4d9Vi3wAYYjwfEJp2Cw-zG9pPHvdtV-Q@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_quote">
          <div>
            <div class="gmail_default" style="font-size:small"><br>
            </div>
            <div class="gmail_default" style="font-size:small">And, I
              don't want to change too much for LTP build rule(I think
              it works correctly), especially in the case directory some
              of the local libraries are reused.  e.g The swapoff test
              needs linking to ../swapon/libswapon.o, that
              requires libswapon.o is in the correct path.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <p>You can build and link libswapon.c directly, as below:</p>
    <p>---------------------------------</p>
    <p># grep MAKE_TARGETS Makefile<br>
      $(MAKE_TARGETS): %: ../swapon/libswapon.c<br>
    </p>
    <p>---------------------------------<br>
    </p>
    <p>Sorry, I am not sure if your improvement is the best way.</p>
    <p>Thanks,</p>
    <p>Xiao Yang<br>
    </p>
    <blockquote type="cite"
cite="mid:CAEemH2c9v87NWM6k_t4d9Vi3wAYYjwfEJp2Cw-zG9pPHvdtV-Q@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_quote">
          <div><br>
          </div>
          <div>
            <div class="gmail_default" style="font-size:small">Or, did I
              misunderstand your words? if yes, please correct me.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <blockquote type="cite"
cite="mid:CAEemH2c9v87NWM6k_t4d9Vi3wAYYjwfEJp2Cw-zG9pPHvdtV-Q@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_quote">
          <div><br>
          </div>
        </div>
        -- <br>
        <div dir="ltr" class="gmail_signature">
          <div dir="ltr">
            <div>Regards,<br>
            </div>
            <div>Li Wang<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>