elf: Never set non_ir_ref_regular for debug reference

Message ID 20240813000105.1287316-1-hjl.tools@gmail.com
State Committed
Headers
Series elf: Never set non_ir_ref_regular for debug reference |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

H.J. Lu Aug. 13, 2024, 12:01 a.m. UTC
  Never set non_ir_ref_regular for debug reference since references in
debug sections shouldn't impact LTO output.

	* elflink.c (elf_link_add_object_symbols): Don't check strip for
	references in debug sections when setting non_ir_ref_regular.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 bfd/elflink.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Alan Modra Aug. 13, 2024, 10:19 p.m. UTC | #1
On Mon, Aug 12, 2024 at 05:01:05PM -0700, H.J. Lu wrote:
> Never set non_ir_ref_regular for debug reference since references in
> debug sections shouldn't impact LTO output.
> 
> 	* elflink.c (elf_link_add_object_symbols): Don't check strip for
> 	references in debug sections when setting non_ir_ref_regular.

OK.
> 
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  bfd/elflink.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/bfd/elflink.c b/bfd/elflink.c
> index 2430d606c30..ed0bd71859b 100644
> --- a/bfd/elflink.c
> +++ b/bfd/elflink.c
> @@ -5718,9 +5718,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
>  	  if ((s->flags & SEC_RELOC) == 0
>  	      || s->reloc_count == 0
>  	      || (s->flags & SEC_EXCLUDE) != 0
> -	      || ((info->strip == strip_all
> -		   || info->strip == strip_debugger)
> -		  && (s->flags & SEC_DEBUGGING) != 0))
> +	      || (s->flags & SEC_DEBUGGING) != 0)
>  	    continue;
>  
>  	  internal_relocs = _bfd_elf_link_info_read_relocs
> -- 
> 2.46.0
  

Patch

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 2430d606c30..ed0bd71859b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -5718,9 +5718,7 @@  elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
 	  if ((s->flags & SEC_RELOC) == 0
 	      || s->reloc_count == 0
 	      || (s->flags & SEC_EXCLUDE) != 0
-	      || ((info->strip == strip_all
-		   || info->strip == strip_debugger)
-		  && (s->flags & SEC_DEBUGGING) != 0))
+	      || (s->flags & SEC_DEBUGGING) != 0)
 	    continue;
 
 	  internal_relocs = _bfd_elf_link_info_read_relocs