Skip to contentSkip to conversation

x86: avoid warning for zero-filling .bss

PATCH In review Arnd Bergmann 4 participants 7 messages Nov 16, 2016 – Nov 18, 2016 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: avoid warning for zero-filling .bss

The latest binutils are warning about a .fill directive with an explicit value in a .bss section:

arch/x86/kernel/head_32.S: Assembler messages:
arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in section .bss..page_aligned' arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in section .bss..page_aligned'

This comes from the 'ENTRY()' macro padding the space between the symbols with 'nop'. Open-coding the .globl directive without the padding avoids that warning.

---
 arch/x86/kernel/head_32.S | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/head_32.S +6 -3
index df541ac2071e..4e8577d03372 100644
@@ -669,14 +669,17 @@ __PAGE_ALIGNED_BSS
 initial_pg_pmd:
 	.fill 1024*KPMDS,4,0
 #else
-ENTRY(initial_page_table)
+.globl initial_page_table
+initial_page_table:
 	.fill 1024,4,0
 #endif
 initial_pg_fixmap:
 	.fill 1024,4,0
-ENTRY(empty_zero_page)
+.globl empty_zero_page
+empty_zero_page:
 	.fill 4096,1,0
-ENTRY(swapper_pg_dir)
+.globl swapper_pg_dir
+swapper_pg_dir:
 	.fill 1024,4,0
 EXPORT_SYMBOL(empty_zero_page)
 
Signature · 1 line
2.9.0
#1 lore raw

[tip:x86/urgent] x86/boot: Avoid warning for zero-filling .bss

x86/boot: Avoid warning for zero-filling .bss
Commit-ID:  553bbc11aa6c1f9e0f529a06aeeca15fbe4a3985
Gitweb:     http://git.kernel.org/tip/553bbc11aa6c1f9e0f529a06aeeca15fbe4a3985
Author:     Arnd Bergmann <[email protected]>
AuthorDate: Wed, 16 Nov 2016 15:17:09 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 17 Nov 2016 07:34:58 +0100

x86/boot: Avoid warning for zero-filling .bss

The latest binutils are warning about a .fill directive with an explicit value in a .bss section:

arch/x86/kernel/head_32.S: Assembler messages:
arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in section .bss..page_aligned' arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in section .bss..page_aligned'

This comes from the 'ENTRY()' macro padding the space between the symbols with 'nop' via:

.align 4,0x90

Open-coding the .globl directive without the padding avoids that warning, as all the symbols are already page aligned.

Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/kernel/head_32.S | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/head_32.S +6 -3
index b6b2f02..2dabea4 100644
@@ -665,14 +665,17 @@ __PAGE_ALIGNED_BSS
 initial_pg_pmd:
 	.fill 1024*KPMDS,4,0
 #else
-ENTRY(initial_page_table)
+.globl initial_page_table
+initial_page_table:
 	.fill 1024,4,0
 #endif
 initial_pg_fixmap:
 	.fill 1024,4,0
-ENTRY(empty_zero_page)
+.globl empty_zero_page
+empty_zero_page:
 	.fill 4096,1,0
-ENTRY(swapper_pg_dir)
+.globl swapper_pg_dir
+swapper_pg_dir:
 	.fill 1024,4,0
 EXPORT_SYMBOL(empty_zero_page)
 
#2 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

The latest binutils are warning about a .fill directive with an explicit value in a .bss section:

arch/x86/kernel/head_32.S: Assembler messages:
arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in section .bss..page_aligned' arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in section .bss..page_aligned'

This comes from the 'ENTRY()' macro padding the space between the symbols with 'nop'. Open-coding the .globl directive without the padding avoids that warning.

How is there space between the symbols? Aren't they already aligned?

Isn't the warning really about the fact that it's unnecessarily filling a .bss section with zeros? Would it make sense to use .align instead?

Quoted 32 lines
---
 arch/x86/kernel/head_32.S | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/head_32.S +6 -3
index df541ac2071e..4e8577d03372 100644
@@ -669,14 +669,17 @@ __PAGE_ALIGNED_BSS
 initial_pg_pmd:
 	.fill 1024*KPMDS,4,0
 #else
-ENTRY(initial_page_table)
+.globl initial_page_table
+initial_page_table:
 	.fill 1024,4,0
 #endif
 initial_pg_fixmap:
 	.fill 1024,4,0
-ENTRY(empty_zero_page)
+.globl empty_zero_page
+empty_zero_page:
 	.fill 4096,1,0
-ENTRY(swapper_pg_dir)
+.globl swapper_pg_dir
+swapper_pg_dir:
 	.fill 1024,4,0
 EXPORT_SYMBOL(empty_zero_page)
 
Signature · 1 line
2.9.0
Signature · 1 line
Josh
#3 lore raw
Quoted 50 lines · Josh Poimboeuf
Quoted 1 line · Arnd Bergmann

The latest binutils are warning about a .fill directive with an

explicit

Quoted 4 lines

value in a .bss section:

arch/x86/kernel/head_32.S: Assembler messages:
arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in

section `.bss..page_aligned'

Quoted 1 line

arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in

section `.bss..page_aligned'

Quoted 2 lines

This comes from the 'ENTRY()' macro padding the space between the

symbols

Quoted 2 lines

with 'nop'. Open-coding the .globl directive without the padding avoids that warning.

How is there space between the symbols? Aren't they already aligned?

Isn't the warning really about the fact that it's unnecessarily filling a .bss section with zeros? Would it make sense to use .align instead?

Quoted 29 lines
---
 arch/x86/kernel/head_32.S | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/head_32.S +6 -3
index df541ac2071e..4e8577d03372 100644
@@ -669,14 +669,17 @@ __PAGE_ALIGNED_BSS
 initial_pg_pmd:
 	.fill 1024*KPMDS,4,0
 #else
-ENTRY(initial_page_table)
+.globl initial_page_table
+initial_page_table:
 	.fill 1024,4,0
 #endif
 initial_pg_fixmap:
 	.fill 1024,4,0
-ENTRY(empty_zero_page)
+.globl empty_zero_page
+empty_zero_page:
 	.fill 4096,1,0
-ENTRY(swapper_pg_dir)
+.globl swapper_pg_dir
+swapper_pg_dir:
 	.fill 1024,4,0
 EXPORT_SYMBOL(empty_zero_page)
 
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.9.0

Use .org, .align, or .space

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
#4 lore raw
In reply to Josh Poimboeuf
Quoted 8 lines · CET Josh Poimboeuf
Quoted 7 lines · Arnd Bergmann

The latest binutils are warning about a .fill directive with an explicit value in a .bss section:

arch/x86/kernel/head_32.S: Assembler messages:
arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in section .bss..page_aligned' arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in section .bss..page_aligned'

Quoted 5 lines
Quoted 3 lines

This comes from the 'ENTRY()' macro padding the space between the symbols with 'nop'. Open-coding the .globl directive without the padding avoids that warning.

How is there space between the symbols? Aren't they already aligned?

My understanding is that they are aligned, it's just that gas complains about the .align directive with a nonzero fill value.

Quoted 2 lines

Isn't the warning really about the fact that it's unnecessarily filling a .bss section with zeros? Would it make sense to use .align instead?

Filling with zeroes is allowed, and that's what we are intending anyway. .align would not do the right thing here as it only adds padding if it's not already aligned, but we know it is.

Arnd

Reviewed-by
#5 lore raw
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · CET Josh Poimboeuf
Quoted 7 lines · Arnd Bergmann

The latest binutils are warning about a .fill directive with an explicit value in a .bss section:

arch/x86/kernel/head_32.S: Assembler messages:
arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in section .bss..page_aligned' arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in section .bss..page_aligned'

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

This comes from the 'ENTRY()' macro padding the space between the symbols with 'nop'. Open-coding the .globl directive without the padding avoids that warning.

How is there space between the symbols? Aren't they already aligned?

My understanding is that they are aligned, it's just that gas complains about the .align directive with a nonzero fill value.

Ah, I see now. In that case your patch looks fine to me.

Quoted 7 lines
Quoted 3 lines

Isn't the warning really about the fact that it's unnecessarily filling a .bss section with zeros? Would it make sense to use .align instead?

Filling with zeroes is allowed, and that's what we are intending anyway. .align would not do the right thing here as it only adds padding if it's not already aligned, but we know it is.

Signature · 1 line
Josh
#6 lore raw
Quoted 14 lines · Josh Poimboeuf
Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · CET Josh Poimboeuf
Quoted 10 lines · Arnd Bergmann

The latest binutils are warning about a .fill directive with an explicit value in a .bss section:

arch/x86/kernel/head_32.S: Assembler messages:
arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in section .bss..page_aligned' arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in section .bss..page_aligned'

This comes from the 'ENTRY()' macro padding the space between the symbols with 'nop'. Open-coding the .globl directive without the padding avoids that warning.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

How is there space between the symbols? Aren't they already aligned?

My understanding is that they are aligned, it's just that gas complains about the .align directive with a nonzero fill value.

Ah, I see now. In that case your patch looks fine to me.

Yes, ENTRY() is for code.

-hpa