forked from OSchip/llvm-project
[docs/examples] As part of using inclusive language within the llvm
project, migrate away from the use of blacklist and whitelist.
This commit is contained in:
parent
10563e16aa
commit
ae2fa770e1
|
@ -91,7 +91,7 @@ Here are the steps you can follow to do so:
|
||||||
Please make sure your builder name and its builddir are unique through the
|
Please make sure your builder name and its builddir are unique through the
|
||||||
file.
|
file.
|
||||||
|
|
||||||
It is possible to whitelist email addresses to unconditionally receive
|
It is possible to allow email addresses to unconditionally receive
|
||||||
notifications on build failure; for this you'll need to add an
|
notifications on build failure; for this you'll need to add an
|
||||||
``InformativeMailNotifier`` to ``buildbot/osuosl/master/config/status.py``.
|
``InformativeMailNotifier`` to ``buildbot/osuosl/master/config/status.py``.
|
||||||
This is particularly useful for the staging buildmaster which is silent
|
This is particularly useful for the staging buildmaster which is silent
|
||||||
|
|
|
@ -729,7 +729,7 @@ For example, to load the whole interface of a runtime library:
|
||||||
// at '/path/to/lib'.
|
// at '/path/to/lib'.
|
||||||
CompileLayer.add(JD, loadModule(...));
|
CompileLayer.add(JD, loadModule(...));
|
||||||
|
|
||||||
Or, to expose a whitelisted set of symbols from the main process:
|
Or, to expose a allowed set of symbols from the main process:
|
||||||
|
|
||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
|
|
||||||
|
@ -738,20 +738,20 @@ Or, to expose a whitelisted set of symbols from the main process:
|
||||||
|
|
||||||
auto &JD = ES.createJITDylib("main");
|
auto &JD = ES.createJITDylib("main");
|
||||||
|
|
||||||
DenseSet<SymbolStringPtr> Whitelist({
|
DenseSet<SymbolStringPtr> AllowList({
|
||||||
Mangle("puts"),
|
Mangle("puts"),
|
||||||
Mangle("gets")
|
Mangle("gets")
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use GetForCurrentProcess with a predicate function that checks the
|
// Use GetForCurrentProcess with a predicate function that checks the
|
||||||
// whitelist.
|
// allowed list.
|
||||||
JD.setGenerator(
|
JD.setGenerator(
|
||||||
DynamicLibrarySearchGenerator::GetForCurrentProcess(
|
DynamicLibrarySearchGenerator::GetForCurrentProcess(
|
||||||
DL.getGlobalPrefix(),
|
DL.getGlobalPrefix(),
|
||||||
[&](const SymbolStringPtr &S) { return Whitelist.count(S); }));
|
[&](const SymbolStringPtr &S) { return AllowList.count(S); }));
|
||||||
|
|
||||||
// IR added to JD can now link against any symbols exported by the process
|
// IR added to JD can now link against any symbols exported by the process
|
||||||
// and contained in the whitelist.
|
// and contained in the list.
|
||||||
CompileLayer.add(JD, loadModule(...));
|
CompileLayer.add(JD, loadModule(...));
|
||||||
|
|
||||||
Future Features
|
Future Features
|
||||||
|
|
|
@ -141,9 +141,9 @@ Unfortunately, GitHub does not support server side hooks to enforce such a
|
||||||
policy. We must rely on the community to avoid pushing merge commits.
|
policy. We must rely on the community to avoid pushing merge commits.
|
||||||
|
|
||||||
GitHub offers a feature called `Status Checks`: a branch protected by
|
GitHub offers a feature called `Status Checks`: a branch protected by
|
||||||
`status checks` requires commits to be whitelisted before the push can happen.
|
`status checks` requires commits to be explicitly allowed before the push can happen.
|
||||||
We could supply a pre-push hook on the client side that would run and check the
|
We could supply a pre-push hook on the client side that would run and check the
|
||||||
history, before whitelisting the commit being pushed [statuschecks]_.
|
history, before allowing the commit being pushed [statuschecks]_.
|
||||||
However this solution would be somewhat fragile (how do you update a script
|
However this solution would be somewhat fragile (how do you update a script
|
||||||
installed on every developer machine?) and prevents SVN access to the
|
installed on every developer machine?) and prevents SVN access to the
|
||||||
repository.
|
repository.
|
||||||
|
|
|
@ -772,7 +772,7 @@ relocation sequence, including all required ``gc.relocates``.
|
||||||
|
|
||||||
Note that by default, this pass only runs for the "statepoint-example" or
|
Note that by default, this pass only runs for the "statepoint-example" or
|
||||||
"core-clr" gc strategies. You will need to add your custom strategy to this
|
"core-clr" gc strategies. You will need to add your custom strategy to this
|
||||||
whitelist or use one of the predefined ones.
|
list or use one of the predefined ones.
|
||||||
|
|
||||||
As an example, given this code:
|
As an example, given this code:
|
||||||
|
|
||||||
|
|
|
@ -27,14 +27,14 @@ int32_t add(int32_t X, int32_t Y) { return X + Y; }
|
||||||
|
|
||||||
int32_t mul(int32_t X, int32_t Y) { return X * Y; }
|
int32_t mul(int32_t X, int32_t Y) { return X * Y; }
|
||||||
|
|
||||||
int whitelistedSymbols(LLVMOrcSymbolStringPoolEntryRef Sym, void *Ctx) {
|
int allowedSymbols(LLVMOrcSymbolStringPoolEntryRef Sym, void *Ctx) {
|
||||||
assert(Ctx && "Cannot call whitelistedSymbols with a null context");
|
assert(Ctx && "Cannot call allowedSymbols with a null context");
|
||||||
|
|
||||||
LLVMOrcSymbolStringPoolEntryRef *Whitelist =
|
LLVMOrcSymbolStringPoolEntryRef *AllowList =
|
||||||
(LLVMOrcSymbolStringPoolEntryRef *)Ctx;
|
(LLVMOrcSymbolStringPoolEntryRef *)Ctx;
|
||||||
|
|
||||||
// If Sym appears in the whitelist then return true.
|
// If Sym appears in the allowed list then return true.
|
||||||
LLVMOrcSymbolStringPoolEntryRef *P = Whitelist;
|
LLVMOrcSymbolStringPoolEntryRef *P = AllowList;
|
||||||
while (*P) {
|
while (*P) {
|
||||||
if (Sym == *P)
|
if (Sym == *P)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -134,11 +134,11 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a filter to allow JIT'd code to only access whitelisted symbols.
|
// Build a filter to allow JIT'd code to only access allowed symbols.
|
||||||
// This filter is optional: If a null value is suppled for the Filter
|
// This filter is optional: If a null value is suppled for the Filter
|
||||||
// argument to LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess then
|
// argument to LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess then
|
||||||
// all process symbols will be reflected.
|
// all process symbols will be reflected.
|
||||||
LLVMOrcSymbolStringPoolEntryRef Whitelist[] = {
|
LLVMOrcSymbolStringPoolEntryRef AllowList[] = {
|
||||||
LLVMOrcLLJITMangleAndIntern(J, "mul"),
|
LLVMOrcLLJITMangleAndIntern(J, "mul"),
|
||||||
LLVMOrcLLJITMangleAndIntern(J, "add"), 0};
|
LLVMOrcLLJITMangleAndIntern(J, "add"), 0};
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ int main(int argc, char *argv[]) {
|
||||||
LLVMErrorRef Err;
|
LLVMErrorRef Err;
|
||||||
if ((Err = LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(
|
if ((Err = LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(
|
||||||
&ProcessSymbolsGenerator, LLVMOrcLLJITGetGlobalPrefix(J),
|
&ProcessSymbolsGenerator, LLVMOrcLLJITGetGlobalPrefix(J),
|
||||||
whitelistedSymbols, Whitelist))) {
|
allowedSymbols, AllowList))) {
|
||||||
MainResult = handleError(Err);
|
MainResult = handleError(Err);
|
||||||
goto jit_cleanup;
|
goto jit_cleanup;
|
||||||
}
|
}
|
||||||
|
@ -192,9 +192,9 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
jit_cleanup:
|
jit_cleanup:
|
||||||
// Release all symbol string pool entries that we have allocated. In this
|
// Release all symbol string pool entries that we have allocated. In this
|
||||||
// example that's just our whitelist entries.
|
// example that's just our allowed entries.
|
||||||
{
|
{
|
||||||
LLVMOrcSymbolStringPoolEntryRef *P = Whitelist;
|
LLVMOrcSymbolStringPoolEntryRef *P = AllowList;
|
||||||
while (*P)
|
while (*P)
|
||||||
LLVMOrcReleaseSymbolStringPoolEntry(*P++);
|
LLVMOrcReleaseSymbolStringPoolEntry(*P++);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue