about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2016-07-26 17:21:10 -0400
committerGitHub <noreply@github.com>2016-07-26 17:21:10 -0400
commit493cb979c6c07f42e861d2ab0daff8614faec99a (patch)
tree83044c6478b7704209c72dba26152eaa9a8e37ba /src
parent9316ae515e2f8f3f497fb4f1559910c1eef2433d (diff)
parent1e899fde015c29f53642b6b8e582a8547b6e3b1d (diff)
downloadrust-493cb979c6c07f42e861d2ab0daff8614faec99a.tar.gz
rust-493cb979c6c07f42e861d2ab0daff8614faec99a.zip
Rollup merge of #34461 - ubsan:master, r=steveklabnik
Fix ABI string docs in reference.md
Diffstat (limited to 'src')
-rw-r--r--src/doc/reference.md33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index b8509321e3d..a461023642a 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -1653,14 +1653,43 @@ the Rust ABI and the foreign ABI.
 A number of [attributes](#ffi-attributes) control the behavior of external blocks.
 
 By default external blocks assume that the library they are calling uses the
-standard C "cdecl" ABI. Other ABIs may be specified using an `abi` string, as
-shown here:
+standard C ABI on the specific platform. Other ABIs may be specified using an
+`abi` string, as shown here:
 
 ```ignore
 // Interface to the Windows API
 extern "stdcall" { }
 ```
 
+There are three ABI strings which are cross-platform, and which all compilers
+are guaranteed to support:
+
+* `extern "Rust"` -- The default ABI when you write a normal `fn foo()` in any
+  Rust code.
+* `extern "C"` -- This is the same as `extern fn foo()`; whatever the default
+  your C compiler supports.
+* `extern "system"` -- Usually the same as `extern "C"`, except on Win32, in
+  which case it's `"stdcall"`, or what you should use to link to the Windows API
+  itself
+
+There are also some platform-specific ABI strings:
+
+* `extern "cdecl"` -- The default for x86\_32 C code.
+* `extern "stdcall"` -- The default for the Win32 API on x86\_32.
+* `extern "win64"` -- The default for C code on x86\_64 Windows.
+* `extern "aapcs"` -- The default for ARM.
+* `extern "fastcall"` -- The `fastcall` ABI -- corresponds to MSVC's
+  `__fastcall` and GCC and clang's `__attribute__((fastcall))`
+* `extern "vectorcall"` -- The `vectorcall` ABI -- corresponds to MSVC's
+  `__vectorcall` and clang's `__attribute__((vectorcall))`
+
+Finally, there are some rustc-specific ABI strings:
+
+* `extern "rust-intrinsic"` -- The ABI of rustc intrinsics.
+* `extern "rust-call"` -- The ABI of the Fn::call trait functions.
+* `extern "platform-intrinsic"` -- Specific platform intrinsics -- like, for
+  example, `sqrt` -- have this ABI. You should never have to deal with it.
+
 The `link` attribute allows the name of the library to be specified. When
 specified the compiler will attempt to link against the native library of the
 specified name.