[PATCH] D145173: Make section attribute and -ffunction-sections play nicely

2023-03-07 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment. The inconsistency stem from the fact that with the default `.text`, the compiler may generate `.text.$suffix` if `-ffunction-sections` is specified or if a COMDAT is needed. While with an explicit section, there is no such suffix appending mechanism used together with `

[PATCH] D145173: Make section attribute and -ffunction-sections play nicely

2023-03-07 Thread Paul Robinson via Phabricator via cfe-commits
probinson abandoned this revision. probinson added a comment. I think the GC behavior with explicit section names is currently a little peculiar. For functions without a section name, -ffunction-sections allows GC to happen at the individual function level. With a section name, GC would happen

[PATCH] D145173: Make section attribute and -ffunction-sections play nicely

2023-03-03 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment. > the programmer is indicating the function has some special purpose, and is > not expected to be garbage collected. There are use cases that GC semantics are desired. They may place the address function in a variable. I don't think changing the behavior by default is f

[PATCH] D145173: Make section attribute and -ffunction-sections play nicely

2023-03-02 Thread Paul Robinson via Phabricator via cfe-commits
probinson created this revision. probinson added a reviewer: MaskRay. Herald added a project: All. probinson requested review of this revision. People use -ffunction-sections to put each function into its own object-file section; this makes linker garbage-collection simpler. However, if there's an