[PATCH v1] gold: Make '--section-ordering-file' also specifiable in env variable

Fangrui Song i@maskray.me
Fri May 12 19:17:38 GMT 2023


On Fri, May 12, 2023 at 9:09 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Fri, May 12, 2023 at 1:48 AM Fangrui Song <i@maskray.me> wrote:
> >
> > On Thu, May 11, 2023 at 2:02 PM Noah Goldstein via Binutils
> > <binutils@sourceware.org> wrote:
> > >
> > > New proposed env variable is 'GLOBAL_SECTION_ORDERING_FILE'.
> > >
> > > The motivation for this change to help package maintainers use the
> > > section ordering feature. For package maintainers, modifying the link
> > > flags of all their maintained projects, is time consumining to a
> > > degree that it is often considered infeasable. By making the feature
> > > enablable simply with an environment variable, removes this
> > > roadblock. Similiarly, the rationale behind ignoring errors when using
> > > the environment specified file is to make it so that it never create
> > > new problems in the build process.
> > >
> > > The hope by making this feature more accessable it will allow package
> > > maintainers to use ordering lists from profiles of their applications
> > > to distribute better optimized packages.
> >
> > The motivation isn't compelling to me. Using an environment variable
> > to control a linker option isn't a convention.
> > I probably should say, it's very odd, going against the spirit of a linker.
> >
> > Can you use LDFLAGS or a linker wrapper to achieve your goal?
> >
> > % cat ld.gold
> > #!/bin/sh -e
> > ...
> >
> >
> > If some packages don't recognize standard variables CFLAGS/LDFLAGS,
> > just help add them so that other distributions can control global
> > compiler/linker options more conveniently.
>
> Okay, would you be okay with a new commandline flag to just not fail
> linking if there are issues with the section ordering file? Something
> like "--section-ordering-ignore-errors"?

When are there issues with the section ordering file?
For a pattern that doesn't match any input section, there is no linker error.
See my example at
https://maskray.me/blog/2020-11-15-explain-gnu-linker-options#:~:text=section%2dordering%2dfile
and my description of why --symbol-ordering-file= may be more useful.

I think our discussion may be a case of https://xyproblem.info/ . If
you describe your original problem, I or someone may give a better
answer.


More information about the Binutils mailing list