This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] ld (bfd) arm32 elf invalid strings offset in .strtab


Hi Alan,

Thanks for the reply,

> 
> This is just piling on horrible hacks.  elf32_arm_swap_symbol_in should not
> be calling bfd_elf_sym_name.  I would recommend just deleting
> ARM_{GET,SET}_SYM_CMSE_SPCL and instead replacing uses of
> ARM_GET_SYM_CMSE_SPCL with a string compare of the name with
> CMSE_PREFIX.  I don't believe there is any need to use st_target_internal & 4
> to cache the result of a name comparison, and swap_symbol_in is not the
> best place to do so in terms of speed.
> 

I may be missing something, but why not? Where would be a better place?
It seems to me that replacing a simple mask check with strcmp everywhere is a worse option,
but perhaps I am misunderstanding something here.

> BTW, if you and the ARM maintainers do want to continue with horrible
> hacks, the following in elf32_arm_swap_symbol_in probably will work.
> 

I am not an ARM maintainer so I can't speak for them,
but out of interest what makes the change you proposed to be a hack, and what other hack is it layering on top?

Thanks,
Tamar

> diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index f1895df278..430c8feaa5
> 100644
> --- a/bfd/elf32-arm.c
> +++ b/bfd/elf32-arm.c
> @@ -19960,7 +19960,10 @@ elf32_arm_swap_symbol_in (bfd * abfd,
>      ARM_SET_SYM_BRANCH_TYPE (dst->st_target_internal,
> ST_BRANCH_UNKNOWN);
> 
>    /* Mark CMSE special symbols.  */
> -  symtab_hdr = & elf_symtab_hdr (abfd);
> +  if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
> +    symtab_hdr = &elf_tdata (abfd)->symtab_hdr;  else
> +    symtab_hdr = &elf_tdata (abfd)->dynsymtab_hdr;
>    if (symtab_hdr->sh_size)
>      name = bfd_elf_sym_name (abfd, symtab_hdr, dst, NULL);
>    if (name && CONST_STRNEQ (name, CMSE_PREFIX))
> 
> --
> Alan Modra
> Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]