public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/35513] New: Improve targetm.binds_local_p
@ 2008-03-09 15:07 hjl dot tools at gmail dot com
2008-03-09 15:17 ` [Bug tree-optimization/35513] " hjl dot tools at gmail dot com
2010-01-06 23:34 ` hjl dot tools at gmail dot com
0 siblings, 2 replies; 6+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-03-09 15:07 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <bug-35513-4@http.gcc.gnu.org/bugzilla/>]
* [Bug tree-optimization/35513] Improve targetm.binds_local_p
[not found] <bug-35513-4@http.gcc.gnu.org/bugzilla/>
@ 2022-02-09 12:39 ` cvs-commit at gcc dot gnu.org
2022-02-12 13:50 ` cvs-commit at gcc dot gnu.org
2022-03-01 15:45 ` cvs-commit at gcc dot gnu.org
2 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-09 12:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35513
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:ab0b5fbfe90168d2e470aefb19e0cf31526290bc
commit r12-7126-gab0b5fbfe90168d2e470aefb19e0cf31526290bc
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat Jun 19 05:12:48 2021 -0700
x86: Add -m[no-]direct-extern-access
Add -m[no-]direct-extern-access and nodirect_extern_access attribute.
-mdirect-extern-access is the default. With nodirect_extern_access
attribute, GOT is always used to access undefined data and function
symbols with nodirect_extern_access attribute, including in PIE and
non-PIE. With -mno-direct-extern-access:
1. Always use GOT to access undefined data and function symbols,
including in PIE and non-PIE. These will avoid copy relocations
in executables. This is compatible with existing executables and
shared libraries.
2. In executable and shared library, bind symbols with the STV_PROTECTED
visibility locally:
a. The address of data symbol is the address of data body.
b. For systems without function descriptor, the function pointer is
the address of function body.
c. The resulting shared libraries may not be incompatible with
executables which have copy relocations on protected symbols or
use executable PLT entries as function addresses for protected
functions in shared libraries.
3. Update asm_preferred_eh_data_format to select PC relative EH encoding
format with -mno-direct-extern-access to avoid copy relocation.
4. Add ix86_reloc_rw_mask for TARGET_ASM_RELOC_RW_MASK to avoid copy
relocation with -mno-direct-extern-access.
gcc/
PR target/35513
PR target/100593
* config/i386/gnu-property.cc: Include "i386-protos.h".
(file_end_indicate_exec_stack_and_gnu_property): Generate
a GNU_PROPERTY_1_NEEDED note for -mno-direct-extern-access or
nodirect_extern_access attribute.
* config/i386/i386-options.cc
(handle_nodirect_extern_access_attribute): New function.
(ix86_attribute_table): Add nodirect_extern_access attribute.
* config/i386/i386-protos.h (ix86_force_load_from_GOT_p): Add a
bool argument.
(ix86_has_no_direct_extern_access): New.
* config/i386/i386.cc (ix86_has_no_direct_extern_access): New.
(ix86_force_load_from_GOT_p): Add a bool argument to indicate
call operand. Force non-call load from GOT for
-mno-direct-extern-access or nodirect_extern_access attribute.
(legitimate_pic_address_disp_p): Avoid copy relocation in PIE
for -mno-direct-extern-access or nodirect_extern_access attribute.
(ix86_print_operand): Pass true to ix86_force_load_from_GOT_p
for call operand.
(asm_preferred_eh_data_format): Use PC-relative format for
-mno-direct-extern-access to avoid copy relocation. Check
ptr_mode instead of TARGET_64BIT when selecting DW_EH_PE_sdata4.
(ix86_binds_local_p): Set ix86_has_no_direct_extern_access to
true for -mno-direct-extern-access or nodirect_extern_access
attribute. Don't treat protected data as extern and avoid copy
relocation on common symbol with -mno-direct-extern-access or
nodirect_extern_access attribute.
(ix86_reloc_rw_mask): New to avoid copy relocation for
-mno-direct-extern-access.
(TARGET_ASM_RELOC_RW_MASK): New.
* config/i386/i386.opt: Add -mdirect-extern-access.
* doc/extend.texi: Document nodirect_extern_access attribute.
* doc/invoke.texi: Document -m[no-]direct-extern-access.
gcc/testsuite/
PR target/35513
PR target/100593
* g++.target/i386/pr35513-1.C: New file.
* g++.target/i386/pr35513-2.C: Likewise.
* gcc.target/i386/pr35513-1a.c: Likewise.
* gcc.target/i386/pr35513-1b.c: Likewise.
* gcc.target/i386/pr35513-2a.c: Likewise.
* gcc.target/i386/pr35513-2b.c: Likewise.
* gcc.target/i386/pr35513-3a.c: Likewise.
* gcc.target/i386/pr35513-3b.c: Likewise.
* gcc.target/i386/pr35513-4a.c: Likewise.
* gcc.target/i386/pr35513-4b.c: Likewise.
* gcc.target/i386/pr35513-5a.c: Likewise.
* gcc.target/i386/pr35513-5b.c: Likewise.
* gcc.target/i386/pr35513-6a.c: Likewise.
* gcc.target/i386/pr35513-6b.c: Likewise.
* gcc.target/i386/pr35513-7a.c: Likewise.
* gcc.target/i386/pr35513-7b.c: Likewise.
* gcc.target/i386/pr35513-8.c: Likewise.
* gcc.target/i386/pr35513-9a.c: Likewise.
* gcc.target/i386/pr35513-9b.c: Likewise.
* gcc.target/i386/pr35513-10a.c: Likewise.
* gcc.target/i386/pr35513-10b.c: Likewise.
* gcc.target/i386/pr35513-11a.c: Likewise.
* gcc.target/i386/pr35513-11b.c: Likewise.
* gcc.target/i386/pr35513-12a.c: Likewise.
* gcc.target/i386/pr35513-12b.c: Likewise.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/35513] Improve targetm.binds_local_p
[not found] <bug-35513-4@http.gcc.gnu.org/bugzilla/>
2022-02-09 12:39 ` cvs-commit at gcc dot gnu.org
@ 2022-02-12 13:50 ` cvs-commit at gcc dot gnu.org
2022-03-01 15:45 ` cvs-commit at gcc dot gnu.org
2 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-12 13:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35513
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:5c4258d7c78a92ab17c14dec1163d87fc42ff019
commit r12-7213-g5c4258d7c78a92ab17c14dec1163d87fc42ff019
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Feb 10 05:42:49 2022 -0800
x86: Update PR 35513 tests
1. Require linker with GNU_PROPERTY_1_NEEDED support for PR 35513
run-time tests.
2. Compile pr35513-8.c to scan assembly code.
PR testsuite/104481
* g++.target/i386/pr35513-1.C: Require property_1_needed target.
* g++.target/i386/pr35513-2.C: Likewise.
* gcc.target/i386/pr35513-8.c: Change to compile.
* lib/target-supports.exp (check_compile): Support assembly code.
(check_effective_target_property_1_needed): New proc.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/35513] Improve targetm.binds_local_p
[not found] <bug-35513-4@http.gcc.gnu.org/bugzilla/>
2022-02-09 12:39 ` cvs-commit at gcc dot gnu.org
2022-02-12 13:50 ` cvs-commit at gcc dot gnu.org
@ 2022-03-01 15:45 ` cvs-commit at gcc dot gnu.org
2 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-01 15:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35513
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:673a10aee1aafe0c99bfadc29a7458339bdddb3a
commit r12-7436-g673a10aee1aafe0c99bfadc29a7458339bdddb3a
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Mar 1 07:39:33 2022 -0800
x86: Limit PR 35513 tests to Linux
Limit PR 35513 tests to Linux since they fail on 32-bit Solaris/x86 with
Solaris linker.
PR testsuite/104725
* g++.target/i386/pr35513-1.C: Limit to Linux.
* g++.target/i386/pr35513-2.C: Likewise.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-01 15:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-09 15:07 [Bug tree-optimization/35513] New: Improve targetm.binds_local_p hjl dot tools at gmail dot com
2008-03-09 15:17 ` [Bug tree-optimization/35513] " hjl dot tools at gmail dot com
2010-01-06 23:34 ` hjl dot tools at gmail dot com
[not found] <bug-35513-4@http.gcc.gnu.org/bugzilla/>
2022-02-09 12:39 ` cvs-commit at gcc dot gnu.org
2022-02-12 13:50 ` cvs-commit at gcc dot gnu.org
2022-03-01 15:45 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).