testsuite, jit, Darwin: Add libSystem to a test.

Message ID 20240116111335.55596-1-iain@sandoe.co.uk
State Unresolved
Headers
Series testsuite, jit, Darwin: Add libSystem to a test. |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Iain Sandoe Jan. 16, 2024, 11:13 a.m. UTC
  tested on x86_64, i686 Darwin, x86_64 Linux,
OK for trunk ? When ?
thanks
Iain

--- 8< ---

test-ggc-bugfix.c fails early on Darwin versions using a linker that
complains if libSystem is not present on user-land link lines.

Add this to fix that specific issue.

gcc/testsuite/ChangeLog:

	* jit.dg/test-ggc-bugfix.c: Add libSystem for Darwin.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
---
 gcc/testsuite/jit.dg/test-ggc-bugfix.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

David Malcolm Jan. 16, 2024, 7:34 p.m. UTC | #1
On Tue, 2024-01-16 at 11:13 +0000, Iain Sandoe wrote:
> tested on x86_64, i686 Darwin, x86_64 Linux,
> OK for trunk ? When ?

Thanks.  LGTM for trunk; given that the impact is limited to just a jit
testcase I think this can go in now.

Dave


> thanks
> Iain
> 
> --- 8< ---
> 
> test-ggc-bugfix.c fails early on Darwin versions using a linker that
> complains if libSystem is not present on user-land link lines.
> 
> Add this to fix that specific issue.
> 
> gcc/testsuite/ChangeLog:
> 
>         * jit.dg/test-ggc-bugfix.c: Add libSystem for Darwin.
> 
> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
> ---
>  gcc/testsuite/jit.dg/test-ggc-bugfix.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/gcc/testsuite/jit.dg/test-ggc-bugfix.c
> b/gcc/testsuite/jit.dg/test-ggc-bugfix.c
> index 59eb374af8b..fb857fbf0a7 100644
> --- a/gcc/testsuite/jit.dg/test-ggc-bugfix.c
> +++ b/gcc/testsuite/jit.dg/test-ggc-bugfix.c
> @@ -12,6 +12,11 @@ create_code (gcc_jit_context *ctxt, void
> *user_data)
>  {
>    gcc_jit_context_add_command_line_option (ctxt, "-flto");
>    gcc_jit_context_add_driver_option (ctxt, "-nostdlib");
> +#if __APPLE__
> +  /* On newer macOS, the test will fail with a complaint from the
> linker about
> +     all user-land exes needing libSystem, so add it.  */
> +  gcc_jit_context_add_driver_option (ctxt, "-lSystem");
> +#endif
>  
>    gcc_jit_type *type_int = gcc_jit_context_get_type (ctxt,
> GCC_JIT_TYPE_INT);
>    gcc_jit_param *params_for_func_main[0] = {
  

Patch

diff --git a/gcc/testsuite/jit.dg/test-ggc-bugfix.c b/gcc/testsuite/jit.dg/test-ggc-bugfix.c
index 59eb374af8b..fb857fbf0a7 100644
--- a/gcc/testsuite/jit.dg/test-ggc-bugfix.c
+++ b/gcc/testsuite/jit.dg/test-ggc-bugfix.c
@@ -12,6 +12,11 @@  create_code (gcc_jit_context *ctxt, void *user_data)
 {
   gcc_jit_context_add_command_line_option (ctxt, "-flto");
   gcc_jit_context_add_driver_option (ctxt, "-nostdlib");
+#if __APPLE__
+  /* On newer macOS, the test will fail with a complaint from the linker about
+     all user-land exes needing libSystem, so add it.  */
+  gcc_jit_context_add_driver_option (ctxt, "-lSystem");
+#endif
 
   gcc_jit_type *type_int = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
   gcc_jit_param *params_for_func_main[0] = {