Compiler wants to know: 1. If a symbol will be referenced locally within the file. If a readonly symbol with initializer is referenced with the file, compiler may replace symbol read with its initializer. PRs 35402/35494/35501. 2. If a symbol will be referenced locally within the module, an optimized relocation may be used, depend on symbol types. But for weak, undefined, hidden function symbol, it is necessary to treat it as global for read. PR 32219. 3. If a function will be called with in the module, an optimized relocation may be used.
However, the current targetm.binds_local_p doesn't distinguish those different usages. As the result, gcc makes wrong conclusions in some cases, PR 32219. I think targetm.binds_local_p should take a parameter to indicate its usage. -- Summary: Improve targetm.binds_local_p Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hjl dot tools at gmail dot com OtherBugsDependingO 32219,35402,35494,35501 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35513