diff mbox series

powerpc: Include .BTF section

Message ID 20200220113132.857132-1-naveen.n.rao@linux.vnet.ibm.com (mailing list archive)
State Accepted
Commit cb0cc635c7a9fa8a3a0f75d4d896721819c63add
Headers show
Series powerpc: Include .BTF section | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (65b2623f395a4e25ab3ff4cff1c9c7623619a22d)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch warning total: 0 errors, 1 warnings, 0 checks, 12 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Naveen N. Rao Feb. 20, 2020, 11:31 a.m. UTC
Selecting CONFIG_DEBUG_INFO_BTF results in the below warning from ld:
  ld: warning: orphan section `.BTF' from `.btf.vmlinux.bin.o' being placed in section `.BTF'

Include .BTF section in vmlinux explicitly to fix the same.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/vmlinux.lds.S | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Ellerman Feb. 24, 2020, 12:29 a.m. UTC | #1
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
> Selecting CONFIG_DEBUG_INFO_BTF results in the below warning from ld:
>   ld: warning: orphan section `.BTF' from `.btf.vmlinux.bin.o' being placed in section `.BTF'
>
> Include .BTF section in vmlinux explicitly to fix the same.

I don't see any other architectures doing this in their linker script.
Why are we special?

cheers

> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index b4c89a1acebb..a32d478a7f41 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -303,6 +303,12 @@ SECTIONS
>  		*(.branch_lt)
>  	}
>  
> +#ifdef CONFIG_DEBUG_INFO_BTF
> +	.BTF : AT(ADDR(.BTF) - LOAD_OFFSET) {
> +		*(.BTF)
> +	}
> +#endif
> +
>  	.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
>  		__start_opd = .;
>  		KEEP(*(.opd))
> -- 
> 2.24.1
Naveen N. Rao Feb. 24, 2020, 4:03 a.m. UTC | #2
Michael Ellerman wrote:
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
>> Selecting CONFIG_DEBUG_INFO_BTF results in the below warning from ld:
>>   ld: warning: orphan section `.BTF' from `.btf.vmlinux.bin.o' being placed in section `.BTF'
>>
>> Include .BTF section in vmlinux explicitly to fix the same.
> 
> I don't see any other architectures doing this in their linker script.
> Why are we special?

I think this is due to commit 83a092cf95f28 ("powerpc: Link warning for 
orphan sections"):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83a092cf95f28

If your question was why I didn't include the .BTF section in .data, 
it's because libbpf seems to expect the .BTF section to be separate.


- Naveen

PS: I also see a linker warning for '.gnu.hash' if I enable 
CONFIG_RELOCATABLE, but I couldn't decipher what that was for, and if it 
should be retained.
Michael Ellerman Feb. 24, 2020, 11:03 a.m. UTC | #3
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
> Michael Ellerman wrote:
>> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
>>> Selecting CONFIG_DEBUG_INFO_BTF results in the below warning from ld:
>>>   ld: warning: orphan section `.BTF' from `.btf.vmlinux.bin.o' being placed in section `.BTF'
>>>
>>> Include .BTF section in vmlinux explicitly to fix the same.
>> 
>> I don't see any other architectures doing this in their linker script.
>> Why are we special?
>
> I think this is due to commit 83a092cf95f28 ("powerpc: Link warning for 
> orphan sections"):
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83a092cf95f28

Oh haha, right :}

> PS: I also see a linker warning for '.gnu.hash' if I enable 
> CONFIG_RELOCATABLE, but I couldn't decipher what that was for, and if it 
> should be retained.

Yeah, Joel tried to remove it but it caused breakage:

  https://lore.kernel.org/linuxppc-dev/87d0pwqweg.fsf@concordia.ellerman.id.au/


I never got around to looking at it.

cheers
Michael Ellerman Feb. 27, 2020, 12:31 p.m. UTC | #4
On Thu, 2020-02-20 at 11:31:32 UTC, "Naveen N. Rao" wrote:
> Selecting CONFIG_DEBUG_INFO_BTF results in the below warning from ld:
>   ld: warning: orphan section `.BTF' from `.btf.vmlinux.bin.o' being placed in section `.BTF'
> 
> Include .BTF section in vmlinux explicitly to fix the same.
> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/cb0cc635c7a9fa8a3a0f75d4d896721819c63add

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index b4c89a1acebb..a32d478a7f41 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -303,6 +303,12 @@  SECTIONS
 		*(.branch_lt)
 	}
 
+#ifdef CONFIG_DEBUG_INFO_BTF
+	.BTF : AT(ADDR(.BTF) - LOAD_OFFSET) {
+		*(.BTF)
+	}
+#endif
+
 	.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
 		__start_opd = .;
 		KEEP(*(.opd))