<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp, branch 1.58.1</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.58.1</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.58.1'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2021-11-11T14:05:21+00:00</updated>
<entry>
<title>PassWrapper: additional sanitizer update to match clang</title>
<updated>2021-11-11T14:05:21+00:00</updated>
<author>
<name>Krasimir Georgiev</name>
<email>krasimir@google.com</email>
</author>
<published>2021-11-11T14:03:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d9f2d5f0e9c55f440d043c3614b164d7c9fa70ce'/>
<id>urn:sha1:d9f2d5f0e9c55f440d043c3614b164d7c9fa70ce</id>
<content type='text'>
This happened later in the stream than the other changes, but the fix is
overlapping. Fix taken from a55c4ec1cee7683d9095327d9d33e7137ec25292 in
LLVM.
</content>
</entry>
<entry>
<title>Didn't mean to invert this boolean.</title>
<updated>2021-11-09T15:18:13+00:00</updated>
<author>
<name>Augie Fackler</name>
<email>augie@google.com</email>
</author>
<published>2021-11-04T22:08:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d440ce6a9f6d8cfa532007add77754d956038407'/>
<id>urn:sha1:d440ce6a9f6d8cfa532007add77754d956038407</id>
<content type='text'>
</content>
</entry>
<entry>
<title>rustc_llvm: update PassWrapper for recent LLVM</title>
<updated>2021-11-09T15:18:13+00:00</updated>
<author>
<name>Augie Fackler</name>
<email>augie@google.com</email>
</author>
<published>2021-11-04T21:16:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6234a5694936cb0f7c9a3fb456ae4c0aeee69f11'/>
<id>urn:sha1:6234a5694936cb0f7c9a3fb456ae4c0aeee69f11</id>
<content type='text'>
Now AddressSanitizerOptions is a struct, but at least the change was
tiny.

r? nikic
</content>
</entry>
<entry>
<title>Initialize LLVM time trace profiler on each code generation thread</title>
<updated>2021-11-05T16:47:11+00:00</updated>
<author>
<name>Tomasz Miąsko</name>
<email>tomasz.miasko@gmail.com</email>
</author>
<published>2021-11-05T00:00:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5a09e1213543fca0cbc9a0a61643e8d1bd4fccd8'/>
<id>urn:sha1:5a09e1213543fca0cbc9a0a61643e8d1bd4fccd8</id>
<content type='text'>
In https://reviews.llvm.org/D71059 LLVM 11, the time trace profiler was
extended to support multiple threads.

`timeTraceProfilerInitialize` creates a thread local profiler instance.
When a thread finishes `timeTraceProfilerFinishThread` moves a thread
local instance into a global collection of instances. Finally when all
codegen work is complete `timeTraceProfilerWrite` writes data from the
current thread local instance and the instances in global collection
of instances.

Previously, the profiler was intialized on a single thread only. Since
this thread performs no code generation on its own, the resulting
profile was empty.

Update LLVM codegen to initialize &amp; finish time trace profiler on each
code generation thread.
</content>
</entry>
<entry>
<title>Rollup merge of #89581 - jblazquez:master, r=Mark-Simulacrum</title>
<updated>2021-10-25T20:59:46+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>matthias.krueger@famsik.de</email>
</author>
<published>2021-10-25T20:59:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2f6764760665a2ac776293edf8b6772d17f3e266'/>
<id>urn:sha1:2f6764760665a2ac776293edf8b6772d17f3e266</id>
<content type='text'>
Add -Z no-unique-section-names to reduce ELF header bloat.

This change adds a new compiler flag that can help reduce the size of ELF binaries that contain many functions.

By default, when enabling function sections (which is the default for most targets), the LLVM backend will generate different section names for each function. For example, a function `func` would generate a section called `.text.func`. Normally this is fine because the linker will merge all those sections into a single one in the binary. However, starting with [LLVM 12](https://github.com/llvm/llvm-project/commit/ee5d1a04), the backend will also generate unique section names for exception handling, resulting in thousands of `.gcc_except_table.*` sections ending up in the final binary because some linkers like LLD don't currently merge or strip these EH sections (see discussion [here](https://reviews.llvm.org/D83655)). This can bloat the ELF headers and string table significantly in binaries that contain many functions.

The new option is analogous to Clang's `-fno-unique-section-names`, and instructs LLVM to generate the same `.text` and `.gcc_except_table` section for each function, resulting in a smaller final binary.

The motivation to add this new option was because we have a binary that ended up with so many ELF sections (over 65,000) that it broke some existing ELF tools, which couldn't handle so many sections.

Here's our old binary:

```
$ readelf --sections old.elf | head -1
There are 71746 section headers, starting at offset 0x2a246508:

$ readelf --sections old.elf | grep shstrtab
  [71742] .shstrtab      STRTAB          0000000000000000 2977204c ad44bb 00      0   0  1
```

That's an 11MB+ string table. Here's the new binary using this option:

```
$ readelf --sections new.elf | head -1
There are 43 section headers, starting at offset 0x29143ca8:

$ readelf --sections new.elf | grep shstrtab
  [40] .shstrtab         STRTAB          0000000000000000 29143acc 0001db 00      0   0  1
```

The whole binary size went down by over 20MB, which is quite significant.
</content>
</entry>
<entry>
<title>Update the minimum external LLVM to 12</title>
<updated>2021-10-22T17:50:07+00:00</updated>
<author>
<name>Josh Stone</name>
<email>jistone@redhat.com</email>
</author>
<published>2021-10-22T17:50:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e9f545b9a952f193dbe15730bcbe47784b6e7cde'/>
<id>urn:sha1:e9f545b9a952f193dbe15730bcbe47784b6e7cde</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update the minimum external LLVM to 11</title>
<updated>2021-10-22T16:22:18+00:00</updated>
<author>
<name>Josh Stone</name>
<email>jistone@redhat.com</email>
</author>
<published>2021-10-19T17:24:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=65150af1b4841feeb8b81f1ada60de1191912590'/>
<id>urn:sha1:65150af1b4841feeb8b81f1ada60de1191912590</id>
<content type='text'>
</content>
</entry>
<entry>
<title>RustWrapper: adapt for an LLVM API change</title>
<updated>2021-10-18T07:48:47+00:00</updated>
<author>
<name>Krasimir Georgiev</name>
<email>krasimir@google.com</email>
</author>
<published>2021-10-11T10:31:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e3c3f4a09cc700ff06acef3d84bea0368e622da4'/>
<id>urn:sha1:e3c3f4a09cc700ff06acef3d84bea0368e622da4</id>
<content type='text'>
No functional changes intended.

The LLVM commit
https://github.com/llvm/llvm-project/commit/89b57061f7b769e9ea9bf6ed686e284f3e55affe
moved TargetRegistry.(h|cpp) from Support to MC.
This adapts RustWrapper accordingly.
</content>
</entry>
<entry>
<title>Add -Z no-unique-section-names to reduce ELF header bloat.</title>
<updated>2021-10-11T19:09:32+00:00</updated>
<author>
<name>Javier Blazquez</name>
<email>jblazquez@riotgames.com</email>
</author>
<published>2021-10-11T19:09:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=4ed846ad4d4e0be96efc4837fa416aabce1882db'/>
<id>urn:sha1:4ed846ad4d4e0be96efc4837fa416aabce1882db</id>
<content type='text'>
This change adds a new compiler flag that can help reduce the size of
ELF binaries that contain many functions.

By default, when enabling function sections (which is the default for most
targets), the LLVM backend will generate different section names for each
function. For example, a function "func" would generate a section called
".text.func". Normally this is fine because the linker will merge all those
sections into a single one in the binary. However, starting with LLVM 12
(llvm/llvm-project@ee5d1a0), the backend will
also generate unique section names for exception handling, resulting in
thousands of ".gcc_except_table.*" sections ending up in the final binary
because some linkers don't currently merge or strip these EH sections.
This can bloat the ELF headers and string table significantly in
binaries that contain many functions.

The new option is analogous to Clang's -fno-unique-section-names, and
instructs LLVM to generate the same ".text" and ".gcc_except_table"
section for each function, resulting in smaller object files and
potentially a smaller final binary.
</content>
</entry>
<entry>
<title>Enable AutoFDO.</title>
<updated>2021-10-06T19:36:52+00:00</updated>
<author>
<name>Michael Benfield</name>
<email>mbenfield@google.com</email>
</author>
<published>2021-05-07T07:41:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a17193dbb931ea0c8b66d82f640385bce8b4929a'/>
<id>urn:sha1:a17193dbb931ea0c8b66d82f640385bce8b4929a</id>
<content type='text'>
This largely involves implementing the options debug-info-for-profiling
and profile-sample-use and forwarding them on to LLVM.

AutoFDO can be used on x86-64 Linux like this:
rustc -O -Cdebug-info-for-profiling main.rs -o main
perf record -b ./main
create_llvm_prof --binary=main --out=code.prof
rustc -O -Cprofile-sample-use=code.prof main.rs -o main2

Now `main2` will have feedback directed optimization applied to it.

The create_llvm_prof tool can be obtained from this github repository:
https://github.com/google/autofdo

Fixes #64892.
</content>
</entry>
</feed>
