diff mbox series

create-diff-object: Handle missing secsym for debug sections

Message ID 20230208180457.800671-1-ross.lagerwall@citrix.com (mailing list archive)
State New, archived
Headers show
Series create-diff-object: Handle missing secsym for debug sections | expand

Commit Message

Ross Lagerwall Feb. 8, 2023, 6:04 p.m. UTC
Certain debug sections like ".debug_aranges" when built with GCC 11.2.1
are missing section symbols (presumably because they're not needed).
Instead, of segfaulting, simply don't include them if they're missing.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 create-diff-object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Beulich Feb. 9, 2023, 8:46 a.m. UTC | #1
On 08.02.2023 19:04, Ross Lagerwall wrote:
> Certain debug sections like ".debug_aranges" when built with GCC 11.2.1
> are missing section symbols (presumably because they're not needed).

Is it really gcc (not gas) which controls whether section symbols are emitted
for a particular section?

Jan
Ross Lagerwall Feb. 13, 2023, 5:36 p.m. UTC | #2
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Thursday, February 9, 2023 8:46 AM
> To: Ross Lagerwall <ross.lagerwall@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Sergey Dyasli <sergey.dyasli@citrix.com>; xen-devel@lists.xen.org <xen-devel@lists.xen.org>
> Subject: Re: [PATCH] create-diff-object: Handle missing secsym for debug sections 
>  
> On 08.02.2023 19:04, Ross Lagerwall wrote:
> > Certain debug sections like ".debug_aranges" when built with GCC 11.2.1
> > are missing section symbols (presumably because they're not needed).
> 
> Is it really gcc (not gas) which controls whether section symbols are emitted
> for a particular section?

You're right. I tested it and it is down to the gas version (2.36.1 in this
case). I'll fix that before pushing it.

Ross
Andrew Cooper Feb. 15, 2023, 1:51 p.m. UTC | #3
On 08/02/2023 6:04 pm, Ross Lagerwall wrote:
> Certain debug sections like ".debug_aranges" when built with GCC 11.2.1
> are missing section symbols (presumably because they're not needed).
> Instead, of segfaulting, simply don't include them if they're missing.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox series

Patch

diff --git a/create-diff-object.c b/create-diff-object.c
index a516670..780e6c8 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -1484,7 +1484,7 @@  static void kpatch_include_debug_sections(struct kpatch_elf *kelf)
 	list_for_each_entry(sec, &kelf->sections, list) {
 		if (is_debug_section(sec)) {
 			sec->include = 1;
-			if (!is_rela_section(sec))
+			if (!is_rela_section(sec) && sec->secsym)
 				sec->secsym->include = 1;
 		}
 	}