Skip to content

Commit 73d148d

Browse files
Treehugger RobotGerrit Code Review
Treehugger Robot
authored and
Gerrit Code Review
committed
Merge changes Ica127d41,Id6828afa
* changes: Document -soname requirement. Remove obsolete documentation.
2 parents fd439e6 + eb4cc50 commit 73d148d

File tree

1 file changed

+8
-33
lines changed

1 file changed

+8
-33
lines changed

docs/BuildSystemMaintainers.md

+8-33
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ executables and scripts will differ.
2323

2424
The NDK uses the [LLVM] family of tools for building C/C++ code. These include
2525
[Clang] for compilation, [LLD] for linking, and other [LLVM tools] for other
26-
tasks. Historically [Binutils] was used and remains available during the
27-
transition but is deprecated and will soon be removed from the NDK.
26+
tasks.
2827

29-
[Binutils]: https://www.gnu.org/software/binutils
3028
[Clang]: https://clang.llvm.org/
3129
[LLD]: https://lld.llvm.org/
3230
[LLVM tools]: https://llvm.org/docs/CommandGuide/
@@ -168,6 +166,11 @@ the binary being linked contains no C++ code (i.e. none of the object files
168166
being linked were generated from C++ files) and `clang++` should be used
169167
otherwise. Using `clang++` ensures that the C++ standard library is linked.
170168

169+
When linking a shared library, the `-Wl,-soname,$NAME_OF_LIBRARY` argument is
170+
required. This is necessary to avoid the problems described in [this stack
171+
overflow post](https://stackoverflow.com/a/48291044/632035). For example, when
172+
building `libapp.so`, `-Wl,-soname,libapp.so` must be used.
173+
171174
### Target Selection
172175

173176
[Cross-compilation] targets can be selected in one of two ways: by using
@@ -203,35 +206,15 @@ Versions] sections.
203206

204207
## Linkers
205208

206-
LLD is the default linker.
207-
208-
Gold is the fallback linker for most architectures, but BFD is used for AArch64
209-
as Gold previously emitted broken debug information for that architecture (see
210-
[Issue 70838247] for more details).
211-
212-
The linker used by Clang can be selected with the `-fuse-ld=<linker>` argument,
213-
passed during linking. For example, to use gold instead of LLD, pass
214-
`-fuse-ld=gold` when linking. No argument is required to use LLD.
215-
216-
The default linkers are installed to
217-
`<NDK>/toolchains/llvm/prebuilt/<host-tag>/bin/<triple>-ld` and
218-
`<NDK>/toolchains/llvm/prebuilt/<host-tag>/<triple>/bin/ld`. BFD and gold are
219-
installed as `ld.bfd` or `ld.gold` in the same locations. The triple-prefixed
220-
executables in the common bin directory should be preferred to the
221-
triple-specific bin directory because the triple-specific directory will be
222-
removed when binutils is removed from the NDK.
209+
The NDK uses LLD for linking. The linker is installed to
210+
`<NDK>/toolchains/llvm/prebuilt/<host-tag>/bin/<triple>-ld`.
223211

224212
Note: It is usually not necessary to invoke the linkers directly since Clang
225213
will do so automatically. Clang will also automatically link CRT objects and
226214
default libraries and set up other target-specific options, so it is generally
227215
better to use Clang for linking.
228216

229-
Warning: Using LLD with GNU `strip` or `objcopy` breaks RelRO. LLVM `strip` and
230-
`objcopy` must be used with LLD. See [Issue 843] and the [Binutils] section of
231-
this document for more information.
232-
233217
[Issue 70838247]: https://issuetracker.google.com/70838247
234-
[Issue 843]: https://github.com/android-ndk/ndk/issues/843
235218

236219
## Binutils
237220

@@ -250,14 +233,6 @@ assembling LLVM IR. If you are currently using `as` directly, you will need to
250233
migrate to using `clang` as a driver for building assembly. See [Clang
251234
Migration Notes] for advice on fixing assembly to be LLVM compatible.
252235

253-
GNU Binutils remains available up to and including r22. All binutils tools with
254-
the exception of the assembler (GAS) were removed in r23. GAS was removed in
255-
r24.
256-
257-
In r22 or earlier, GNU binutils tools are installed to
258-
`<NDK>/toolchains/llvm/prebuilt/<host-tag>/bin/<triple>-<tool>` and
259-
`<NDK>/toolchains/llvm/prebuilt/<host-tag>/<triple>/bin/<tool>`.
260-
261236
Note that by default `/usr/bin/as` is used by Clang if the
262237
`-fno-integrated-as` argument is used, which is almost certainly not
263238
what you want!

0 commit comments

Comments
 (0)