[Lldb-commits] [PATCH] D39727: Make TestTopLevelExprs more robust in face of linker GC

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 7 05:51:44 PST 2017


On 7 November 2017 at 13:29, Zachary Turner <zturner at google.com> wrote:
> If it works, is easy, and doesn’t regress anything I’d honestly rather just
> disable linker gc.
Ok, I'll try that.

>
> But I’m not familiar with the method you mentioned. I thought linker gc
> happens when you have -function-sections, -fdata-sections, and —gc-sections.
>
> Wouldn’t it work to just not have those? Or is something else going on?
There are different levels of gc. The flags you mentioned are what is
traditionally understood as linker gc, and it works at function level.
But there are other mechanisms to remove unused code. It is a form of
GC, although most people probably don't think of it as such, since it
has been around forever. (I just called it GC, because I didn't have a
better name for it). We don't have this enabled for our tests.

- normally when you are linking to a static library (.a file), linker
will only include the object files that are needed to satisfy a
dependency. This has been always the default, and you need to add
--whole-library to disable it. However, I think we only link c++abi as
a static library on android, so we can keep this flag in the
android-specific blob.

- if you link to a dynamic library, and that library is not needed to
resolve any dependencies, then the linker can be told to omit it from
the list of runtime dependencies (--as-needed). This didn't use to be
the case, but more and more distributions are configured to have this
on by default. This is what makes the behavior of the test
unpredictable.

>
> On Tue, Nov 7, 2017 at 5:17 AM Pavel Labath <labath at google.com> wrote:
>>
>> On 7 November 2017 at 12:46, Zachary Turner <zturner at google.com> wrote:
>> > I just wonder if we should be disabling linker gc across the board for
>> > all
>> > tests unless you explicitly opt in.
>> >
>> > Seems like something we would want only rarely, if ever
>>
>> Yes, that might be an option. I don't really have a strong opinion on
>> that, either way. FWIW, this is the only test that seems to be
>> impacted by this.


More information about the lldb-commits mailing list