elf: Always ignore SHF_EXCLUDE for relocatable link

Message ID 20210319145250.1435057-1-hjl.tools@gmail.com
State New
Headers show
Series
  • elf: Always ignore SHF_EXCLUDE for relocatable link
Related show

Commit Message

Alan Modra via Binutils March 19, 2021, 2:52 p.m.
Since SEC_EXCLUDE isn't ignored on debugging sections, it breaks
relocatable link on objects with LTO debugging sections marked with
SHF_EXCLUDE.

1. Don't check SHF_EXCLUDE for .gnu.debuglto_.debug_ sections.
2. Always ignore SHF_EXCLUDE for relocatable link.

bfd/

	PR ld/27590
	* elf.c (_bfd_elf_make_section_from_shdr): Don't check
	SHF_EXCLUDE for .gnu.debuglto_.debug_ sections.

ld/

	PR ld/27590
	* ldlang.c (lang_gc_sections): Always ignore SHF_EXCLUDE for
	relocatable link.
	* testsuite/ld-x86-64/pr27590.rd: New file.
	* testsuite/ld-x86-64/pr27590a.obj.bz2: Likewise.
	* testsuite/ld-x86-64/pr27590b.obj.bz2: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run ld/27590 test.
---
 bfd/elf.c                               |   5 ++---
 ld/ldlang.c                             |   5 ++++-
 ld/testsuite/ld-x86-64/pr27590.rd       |  11 +++++++++++
 ld/testsuite/ld-x86-64/pr27590a.obj.bz2 | Bin 0 -> 1202 bytes
 ld/testsuite/ld-x86-64/pr27590b.obj.bz2 | Bin 0 -> 1202 bytes
 ld/testsuite/ld-x86-64/x86-64.exp       |   5 +++++
 6 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 ld/testsuite/ld-x86-64/pr27590.rd
 create mode 100644 ld/testsuite/ld-x86-64/pr27590a.obj.bz2
 create mode 100644 ld/testsuite/ld-x86-64/pr27590b.obj.bz2

-- 
2.30.2

Comments

Alan Modra via Binutils March 20, 2021, 12:04 a.m. | #1
On Fri, Mar 19, 2021 at 07:52:50AM -0700, H.J. Lu via Binutils wrote:
> --- a/ld/ldlang.c

> +++ b/ld/ldlang.c

> @@ -7566,6 +7566,7 @@ lang_gc_sections (void)

>  

>    /* SEC_EXCLUDE is ignored when doing a relocatable link, except in

>       the special case of debug info.  (See bfd/stabs.c)


The exception for debug sections in clearing SEC_EXCLUDE when
relocatable was really for one specific debug section, so let's make
it do just that.

bfd/
	PR 27590
	* elf.c (_bfd_elf_make_section_from_shdr): Remove SHF_EXCLUDE
	test for .gnu.debuglto*.
ld/
	PR 27590
	* ldlang.c (lang_gc_sections): Clear SEC_EXCLUDE when relocatable
	for all sections except .stabstr.

diff --git a/bfd/elf.c b/bfd/elf.c
index 7bd12dfbf3..381951da12 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1085,10 +1085,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
       if (name [0] == '.')
 	{
 	  if (strncmp (name, ".debug", 6) == 0
-	      /* NB: Treate .gnu.debuglto_.debug_ section as debugging
-		 section unless it is marked with SHF_EXCLUDE.  */
-	      || ((flags & SEC_EXCLUDE) == 0
-		  && strncmp (name, ".gnu.debuglto_.debug_", 21) == 0)
+	      || strncmp (name, ".gnu.debuglto_.debug_", 21) == 0
 	      || strncmp (name, ".gnu.linkonce.wi.", 17) == 0
 	      || strncmp (name, ".zdebug", 7) == 0)
 	    flags |= SEC_DEBUGGING | SEC_ELF_OCTETS;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 684e1d23a2..df8a5d17ac 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -7565,7 +7565,7 @@ lang_gc_sections (void)
   lang_gc_sections_1 (statement_list.head);
 
   /* SEC_EXCLUDE is ignored when doing a relocatable link, except in
-     the special case of debug info.  (See bfd/stabs.c)
+     the special case of .stabstr debug info.  (See bfd/stabs.c)
      Twiddle the flag here, to simplify later linker code.  */
   if (bfd_link_relocatable (&link_info))
     {
@@ -7577,7 +7577,8 @@ lang_gc_sections (void)
 	    continue;
 #endif
 	  for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
-	    if ((sec->flags & SEC_DEBUGGING) == 0)
+	    if ((sec->flags & SEC_DEBUGGING) == 0
+		|| strcmp (sec->name, ".stabstr") != 0)
 	      sec->flags &= ~SEC_EXCLUDE;
 	}
     }


-- 
Alan Modra
Australia Development Lab, IBM
Alan Modra via Binutils March 20, 2021, 12:12 a.m. | #2
On Fri, Mar 19, 2021 at 5:04 PM Alan Modra <amodra@gmail.com> wrote:
>

> On Fri, Mar 19, 2021 at 07:52:50AM -0700, H.J. Lu via Binutils wrote:

> > --- a/ld/ldlang.c

> > +++ b/ld/ldlang.c

> > @@ -7566,6 +7566,7 @@ lang_gc_sections (void)

> >

> >    /* SEC_EXCLUDE is ignored when doing a relocatable link, except in

> >       the special case of debug info.  (See bfd/stabs.c)

>

> The exception for debug sections in clearing SEC_EXCLUDE when

> relocatable was really for one specific debug section, so let's make

> it do just that.

>

> bfd/

>         PR 27590

>         * elf.c (_bfd_elf_make_section_from_shdr): Remove SHF_EXCLUDE

>         test for .gnu.debuglto*.

> ld/

>         PR 27590

>         * ldlang.c (lang_gc_sections): Clear SEC_EXCLUDE when relocatable

>         for all sections except .stabstr.

>


I am checking in this testcase.

-- 
H.J.
From 73b7cf384a36e8aa561db5814ac47af92c4ce546 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 19 Mar 2021 07:38:39 -0700
Subject: [PATCH] x86-64: Add a testcase for PR ld/27590

	PR ld/27590
	* testsuite/ld-x86-64/pr27590.rd: New file.
	* testsuite/ld-x86-64/pr27590a.obj.bz2: Likewise.
	* testsuite/ld-x86-64/pr27590b.obj.bz2: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run ld/27590 test.
---
 ld/testsuite/ld-x86-64/pr27590.rd       |  11 +++++++++++
 ld/testsuite/ld-x86-64/pr27590a.obj.bz2 | Bin 0 -> 1202 bytes
 ld/testsuite/ld-x86-64/pr27590b.obj.bz2 | Bin 0 -> 1202 bytes
 ld/testsuite/ld-x86-64/x86-64.exp       |   5 +++++
 4 files changed, 16 insertions(+)
 create mode 100644 ld/testsuite/ld-x86-64/pr27590.rd
 create mode 100644 ld/testsuite/ld-x86-64/pr27590a.obj.bz2
 create mode 100644 ld/testsuite/ld-x86-64/pr27590b.obj.bz2

diff --git a/ld/testsuite/ld-x86-64/pr27590.rd b/ld/testsuite/ld-x86-64/pr27590.rd
new file mode 100644
index 00000000000..19469848c41
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr27590.rd
@@ -0,0 +1,11 @@
+#...
+  \[[ 0-9]+\] .gnu.debuglto_.debug_info PROGBITS +0+ 0+28a 0+42 00 +E  0 +0  1
+  \[[ 0-9]+\] .rela.gnu.debuglto_.debug_info RELA +0+ 0+810 0+f0 18 +I 26  17  8
+  \[[ 0-9]+\] .gnu.debuglto_.debug_abbrev PROGBITS +0+ 0+2cc 0+26 00 +E  0 +0  1
+  \[[ 0-9]+\] .gnu.debuglto_.debug_macro PROGBITS +0+ 0+2f2 0+2a 00 +E  0 +0  1
+  \[[ 0-9]+\] .rela.gnu.debuglto_.debug_macro RELA +0+ 0+900 0+60 18 +I 26  20  8
+  \[[ 0-9]+\] .gnu.debuglto_.debug_macro PROGBITS +0+ 0+31c 0+10 00  GE  0 +0  1
+  \[[ 0-9]+\] .rela.gnu.debuglto_.debug_macro RELA +0+ 0+960 0+30 18  IG 26  22  8
+  \[[ 0-9]+\] .gnu.debuglto_.debug_line PROGBITS +0+ 0+32c 0+8a 00 +E  0 +0  1
+  \[[ 0-9]+\] .gnu.debuglto_.debug_str PROGBITS +0+ 0+3b6 0+15c 01 MSE  0 +0  1
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr27590a.obj.bz2 b/ld/testsuite/ld-x86-64/pr27590a.obj.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..f220c958a9fca4bad70a1543de019fa5a2b5ab61
GIT binary patch
literal 1202
zcmV;j1Wo%wT4*^jL0KkKS&@-W_5cLYfB*mg`v30d|NDRM-jKil-|)b|W@2J70#H!^
zVkCf2aYE1p8X;6$Y={knqClFbk)|3oF-8Q_WdZ3l+C~YcfY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wfW3DsI#yG8vLE0>+mP(KTl7k-t^{yR)B}XZU
zH_6Cccx1>J{Lr|^5+`Y`h=p(ur6y@i`sR)z4aO^hH&TlX10Zd1%U({-mSmQITc9XP
z*>O?ZNKgA5aS2fqI;>K`F}H9iD7@7mZUa^G6Ctr`X8B#HhDzYiTqCrCpgh*&Nt)Yd
zmc`YUXHlcGM|`d;2L=l<75u}qfIRj6!oZ*la@}vcWPUnK29A?eLN40|7@KDLJqYOX
zPf<I?PeL_FYJJ?}>lP7miEOyrYK)?~3fyBWRVSq&l6xWpQr&P6$N==ng;kQ;de)4Z
z>pNLY!5&Dc3JbTQ5(PwelZO9v9^48E4xL&miTX-#_k{nI(Jf7LlddeLkMpjqsy8a=
QsPFt;$rRy2LPkY9*k9QjDF6Tf

literal 0
HcmV?d00001

diff --git a/ld/testsuite/ld-x86-64/pr27590b.obj.bz2 b/ld/testsuite/ld-x86-64/pr27590b.obj.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..f220c958a9fca4bad70a1543de019fa5a2b5ab61
GIT binary patch
literal 1202
zcmV;j1Wo%wT4*^jL0KkKS&@-W_5cLYfB*mg`v30d|NDRM-jKil-|)b|W@2J70#H!^
zVkCf2aYE1p8X;6$Y={knqClFbk)|3oF-8Q_WdZ3l+C~YcfYG6*fEo=0Muy61pwmI2
z>6G;v2}F$mMg$;_BpD3@Mu0K^&;S4c003wJ4FRAMBtmK@>Y4_DpvVIt&;S6?007fK
z01W^D0Av7zOiTzc0W{N1Faa0{#L0k600dze00dwJ$&(3)L8c}I7yz1SrkDVX1Y%^s
zCIA93i~s^K0%XaA#9_p=70F=J71vh9(E1djhRGK0B!v`0mDQJZW^MBqH#tj<TZ}zP
zpzfRaM4K7E2ol8760-(Sei_iuY?O$U8a5<#=5aT>%n8(K=D|xzV%s--qCqfVHluP_
zi47(~yQPTg?oQxaUb<c+NZM=X%Ft)qTW<dDqyI%Slp&WLq(nxUD-stG5HQ|&Yn7&Q
zGvd&x*|TosImFslUAi|}3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Mpjqsy8a=
QsPFt;$rRy2LPkY9*k9QjDF6Tf

literal 0
HcmV?d00001

diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index db3bd140193..ee4d96a228a 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -226,6 +226,11 @@ set x86_64tests {
      "" ""
      { pr27587a.obj.bz2 pr27587b.obj.bz2 }
      {{ld "pr27587.err"}} "pr27587"}
+    {"Build pr27590.o"
+     "-r"
+     "" ""
+     { pr27590a.obj.bz2 pr27590b.obj.bz2 }
+     {{readelf -SW pr27590.rd}} "pr27590.o"}
 }
 
 run_ld_link_tests $x86_64tests
Alan Modra via Binutils March 20, 2021, 12:55 a.m. | #3
On Fri, Mar 19, 2021 at 05:12:54PM -0700, H.J. Lu wrote:
> I am checking in this testcase.


Sure, I had it in my queue to commit but was waiting on a large test
run to finish first.

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/elf.c b/bfd/elf.c
index 7bd12dfbf37..494f32f0e75 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1086,9 +1086,8 @@  _bfd_elf_make_section_from_shdr (bfd *abfd,
 	{
 	  if (strncmp (name, ".debug", 6) == 0
 	      /* NB: Treate .gnu.debuglto_.debug_ section as debugging
-		 section unless it is marked with SHF_EXCLUDE.  */
-	      || ((flags & SEC_EXCLUDE) == 0
-		  && strncmp (name, ".gnu.debuglto_.debug_", 21) == 0)
+		 section.  */
+	      || strncmp (name, ".gnu.debuglto_.debug_", 21) == 0
 	      || strncmp (name, ".gnu.linkonce.wi.", 17) == 0
 	      || strncmp (name, ".zdebug", 7) == 0)
 	    flags |= SEC_DEBUGGING | SEC_ELF_OCTETS;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 684e1d23a21..d9ffa3ddcb4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -7566,6 +7566,7 @@  lang_gc_sections (void)
 
   /* SEC_EXCLUDE is ignored when doing a relocatable link, except in
      the special case of debug info.  (See bfd/stabs.c)
+     NB: SHF_EXCLUDE is always ignored for a relocatable link.
      Twiddle the flag here, to simplify later linker code.  */
   if (bfd_link_relocatable (&link_info))
     {
@@ -7577,7 +7578,9 @@  lang_gc_sections (void)
 	    continue;
 #endif
 	  for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
-	    if ((sec->flags & SEC_DEBUGGING) == 0)
+	    if ((sec->flags & SEC_DEBUGGING) == 0
+		|| (bfd_get_flavour (f->the_bfd) == bfd_target_elf_flavour
+		    && ((elf_section_flags (sec) & SHF_EXCLUDE) != 0)))
 	      sec->flags &= ~SEC_EXCLUDE;
 	}
     }
diff --git a/ld/testsuite/ld-x86-64/pr27590.rd b/ld/testsuite/ld-x86-64/pr27590.rd
new file mode 100644
index 00000000000..19469848c41
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr27590.rd
@@ -0,0 +1,11 @@ 
+#...
+  \[[ 0-9]+\] .gnu.debuglto_.debug_info PROGBITS +0+ 0+28a 0+42 00 +E  0 +0  1
+  \[[ 0-9]+\] .rela.gnu.debuglto_.debug_info RELA +0+ 0+810 0+f0 18 +I 26  17  8
+  \[[ 0-9]+\] .gnu.debuglto_.debug_abbrev PROGBITS +0+ 0+2cc 0+26 00 +E  0 +0  1
+  \[[ 0-9]+\] .gnu.debuglto_.debug_macro PROGBITS +0+ 0+2f2 0+2a 00 +E  0 +0  1
+  \[[ 0-9]+\] .rela.gnu.debuglto_.debug_macro RELA +0+ 0+900 0+60 18 +I 26  20  8
+  \[[ 0-9]+\] .gnu.debuglto_.debug_macro PROGBITS +0+ 0+31c 0+10 00  GE  0 +0  1
+  \[[ 0-9]+\] .rela.gnu.debuglto_.debug_macro RELA +0+ 0+960 0+30 18  IG 26  22  8
+  \[[ 0-9]+\] .gnu.debuglto_.debug_line PROGBITS +0+ 0+32c 0+8a 00 +E  0 +0  1
+  \[[ 0-9]+\] .gnu.debuglto_.debug_str PROGBITS +0+ 0+3b6 0+15c 01 MSE  0 +0  1
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr27590a.obj.bz2 b/ld/testsuite/ld-x86-64/pr27590a.obj.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..f220c958a9fca4bad70a1543de019fa5a2b5ab61
GIT binary patch
literal 1202
zcmV;j1Wo%wT4*^jL0KkKS&@-W_5cLYfB*mg`v30d|NDRM-jKil-|)b|W@2J70#H!^
zVkCf2aYE1p8X;6$Y={knqClFbk)|3oF-8Q_WdZ3l+C~YcfYG6*fEo=0Muy61pwmI2
z>6G;v2}F$mMg$;_BpD3@Mu0K^&;S4c003wJ4FRAMBtmK@>Y4_DpvVIt&;S6?007fK
z01W^D0Av7zOiTzc0W{N1Faa0{#L0k600dze00dwJ$&(3)L8c}I7yz1SrkDVX1Y%^s
zCIA93i~s^K0%XaA#9_p=70F=J71vh9(E1djhRGK0B!v`0mDQJZW^MBqH#tj<TZ}zP
zpzfRaM4K7E2ol8760-(Sei_iuY?O$U8a5<#=5aT>%n8(K=D|xzV%s--qCqfVHluP_
zi47(~yQPTg?oQxaUb<c+NZM=X%Ft)qTW<dDqyI%Slp&WLq(nxUD-stG5HQ|&Yn7&Q
zGvd&x*|TosImFslUAi|}3TXg!K|??)np~zMWs~96Hd8eyltu(?rl3s>8xv-2hy_bT
zm?Vqg=UPa(Yr}hqBnK&m?XLT@t)ltqS|>Xs7oBLuVgyZyDrill4WJWaXcls!FWO(V
zEw4nX)lX)jSwz=zv)=a;y%i+euu2Q1ADYnh%Mo$kmf3%O7|nJs-{156RE4E1yH?i|
zH)CxV?7?ZeEhu`XFR#b(ywUaKS(5+xa@8ltl+zSdDfrkUN;u|?cw{>=n+L1H)_|c`
zI$K~))BLeEgglH2)_@^e$VIzI4xeJaoa~ehiuI#uWMfzt5d=801fv-NV^~)33DE=~
zVQGjj^e~X6I1l4ebm((75}2xM3Pf3CB`P6N2fAwk<wSDfQZkmDVYnRhO>9#xt}o*{
zvh{NgaT}@8+8~p2Pw8C3qG|ek2Q~MC@`$lWr5Niyh8biSBB&^;woJ$Ju7i)74i^U{
z5bJWY9KOiJLnDUU5kqH)Ca6I%j8+2SD<{79k+xrGIX==90pntcAWONVX2AI^*QV*R
zAgI86^_U5ZhY%TS06;u@Yq@q(FcrWvEJ+v`ajCqn00%(RMDhi^M$1JM3sI+}306Fb
zVL+x?S3o}K5hb}cMB{G+YJN)##b4E}rq&p_^k&yFGK(L(OxLAupPDhrB`t#6G4#NK
z!~rtND(G;yDe9G{*##pQ;wB7s$WtwfW3DsI#yG8vLE0>+mP(KTl7k-t^{yR)B}XZU
zH_6Cccx1>J{Lr|^5+`Y`h=p(ur6y@i`sR)z4aO^hH&TlX10Zd1%U({-mSmQITc9XP
z*>O?ZNKgA5aS2fqI;>K`F}H9iD7@7mZUa^G6Ctr`X8B#HhDzYiTqCrCpgh*&Nt)Yd
zmc`YUXHlcGM|`d;2L=l<75u}qfIRj6!oZ*la@}vcWPUnK29A?eLN40|7@KDLJqYOX
zPf<I?PeL_FYJJ?}>lP7miEOyrYK)?~3fyBWRVSq&l6xWpQr&P6$N==ng;kQ;de)4Z
z>pNLY!5&Dc3JbTQ5(PwelZO9v9^48E4xL&miTX-#_k{nI(Jf7LlddeLkMpjqsy8a=
QsPFt;$rRy2LPkY9*k9QjDF6Tf

literal 0
HcmV?d00001

diff --git a/ld/testsuite/ld-x86-64/pr27590b.obj.bz2 b/ld/testsuite/ld-x86-64/pr27590b.obj.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..f220c958a9fca4bad70a1543de019fa5a2b5ab61
GIT binary patch
literal 1202
zcmV;j1Wo%wT4*^jL0KkKS&@-W_5cLYfB*mg`v30d|NDRM-jKil-|)b|W@2J70#H!^
zVkCf2aYE1p8X;6$Y={knqClFbk)|3oF-8Q_WdZ3l+C~YcfYG6*fEo=0Muy61pwmI2
z>6G;v2}F$mMg$;_BpD3@Mu0K^&;S4c003wJ4FRAMBtm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=p(ur6y@i`sR)z4aO^hH&TlX10Zd1%U({-mSmQITc9XP
z*>O?ZNKgA5aS2fqI;>K`F}H9iD7@7mZUa^G6Ctr`X8B#HhDzYiTqCrCpgh*&Nt)Yd
zmc`YUXHlcGM|`d;2L=l<75u}qfIRj6!oZ*la@}vcWPUnK29A?eLN40|7@KDLJqYOX
zPf<I?PeL_FYJJ?}>lP7miEOyrYK)?~3fyBWRVSq&l6xWpQr&P6$N==ng;kQ;de)4Z
z>pNLY!5&Dc3JbTQ5(PwelZO9v9^48E4xL&miTX-#_k{nI(Jf7LlddeLkMpjqsy8a=
QsPFt;$rRy2LPkY9*k9QjDF6Tf

literal 0
HcmV?d00001

diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index db3bd140193..ee4d96a228a 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -226,6 +226,11 @@  set x86_64tests {
      "" ""
      { pr27587a.obj.bz2 pr27587b.obj.bz2 }
      {{ld "pr27587.err"}} "pr27587"}
+    {"Build pr27590.o"
+     "-r"
+     "" ""
+     { pr27590a.obj.bz2 pr27590b.obj.bz2 }
+     {{readelf -SW pr27590.rd}} "pr27590.o"}
 }
 
 run_ld_link_tests $x86_64tests