linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the tip tree with the powerpc-objtool tree
@ 2022-11-24  1:29 Stephen Rothwell
  2022-11-24  6:58 ` Christophe Leroy
  2022-12-15 23:09 ` Stephen Rothwell
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Rothwell @ 2022-11-24  1:29 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Michael Ellerman
  Cc: Linux Next Mailing List, PowerPC, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 2876 bytes --]

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  tools/objtool/check.c

between commit:

  efb11fdb3e1a ("objtool: Fix SEGFAULT")

from the powerpc-objtool tree and commit:

  dbcdbdfdf137 ("objtool: Rework instruction -> symbol mapping")

from the tip tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/objtool/check.c
index 7580c66ca5c8,4f1a7384426b..000000000000
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@@ -207,7 -204,7 +204,7 @@@ static bool __dead_end_function(struct 
  		return false;
  
  	insn = find_insn(file, func->sec, func->offset);
- 	if (!insn || !insn->func)
 -	if (!insn_func(insn))
++	if (!insn || !insn_func(insn))
  		return false;
  
  	func_for_each_insn(file, func, insn) {
@@@ -850,11 -861,73 +861,73 @@@ static int create_ibt_endbr_seal_sectio
  	return 0;
  }
  
+ static int create_cfi_sections(struct objtool_file *file)
+ {
+ 	struct section *sec, *s;
+ 	struct symbol *sym;
+ 	unsigned int *loc;
+ 	int idx;
+ 
+ 	sec = find_section_by_name(file->elf, ".cfi_sites");
+ 	if (sec) {
+ 		INIT_LIST_HEAD(&file->call_list);
+ 		WARN("file already has .cfi_sites section, skipping");
+ 		return 0;
+ 	}
+ 
+ 	idx = 0;
+ 	for_each_sec(file, s) {
+ 		if (!s->text)
+ 			continue;
+ 
+ 		list_for_each_entry(sym, &s->symbol_list, list) {
+ 			if (sym->type != STT_FUNC)
+ 				continue;
+ 
+ 			if (strncmp(sym->name, "__cfi_", 6))
+ 				continue;
+ 
+ 			idx++;
+ 		}
+ 	}
+ 
+ 	sec = elf_create_section(file->elf, ".cfi_sites", 0, sizeof(unsigned int), idx);
+ 	if (!sec)
+ 		return -1;
+ 
+ 	idx = 0;
+ 	for_each_sec(file, s) {
+ 		if (!s->text)
+ 			continue;
+ 
+ 		list_for_each_entry(sym, &s->symbol_list, list) {
+ 			if (sym->type != STT_FUNC)
+ 				continue;
+ 
+ 			if (strncmp(sym->name, "__cfi_", 6))
+ 				continue;
+ 
+ 			loc = (unsigned int *)sec->data->d_buf + idx;
+ 			memset(loc, 0, sizeof(unsigned int));
+ 
+ 			if (elf_add_reloc_to_insn(file->elf, sec,
+ 						  idx * sizeof(unsigned int),
+ 						  R_X86_64_PC32,
+ 						  s, sym->offset))
+ 				return -1;
+ 
+ 			idx++;
+ 		}
+ 	}
+ 
+ 	return 0;
+ }
+ 
  static int create_mcount_loc_sections(struct objtool_file *file)
  {
 -	struct section *sec;
 -	unsigned long *loc;
 +	int addrsize = elf_class_addrsize(file->elf);
  	struct instruction *insn;
 +	struct section *sec;
  	int idx;
  
  	sec = find_section_by_name(file->elf, "__mcount_loc");

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the tip tree with the powerpc-objtool tree
  2022-11-24  1:29 linux-next: manual merge of the tip tree with the powerpc-objtool tree Stephen Rothwell
@ 2022-11-24  6:58 ` Christophe Leroy
  2022-11-24 10:37   ` Michael Ellerman
  2022-12-15 23:09 ` Stephen Rothwell
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2022-11-24  6:58 UTC (permalink / raw)
  To: Stephen Rothwell, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Peter Zijlstra, Michael Ellerman
  Cc: Linux Next Mailing List, PowerPC, Linux Kernel Mailing List



Le 24/11/2022 à 02:29, Stephen Rothwell a écrit :
> Hi all,
> 
> Today's linux-next merge of the tip tree got a conflict in:
> 
>    tools/objtool/check.c
> 
> between commit:
> 
>    efb11fdb3e1a ("objtool: Fix SEGFAULT")
> 
> from the powerpc-objtool tree and commit:
> 
>    dbcdbdfdf137 ("objtool: Rework instruction -> symbol mapping")
> 
> from the tip tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 

Maybe it would be better to perform the check of insn inside the new 
insn_func() then ?

Christophe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the tip tree with the powerpc-objtool tree
  2022-11-24  6:58 ` Christophe Leroy
@ 2022-11-24 10:37   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-11-24 10:37 UTC (permalink / raw)
  To: Christophe Leroy, Stephen Rothwell, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, Peter Zijlstra
  Cc: Linux Next Mailing List, PowerPC, Linux Kernel Mailing List

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 24/11/2022 à 02:29, Stephen Rothwell a écrit :
>> Hi all,
>> 
>> Today's linux-next merge of the tip tree got a conflict in:
>> 
>>    tools/objtool/check.c
>> 
>> between commit:
>> 
>>    efb11fdb3e1a ("objtool: Fix SEGFAULT")
>> 
>> from the powerpc-objtool tree and commit:
>> 
>>    dbcdbdfdf137 ("objtool: Rework instruction -> symbol mapping")
>> 
>> from the tip tree.
>> 
>> I fixed it up (see below) and can carry the fix as necessary. This
>> is now fixed as far as linux-next is concerned, but any non trivial
>> conflicts should be mentioned to your upstream maintainer when your tree
>> is submitted for merging.  You may also want to consider cooperating
>> with the maintainer of the conflicting tree to minimise any particularly
>> complex conflicts.
>> 
>
> Maybe it would be better to perform the check of insn inside the new 
> insn_func() then ?

I don't think it would.

Many of the other uses of insn_func() know that insn is not NULL,
because they've already checked it or have dereferenced some other
member of insn before the call. So in those cases checking it in
insn_func() would be redundant.

But ultimately up to the objtool maintainers.

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the tip tree with the powerpc-objtool tree
  2022-11-24  1:29 linux-next: manual merge of the tip tree with the powerpc-objtool tree Stephen Rothwell
  2022-11-24  6:58 ` Christophe Leroy
@ 2022-12-15 23:09 ` Stephen Rothwell
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2022-12-15 23:09 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Peter Zijlstra, Linux Kernel Mailing List, Ingo Molnar,
	Linux Next Mailing List, H. Peter Anvin, Thomas Gleixner,
	PowerPC

[-- Attachment #1: Type: text/plain, Size: 3295 bytes --]

Hi all,

On Thu, 24 Nov 2022 12:29:31 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> Today's linux-next merge of the tip tree got a conflict in:
> 
>   tools/objtool/check.c
> 
> between commit:
> 
>   efb11fdb3e1a ("objtool: Fix SEGFAULT")
> 
> from the powerpc-objtool tree and commit:
> 
>   dbcdbdfdf137 ("objtool: Rework instruction -> symbol mapping")
> 
> from the tip tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc tools/objtool/check.c
> index 7580c66ca5c8,4f1a7384426b..000000000000
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@@ -207,7 -204,7 +204,7 @@@ static bool __dead_end_function(struct 
>   		return false;
>   
>   	insn = find_insn(file, func->sec, func->offset);
> - 	if (!insn || !insn->func)
>  -	if (!insn_func(insn))
> ++	if (!insn || !insn_func(insn))
>   		return false;
>   
>   	func_for_each_insn(file, func, insn) {
> @@@ -850,11 -861,73 +861,73 @@@ static int create_ibt_endbr_seal_sectio
>   	return 0;
>   }
>   
> + static int create_cfi_sections(struct objtool_file *file)
> + {
> + 	struct section *sec, *s;
> + 	struct symbol *sym;
> + 	unsigned int *loc;
> + 	int idx;
> + 
> + 	sec = find_section_by_name(file->elf, ".cfi_sites");
> + 	if (sec) {
> + 		INIT_LIST_HEAD(&file->call_list);
> + 		WARN("file already has .cfi_sites section, skipping");
> + 		return 0;
> + 	}
> + 
> + 	idx = 0;
> + 	for_each_sec(file, s) {
> + 		if (!s->text)
> + 			continue;
> + 
> + 		list_for_each_entry(sym, &s->symbol_list, list) {
> + 			if (sym->type != STT_FUNC)
> + 				continue;
> + 
> + 			if (strncmp(sym->name, "__cfi_", 6))
> + 				continue;
> + 
> + 			idx++;
> + 		}
> + 	}
> + 
> + 	sec = elf_create_section(file->elf, ".cfi_sites", 0, sizeof(unsigned int), idx);
> + 	if (!sec)
> + 		return -1;
> + 
> + 	idx = 0;
> + 	for_each_sec(file, s) {
> + 		if (!s->text)
> + 			continue;
> + 
> + 		list_for_each_entry(sym, &s->symbol_list, list) {
> + 			if (sym->type != STT_FUNC)
> + 				continue;
> + 
> + 			if (strncmp(sym->name, "__cfi_", 6))
> + 				continue;
> + 
> + 			loc = (unsigned int *)sec->data->d_buf + idx;
> + 			memset(loc, 0, sizeof(unsigned int));
> + 
> + 			if (elf_add_reloc_to_insn(file->elf, sec,
> + 						  idx * sizeof(unsigned int),
> + 						  R_X86_64_PC32,
> + 						  s, sym->offset))
> + 				return -1;
> + 
> + 			idx++;
> + 		}
> + 	}
> + 
> + 	return 0;
> + }
> + 
>   static int create_mcount_loc_sections(struct objtool_file *file)
>   {
>  -	struct section *sec;
>  -	unsigned long *loc;
>  +	int addrsize = elf_class_addrsize(file->elf);
>   	struct instruction *insn;
>  +	struct section *sec;
>   	int idx;
>   
>   	sec = find_section_by_name(file->elf, "__mcount_loc");

This is now a conflict between the powerpc tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-15 23:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24  1:29 linux-next: manual merge of the tip tree with the powerpc-objtool tree Stephen Rothwell
2022-11-24  6:58 ` Christophe Leroy
2022-11-24 10:37   ` Michael Ellerman
2022-12-15 23:09 ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).