.section directives with the same name but different fields
Alan Modra
amodra@gmail.com
Thu Feb 6 14:09:00 GMT 2020
More information about the Binutils mailing list
Thu Feb 6 14:09:00 GMT 2020
- Previous message (by thread): .section directives with the same name but different fields
- Next message (by thread): .section directives with the same name but different fields
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Feb 06, 2020 at 01:19:14AM -0800, Fangrui Song wrote: > On 2020-02-06, Alan Modra wrote: > > On Wed, Feb 05, 2020@11:38:37PM -0800, Fangrui Song wrote: > > > ## Different sh_entsize > > > > > > .section .foo,"aM",@progbits,4 > > > .section .foo,"aM",@progbits,8 > > > > > > GNU as emits a warning `Warning: ignoring changed section entity size for .foo` > > > > I think this one probably should be an error rather than a warning. > > An error is fine, but it can bring up some implementation difficulties. > If an implementation does a one-pass scan over global variables to > emit .section directives and variable labels, it may not know sh_entsize > when it is about the emit the first .section directive. > > > > The output sh_entsize is 4. If the second .section defines an object, the object may get corrupted after merging > > > (https://bugs.llvm.org/show_bug.cgi?id=43457 ) > > > For this case, we have several choices: > > > > > > 1. (Status quo) Emit one section. Set sh_entsize to 4 and emit a warning. > > > 2. Emit two sections, i.e. sh_entsize is a differentiator. > > > > If you do, the linker won't do merging of values for those sections. > > > > > 3. Emit one section. Set sh_entsize to 0. Should the assembler emit a warning? > > > > And remove SHF_MERGE too I guess. That's an option but I think it's > > better just to error. > > > > > > > > ## Different sh_flags > > > > > > .section .foo,"aw" > > > .section .foo,"a" # Warning: ignoring changed section attributes for .foo > > > > > > Shall we emit two sections? > > > > I don't think so. User assembly often gets section attributes wrong > > or leaves them off entirely for special sections known to the > > assembler. ie. the first .section .foo above is a built-in rather > > than user input. > > > > > > > > ## Different sh_type > > > > > > .section .foo,"a",@progbits > > > .section .foo,"a",@nobits # Warning: ignoring changed section type for .foo > > > > > > Shall we emit two sections? > > > > Again we should continue to handle the case where .foo is a special > > section of known type. So I think a warning rather than creating two > > sections is appropriate. > > Do you think the warnings should be upgraded to errors (for sh_flags and > sh_type)? No. -- Alan Modra Australia Development Lab, IBM
- Previous message (by thread): .section directives with the same name but different fields
- Next message (by thread): .section directives with the same name but different fields
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list