Bug 25371 - [objcopy] add support for setting SHF_EXCLUDE flag for sections
Summary: [objcopy] add support for setting SHF_EXCLUDE flag for sections
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2020-01-11 02:16 UTC by dsn1234
Modified: 2020-01-17 05:32 UTC (History)
1 user (show)

See Also:
Last reconfirmed: 2020-01-11 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description dsn1234 2020-01-11 02:16:13 UTC
Please add support for setting SHF_EXCLUDE flag for sections using --set-section-flags option. So far objcopy does not support setting this flag.
Comment 1 H.J. Lu 2020-01-11 16:50:48 UTC
Currently, --set-section-flags preserves SHF_EXCLUDE.  We can add
1. "+exclude" to add SHF_EXCLUDE.
2. "-exclude" to remove SHF_EXCLUDE.
Comment 2 dsn1234 2020-01-15 10:28:00 UTC
Looks good to me.
Comment 3 Fangrui Song 2020-01-16 07:39:28 UTC
We don't have precedent for +flag or -flag. Isn't it an overkill to invent the +- prefix and use +exclude and -exclude?

Other than .debug_*.dwo and an LLVM extension .linker-options, I can't think of any use cases of SHF_EXCLUDE. Nobody will --set-section-flags on .debug_*.dwo . I'd prefer treating 'exclude' like other flags such as 'alloc','readonly','data'... I can send a patch for this.
Comment 4 Fangrui Song 2020-01-17 05:32:27 UTC

in the spirit of a previous patch by HJ. Lu that makes SHF_EXCLUDE generic rather than processor-specific.