diff mbox series

libgo patch committed: Always mark assembly file as non-executable stack

Message ID CAOyqgcXWzUnWy=nihZY-wEq8g4RGu0WjJAwre_ezijrWRwP_dA@mail.gmail.com
State New
Headers show
Series libgo patch committed: Always mark assembly file as non-executable stack | expand

Commit Message

Ian Lance Taylor Dec. 5, 2019, 5:51 p.m. UTC
This libgo patch arranges for go-context.S to always be marked as
using a non-executable stack.  This is not required for all targets,
but should do little harm.  Bootstrapped on x86_64-pc-linux-gnu.
Committed to mainline.

Ian

Comments

Rainer Orth Dec. 6, 2019, 11:28 a.m. UTC | #1
I Ian,

> This libgo patch arranges for go-context.S to always be marked as
> using a non-executable stack.  This is not required for all targets,
> but should do little harm.  Bootstrapped on x86_64-pc-linux-gnu.
> Committed to mainline.

unfortunately, it does, breaking bootstrap on Solaris/SPARC and x86 with
the native assembler:

* Solaris/SPARC with as:

/usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: invalid character (0x40)
/usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: quoted-string operand required
/usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: statement syntax
make[4]: *** [Makefile:1433: runtime/go-context.lo] Error 1

* Solaris/x86 with as:

Assembler:
        "/vol/gcc/src/hg/trunk/local/libgo/runtime/go-context.S", line 74 : Syntax error
        Near line: " .section .note.GNU-stack,"",@progbits"
make[4]: *** [Makefile:1433: runtime/go-context.lo] Error 1

	Rainer
Matthias Klose Dec. 6, 2019, 4:18 p.m. UTC | #2
On 06.12.19 12:28, Rainer Orth wrote:
> I Ian,
> 
>> This libgo patch arranges for go-context.S to always be marked as
>> using a non-executable stack.  This is not required for all targets,
>> but should do little harm.  Bootstrapped on x86_64-pc-linux-gnu.
>> Committed to mainline.
> 
> unfortunately, it does, breaking bootstrap on Solaris/SPARC and x86 with
> the native assembler:
> 
> * Solaris/SPARC with as:
> 
> /usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: invalid character (0x40)
> /usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: quoted-string operand required
> /usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: statement syntax
> make[4]: *** [Makefile:1433: runtime/go-context.lo] Error 1
> 
> * Solaris/x86 with as:
> 
> Assembler:
>         "/vol/gcc/src/hg/trunk/local/libgo/runtime/go-context.S", line 74 : Syntax error
>         Near line: " .section .note.GNU-stack,"",@progbits"
> make[4]: *** [Makefile:1433: runtime/go-context.lo] Error 1

also on arm-linux-gnueabi*. Patch in PR go/92820

Matthias
Rainer Orth Dec. 6, 2019, 5:20 p.m. UTC | #3
Hi Matthias,

> On 06.12.19 12:28, Rainer Orth wrote:
>> I Ian,
>> 
>>> This libgo patch arranges for go-context.S to always be marked as
>>> using a non-executable stack.  This is not required for all targets,
>>> but should do little harm.  Bootstrapped on x86_64-pc-linux-gnu.
>>> Committed to mainline.
>> 
>> unfortunately, it does, breaking bootstrap on Solaris/SPARC and x86 with
>> the native assembler:
>> 
>> * Solaris/SPARC with as:
>> 
>> /usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: invalid character
>> (0x40)
>> /usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: quoted-string
>> operand required
>> /usr/ccs/bin/as: "/var/tmp//ccSl12Nb.s", line 7: error: statement syntax
>> make[4]: *** [Makefile:1433: runtime/go-context.lo] Error 1
>> 
>> * Solaris/x86 with as:
>> 
>> Assembler:
>>         "/vol/gcc/src/hg/trunk/local/libgo/runtime/go-context.S", line 74
>> : Syntax error
>>         Near line: " .section .note.GNU-stack,"",@progbits"
>> make[4]: *** [Makefile:1433: runtime/go-context.lo] Error 1
>
> also on arm-linux-gnueabi*. Patch in PR go/92820

that won't help: for one, those .note.GNU-stack sections are useless on
Solaris.  Even if this weren't the case, the syntax is still wrong:
Solaris/SPARC as needs

	.section	".note.GNU-stack",,#progbits

while Solaris/x86 as doesn't allow for '-' in section names (and there's
no quoting mechanism IIRC).

	Rainer
Ian Lance Taylor Dec. 6, 2019, 7:53 p.m. UTC | #4
Thanks, rather than try to make this work everywhere, I decided to
only build the file for x86 GNU/Linux for now, since that is the only
place it is currently used.  This patch bootstrapped on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 279062)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-f04751699e1a1ce98fe8bdbcce5a00f1be6a7d15
+15c7bc9f0a432bc09716758412ea41d6caa6491b
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/Makefile.am
===================================================================
--- libgo/Makefile.am	(revision 278984)
+++ libgo/Makefile.am	(working copy)
@@ -414,6 +414,13 @@ else
 rtems_task_variable_add_file =
 endif
 
+runtime_context_asm_file =
+if LIBGO_IS_X86
+if LIBGO_IS_LINUX
+runtime_context_asm_file += runtime/go-context.S
+endif
+endif
+
 runtime_files = \
 	runtime/aeshash.c \
 	runtime/go-assert.c \
@@ -445,7 +452,7 @@ runtime_files = \
 	runtime/runtime_c.c \
 	runtime/stack.c \
 	runtime/yield.c \
-	runtime/go-context.S \
+	$(runtime_context_asm_file) \
 	$(rtems_task_variable_add_file)
 
 version.go: s-version; @true
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 278984)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-017830d2a4bd2efbddf5e841ba9ccff8acf9d7c8
+a59794347b9db6dc2101a65c3e1a068051c0ee81
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/runtime/go-context.S
===================================================================
--- libgo/runtime/go-context.S	(revision 278984)
+++ libgo/runtime/go-context.S	(working copy)
@@ -66,8 +66,9 @@  __go_makecontext:
 
 	ret
 
-	.section	.note.GNU-stack,"",@progbits
 	.section	.note.GNU-split-stack,"",@progbits
 	.section	.note.GNU-no-split-stack,"",@progbits
 
 #endif
+
+	.section	.note.GNU-stack,"",@progbits