gcclinkercmocka

GCC linker : passing multiple --wrap=<function>


I am adding quite a few mocks, using cmocka, which require me to alias them using the GC Clinker opetion --wrap=

I am passing a linker option of the format

-Wl,--wrap=foo,--wrap=bar,--wrap=baz,--wrap= ...

Is there any way to shorten it?

-Wl,--wrap=foo,bar,baz,... did not work. Any suggestions?


Solution

  • Is there any way to shorten it?

    No.

    Why would you want to? If you care about the length of the resulting command line, note that GCC supports response files:

    echo "-Wl,--wrap=foo,--wrap=bar,--wrap=baz,--wrap=..." > cmd
    gcc @cmd ...