[PATCH] GNU LD option export-dynamic can accept single dash flag

Chandler Carruth chandlerc at google.com
Tue Jan 20 02:49:07 PST 2015


On Tue, Jan 20, 2015 at 2:30 AM, Will Newton <will.newton at linaro.org> wrote:

> On 19 January 2015 at 21:30, Rui Ueyama <ruiu at google.com> wrote:
> > On Mon, Jan 19, 2015 at 1:20 PM, Joerg Sonnenberger
> > <joerg at britannica.bec.de> wrote:
> >>
> >> On Mon, Jan 19, 2015 at 03:57:50PM -0500, Ed Maste wrote:
> >> > On 19 January 2015 at 11:32, Joerg Sonnenberger
> >> > <joerg at britannica.bec.de> wrote:
> >> > > On Sun, Jan 18, 2015 at 10:28:27PM +0000, Davide Italiano wrote:
> >> > >> Some Makefiles on FreeBSD use -export-dynamic rather than
> >> > >> --export-dynamic.
> >> > >> We're gonna patch them in the FreeBSD tree, but as long as this is
> >> > >> supposed to be a drop-in replacement for GNU ld, I think supporting
> >> > >> single dash flag is fine.
> >> > >
> >> > > I dislike this for the overlap with the -e option.
> >> >
> >> > It is unfortunate, but necessary if we want to aim for full GNU ld
> >> > compatibility. Do we chase down various ld consumers and convince them
> >> > to switch to --?
> >>
> >> I've seen existing bugs around -export-dynamic with typos and the like,
> >> so personally, I would prefer to handle it as error. In short: yes.
> >
> >
> > I think my preference is opposite. Trying to make an "improvement" over
> GNU
> > command line options would end up with a linker which is not fully
> > compatible with GNU. I think that would cause confusion. I want it to be
> a
> > drop-in replacement that just works.
> >
> > If we really want to ban -export-dynamic, we should convince GNU to not
> > accept that option (or warn on that at least), maybe?
>
> I believe it is worse than that - pretty much all the long options for
> GNU ld can be prefixed with '--' or '-' which makes option parsing
> really hairy, e.g. ld -library.
>
> For sanity requiring '--' for long options seems the better choice and
> indeed GNU ld only documents that style of long option but I don't
> think there is any prospect of GNU ld stopping parsing the '-' form of
> options.


In the same way that there is likely no way for GNU ld to stop parsing the
'-' forms, I suspect LLD will need to parse them in order to integrate with
the huge amount of existing build scripts and systems.

We have certainly found time and again it was necessary to make Clang's
commandline nearly *perfectly* match GCC's, even bug-for-bug in some cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150120/6e4cc6ad/attachment.html>


More information about the llvm-commits mailing list