This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH Gold] Recognize clang-style crtbegin and crtend files
- From: Cary Coutant <ccoutant at gmail dot com>
- To: "augustine dot sterling at gmail dot com" <augustine dot sterling at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 27 Dec 2019 16:50:34 -0800
- Subject: Re: [PATCH Gold] Recognize clang-style crtbegin and crtend files
- References: <CAGSvup8i2X19GxpOG2=nBm+JZeFvJjAne8tfWZ0q4nGtXsfqiw@mail.gmail.com>
> This patch modifies Layout::match_file_name so that gold treats these
> files the same as any other crtbegin and crtend.
>
> 2019-11-13 Sterling Augustine <augustine.sterling@gmail.com>
> * layout.cc (Layout::match_file_name): Handle clang-style
> crtbegin and crtend filenames.
- if (base_len != match_len + 2 && base_len != match_len + 3)
- return false;
By removing this, you're allowing the "-<target-name>" part on
gcc-style filenames as well as clang-style. Unless you need to match
that part even without the "clang_rt." prefix, I'd prefer to keep the
stricter matching for gcc-style filenames. And it might be a good idea
to at least check for the "-" before the target name. We just want to
minimize the odds of accidentally matching a user-supplied object
file.
(I really wish there were a better way to handle these sections. I
hope you need this only to support section sorting, and not for the
special treatment of .ctors and .dtors sections, which is a legacy you
shouldn't be saddled with in clang.)
-cary