This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH Gold] Recognize clang-style crtbegin and crtend files


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]