Skip to contentSkip to conversation

arm32: Avoid using solaris syntax for .section directive

PATCH In review Khem Raj 4 participants 9 messages Aug 1, 2023 – Aug 2, 2023

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 arm32: Avoid using solaris syntax for .section directive

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release, It likely went unnoticed so far because Linux kernel changed to GNU syntax already in 5.5, to allow building with Clang's integrated assembler.

Switch to using GNU syntax

.section name[, "flags"[, @type]]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601
[2] https://sourceware.org/binutils/docs-2.41/as.html#Section

---
v1 -> v2:
- Improvise on commit message
- Make similar change in xen/arch/arm/dtb.S

 xen/arch/arm/arm32/proc-v7.S | 6 +++---
 xen/arch/arm/dtb.S           | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/arm32/proc-v7.S +3 -3
index c90a31d80f..6d3d19b873 100644
@@ -29,7 +29,7 @@ brahma15mp_init:
         mcr   CP32(r0, ACTLR)
         mov   pc, lr
 
-        .section ".proc.info", #alloc
+        .section .proc.info, "a"
         .type __v7_ca15mp_proc_info, #object
 __v7_ca15mp_proc_info:
         .long 0x410FC0F0             /* Cortex-A15 */
@@ -38,7 +38,7 @@ __v7_ca15mp_proc_info:
         .long caxx_processor
         .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
 
-        .section ".proc.info", #alloc
+        .section .proc.info, "a"
         .type __v7_ca7mp_proc_info, #object
 __v7_ca7mp_proc_info:
         .long 0x410FC070             /* Cortex-A7 */
@@ -47,7 +47,7 @@ __v7_ca7mp_proc_info:
         .long caxx_processor
         .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info
 
-        .section ".proc.info", #alloc
+        .section .proc.info, "a"
         .type __v7_brahma15mp_proc_info, #object
 __v7_brahma15mp_proc_info:
         .long 0x420F00F0             /* Broadcom Brahma-B15 */
xen/arch/arm/dtb.S +1 -1
index c39f3a095c..386f83ba64 100644
@@ -1,3 +1,3 @@
-        .section .dtb,#alloc
+        .section .dtb, "a"
         GLOBAL(_sdtb)
         .incbin CONFIG_DTB_FILE
Signature · 1 line
2.41.0
#1 lore raw

Hi,

Title: This patch is not arm32 specific anymore. So I would replace 'arm32' with 'arm'. This can be done on commit.

Quoted 7 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release,

The next word after ',' start with an uppercase. Did you intend to use '.' rather than ','?

That said, the documentation has the following:

For SPARC ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:"

This leads me to think this is not a regression and instead an intended behavior (even though it breaks older build) even it breaks build.

I would suggest to reword the commit message to:

"
Assembler from binutiles 2.41 will rejects ([1], [2]) the following syntax

.section "name", #alloc

for any other any target other than ELF SPARC. This means we can't use it in the Arm code.

So switch to the GNU syntax

.section name [, "flags"[, @type]]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601
[2] https://sourceware.org/binutils/docs-2.41/as.html#Section

If you agree with the commit message, I can update it while committing.

We should also consider to backport.

Cheers,

Signature · 1 line
Julien Grall
author
#2 lore raw
Quoted 36 lines · Julien Grall

Hi,

Title: This patch is not arm32 specific anymore. So I would replace 'arm32' with 'arm'. This can be done on commit.

Quoted 7 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release,

The next word after ',' start with an uppercase. Did you intend to use '.' rather than ','?

That said, the documentation has the following:

For SPARC ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:"

This leads me to think this is not a regression and instead an intended behavior (even though it breaks older build) even it breaks build.

I would suggest to reword the commit message to:

"
Assembler from binutiles 2.41 will rejects ([1], [2]) the following syntax

.section "name", #alloc

for any other any target other than ELF SPARC. This means we can't use it in the Arm code.

Quoted 8 lines

So switch to the GNU syntax

.section name [, "flags"[, @type]]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601
[2] https://sourceware.org/binutils/docs-2.41/as.html#Section

If you agree with the commit message, I can update it while committing.

LGTM, go ahead.

Quoted 7 lines

We should also consider to backport.

Cheers,

--
Julien Grall

Acked-by
#3 lore raw

Hi,

Quoted 39 lines · Khem Raj
Quoted 38 lines · Julien Grall

Hi,

Title: This patch is not arm32 specific anymore. So I would replace 'arm32' with 'arm'. This can be done on commit.

Quoted 7 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release,

The next word after ',' start with an uppercase. Did you intend to use '.' rather than ','?

That said, the documentation has the following:

For SPARC ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:"

This leads me to think this is not a regression and instead an intended behavior (even though it breaks older build) even it breaks build.

I would suggest to reword the commit message to:

"
Assembler from binutiles 2.41 will rejects ([1], [2]) the following syntax

.section "name", #alloc

for any other any target other than ELF SPARC. This means we can't use it in the Arm code.

So switch to the GNU syntax

Quoted 8 lines
Quoted 6 lines

.section name [, "flags"[, @type]]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601
[2] https://sourceware.org/binutils/docs-2.41/as.html#Section

If you agree with the commit message, I can update it while committing.

LGTM, go ahead.

I have committed with:

Cheers,

Signature · 1 line
Julien Grall
#4 lore raw
In reply to Julien Grall
Quoted 14 lines · Julien Grall

Hi,

Title: This patch is not arm32 specific anymore. So I would replace 'arm32' with 'arm'. This can be done on commit.

Quoted 7 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release,

Quoted 7 lines

The next word after ',' start with an uppercase. Did you intend to use '.' rather than ','?

That said, the documentation has the following:

For SPARC ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:"

But note that "SPARC" was added there only by the commit introducing the perceived regression.

Jan

Quoted 26 lines

This leads me to think this is not a regression and instead an intended behavior (even though it breaks older build) even it breaks build.

I would suggest to reword the commit message to:

"
Assembler from binutiles 2.41 will rejects ([1], [2]) the following syntax

.section "name", #alloc

for any other any target other than ELF SPARC. This means we can't use it in the Arm code.

So switch to the GNU syntax

.section name [, "flags"[, @type]]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601
[2] https://sourceware.org/binutils/docs-2.41/as.html#Section

If you agree with the commit message, I can update it while committing.

We should also consider to backport.

Cheers,

#5 lore raw

Hi Jan,

Quoted 18 lines · Jan Beulich
Quoted 17 lines · Julien Grall

Hi,

Title: This patch is not arm32 specific anymore. So I would replace 'arm32' with 'arm'. This can be done on commit.

Quoted 7 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release,

The next word after ',' start with an uppercase. Did you intend to use '.' rather than ','?

Quoted 7 lines
Quoted 4 lines

That said, the documentation has the following:

For SPARC ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:"

But note that "SPARC" was added there only by the commit introducing the perceived regression.

Yes, I noticed it while replying yesterday. I still would not describe it as a regression mainly because I am not convinced binutils will revert the change and it feels like a good move.

Also, regarding your point about older tree on the bug report. I don't think we guarantee that stable works all new toolchain without any change.

Cheers,

Signature · 1 line
Julien Grall
#6 lore raw
Quoted 22 lines · Julien Grall
Quoted 21 lines · Jan Beulich
Quoted 19 lines · Julien Grall

Title: This patch is not arm32 specific anymore. So I would replace 'arm32' with 'arm'. This can be done on commit.

Quoted 7 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release,

The next word after ',' start with an uppercase. Did you intend to use '.' rather than ','?

That said, the documentation has the following:

For SPARC ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:"

Quoted 6 lines
Quoted 2 lines

But note that "SPARC" was added there only by the commit introducing the perceived regression.

Yes, I noticed it while replying yesterday. I still would not describe it as a regression mainly because I am not convinced binutils will revert the change and it feels like a good move.

I agree as to it being unlikely that the change is going to be (partly) reverted, unless someone strongly advocated for it. It also wouldn't be of much use to us, unless a 2.41.1 was cut very soon.

Quoted 2 lines

Also, regarding your point about older tree on the bug report. I don't think we guarantee that stable works all new toolchain without any change.

We don't guarantee that, no, but I think it is in our own interest to keep things building with the newest tool chains. When build-testing stable tree commits before pushing, I don't want to always have to remember to force the build to use an older tool chain, when normally my build rune would default to a pretty up-to-date one. This is also why for this specific class of changes I typically prefer to see them also go onto the security-only stable trees.

Jan

#7 lore raw

Hi Jan,

Quoted 34 lines · Jan Beulich
Quoted 22 lines · Julien Grall
Quoted 21 lines · Jan Beulich
Quoted 19 lines · Julien Grall

Title: This patch is not arm32 specific anymore. So I would replace 'arm32' with 'arm'. This can be done on commit.

Quoted 7 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release,

The next word after ',' start with an uppercase. Did you intend to use '.' rather than ','?

That said, the documentation has the following:

For SPARC ELF targets, the assembler supports another type of .section directive for compatibility with the Solaris assembler:"

Quoted 6 lines
Quoted 2 lines

But note that "SPARC" was added there only by the commit introducing the perceived regression.

Yes, I noticed it while replying yesterday. I still would not describe it as a regression mainly because I am not convinced binutils will revert the change and it feels like a good move.

I agree as to it being unlikely that the change is going to be (partly) reverted, unless someone strongly advocated for it. It also wouldn't be of much use to us, unless a 2.41.1 was cut very soon.

Quoted 8 lines
Quoted 2 lines

Also, regarding your point about older tree on the bug report. I don't think we guarantee that stable works all new toolchain without any change.

We don't guarantee that, no, but I think it is in our own interest to keep things building with the newest tool chains. When build-testing stable tree commits before pushing, I don't want to always have to remember to force the build to use an older tool chain, when normally my build rune would default to a pretty up-to-date one.

This is where gitlab would definitely help because we can keep containers around to build older Xen versions.

Quoted 3 lines

This is also
why for this specific class of changes I typically prefer to see them also go onto the security-only stable trees.

I am ok if this is backported to older tree. This is trivial enough.

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by on v2 1/1
#8 lore raw
In reply to Khem Raj

Hi,

Quoted 13 lines · Khem Raj

Assembler from binutils 2.41 rejects [1] this syntax

.section "name"[, flags...]

where flags could be #alloc, #write, #execinstr, #exclude, and #tls [2]

It is almost like a regression compared to 2.40 or older release, It likely went unnoticed so far because Linux kernel changed to GNU syntax already in 5.5, to allow building with Clang's integrated assembler.

Quoted 8 lines

Switch to using GNU syntax

.section name[, "flags"[, @type]]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601
[2] https://sourceware.org/binutils/docs-2.41/as.html#Section

With the changes suggested by Julien:

~Michal