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

Will Newton will.newton at linaro.org
Tue Jan 20 02:30:25 PST 2015


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.

-- 
Will Newton
Toolchain Working Group, Linaro



More information about the llvm-commits mailing list