2 * Copyright (c) 2014 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
8 * Ensure that linker symbol name rewriting works.
10 * When using ``-Wl,--wrap=sym``, the ``sym`` definition is rewritten to
11 * ``__real_sym`` and all calls/declarations of ``sym`` are rewritten to
12 * `__wrap_sym``. Note that this only applies across object files,
13 * direct calls within an object file are unaffected.
15 * The wrap_lib{1,2}.c files are built as an archive and linked with
16 * wrap_main.c. They contain the ``foo`` and ``bar`` definitions as well
17 * as their wrapped equivalents. wrap_main.c calls ``foo`` and ``bar``,
18 * which are rewritten to calls to the ``__wrap_*`` functions
19 * instead. The ``__wrap_*`` functions then call the ``__real_*`` ones,
20 * which are the now-renamed ``foo`` and ``bar``.
22 * The golden file expects the four functions to get called, and as an
23 * extra check we expect the sum of the return value of the functions to
24 * be 2+3+5+7 (the return value of each of the four functions).
35 return f + b == 17 ? EXIT_SUCCESS : EXIT_FAILURE;