[PATCH v2] elf: Add DL_ADDRESS_WITHOUT_RELOC [BZ #33088]

Alexander Monakov amonakov@ispras.ru
Mon Jun 16 08:53:30 GMT 2025


On Mon, 16 Jun 2025, Florian Weimer wrote:

> > @@ -428,7 +429,7 @@ static ElfW(Addr) _dl_start_final (void *arg,
> >  
> >  /* These are defined magically by the linker.  */
> >  extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
> > -extern char _end[] attribute_hidden;
> > +extern char _end attribute_hidden;
> 
> Can you avoid this change (which may have unintended side effects on
> other architectures) if you use
> 
> > +  ({ __typeof (+var) _result = var; asm ("" : "+r"(_result)); _result; })
> 
> in the definition of DL_ADDRESS_WITHOUT_RELOC?

It won't work, but __auto_type, available since gcc-4.9 and clang-3.8, will:

  __auto_type _result = val;

or something like '__typeof(0 ? val : 0)' can be used for array-to-pointer decay
inside of typeof.

Alexander


More information about the Libc-alpha mailing list