public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: Jan Beulich <jbeulich@suse.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] ld: Add support for a new option, -exclude-symbols, in COFF object file directives
Date: Wed, 20 Jul 2022 15:39:56 +0300 (EEST)	[thread overview]
Message-ID: <f465cba3-b428-2f1-c26-2872a80a495@martin.st> (raw)
In-Reply-To: <65b20943-0c1b-28f6-6f57-d3c4b8a9b75f@suse.com>

On Wed, 20 Jul 2022, Jan Beulich wrote:

> On 19.07.2022 22:33, Martin Storsjo wrote:
>> @@ -946,6 +957,7 @@ diropts[] =
>>    { "-attr", SECTIONS },
>>    { "-export", EXPORTS },
>>    { "-aligncomm", ALIGNCOMM },
>> +  { "-exclude-symbols", EXCLUDE_SYMBOLS },

Thanks for having a look!

> I was a little concerned by the - in the middle, but the (custom)
> def-file lexer looks to be treating - the same as ISALPHA() chars.

Thanks for checking!

> Nevertheless it would be quite helpful if there were two testcases
> here - one with the new directive used in an object file's .drectve
> section and another with it used in a .def file.

A testcase certainly would be good here. I'm not familiar with binutils' 
tests from before - I presume I'd make a native build (not having binutils 
set up with a cross target) and run "make check", and I'd find examples of 
existing tests in ld/testsuite/ld-pe?

I guess it'd be good with one test for i386 and one for x86_64 (or both 
cases merged into one?), assembling an .s file and linking it, and then 
checking the export table. Are there any similar existing tests to serve 
as example?

This directive isn't supposed to be used from a def file though (just like 
the aligncomm directive), see the comment in deffile.h.

> The other thing is: According to def_exclude_symbols() each
> directive is followed by exactly one symbol afaict. Hence
> -exclude-symbol (singular) would seem more appropriate for the
> option.

Actually, when the option values later are added to the exclusion list by 
pe_dll_add_excludes, they're split/tokenized by commas (and colon, 
apparently). I guess this could be made clearer by renaming the struct 
field though, maybe to "symbol_names"?

I'd prefer to keep the plural form in the directive name in any case, for 
consistency with the command line option, even if it uses the 
-<name>:<value> option form (like all other embedded directives) instead 
of --<name>=<value> or --<name> <value> on the command line.

// Martin


  reply	other threads:[~2022-07-20 12:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 20:33 Martin Storsjo
2022-07-20  7:49 ` Jan Beulich
2022-07-20 12:39   ` Martin Storsjö [this message]
2022-07-20 13:43     ` Jan Beulich
2022-07-20 15:10       ` Martin Storsjö
2022-07-20 15:50         ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f465cba3-b428-2f1-c26-2872a80a495@martin.st \
    --to=martin@martin.st \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).