Bug 25371

Summary: [objcopy] add support for setting SHF_EXCLUDE flag for sections
Product: binutils Reporter: dsn1234
Component: binutilsAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: enhancement CC: i, nickc
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed: 2020-01-11 00:00:00

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
https://sourceware.org/ml/binutils/2020-01/msg00186.html

in the spirit of a previous patch by HJ. Lu that makes SHF_EXCLUDE generic rather than processor-specific.
Comment 5 Nick Clifton 2020-04-03 10:46:37 UTC
The patch has now been applied. (Commit: 3a5d12fbb4f)