1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright (C) 2010 Apple Inc. All rights reserved.
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
5bf215546Sopenharmony_ci * modification, are permitted provided that the following conditions
6bf215546Sopenharmony_ci * are met:
7bf215546Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
8bf215546Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
9bf215546Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
10bf215546Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
11bf215546Sopenharmony_ci *    documentation and/or other materials provided with the distribution.
12bf215546Sopenharmony_ci *
13bf215546Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14bf215546Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15bf215546Sopenharmony_ci * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16bf215546Sopenharmony_ci * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17bf215546Sopenharmony_ci * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18bf215546Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19bf215546Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20bf215546Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21bf215546Sopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22bf215546Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23bf215546Sopenharmony_ci * THE POSSIBILITY OF SUCH DAMAGE.
24bf215546Sopenharmony_ci */
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci/*
27bf215546Sopenharmony_ci * Macro found in WebKit source code:
28bf215546Sopenharmony_ci *
29bf215546Sopenharmony_ci * https://chromium.googlesource.com/chromium/blink.git/+/8ced00ca9f81cd8403584ae9123d9f3bb696c86a/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm
30bf215546Sopenharmony_ci */
31bf215546Sopenharmony_ci#ifndef DYLD_INTERPOSE
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci#define DYLD_INTERPOSE(_replacement,_replacee) \
34bf215546Sopenharmony_ci    __attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
35bf215546Sopenharmony_ci    __attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci#endif
38