PING^1 [PATCH v3 1/2] Add -f[no-]direct-extern-access

H.J. Lu hjl.tools@gmail.com
Wed Aug 4 22:03:10 GMT 2021


On Mon, Jul 12, 2021 at 5:13 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sun, Jul 11, 2021 at 11:13 PM Richard Biener
> <richard.guenther@gmail.com> wrote:
> >
> > On Fri, Jul 9, 2021 at 4:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > -fdirect-extern-access is the default.  With -fno-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 -fno-direct-extern-access to avoid copy relocation.
> > > 4. Add ix86_reloc_rw_mask for TARGET_ASM_RELOC_RW_MASK to avoid copy
> > > relocation with -fno-direct-extern-access.
> >
> > Did you check how relocations in .debug_info behave?  I don't remember whether
>
> Yes, I did.   I added ix86_reloc_rw_mask and use PC-relative format for
> EH pointer encodings to avoid copy relocation for -fno-direct-extern-access
> in read-only sections.

PING:

https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574846.html

> > we're doing anything special there or if we just copy how we emit
> > relocs in .text
> >
> > Richard.

-- 
H.J.


More information about the Gcc-patches mailing list