Skip to content

Commit

Permalink
runtime/cgo: consolidate linux cgo code
Browse files Browse the repository at this point in the history
Much of the gcc_linux_*.c code is identical and duplicated across
architectures. Consolidate code for 386, arm, loong64, mips* and
riscv64, where the only difference is the build tags (386 also
has some non-functional ordering differences).

Change-Id: I14ee9a4cc6b72e165239d196b68b6343efaddf0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/518620
Run-TryBot: Joel Sing <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
4a6f656c committed Aug 15, 2023
1 parent 60506f4 commit 23e4a4b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build linux && (386 || arm || loong64 || mips || mipsle || mips64 || mips64le || riscv64)

#include <pthread.h>
#include <string.h>
#include <signal.h>
#include "libcgo.h"
#include "libcgo_unix.h"

static void *threadentry(void*);
static void (*setg_gcc)(void*);

// This will be set in gcc_android.c for android-specific customization.
void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common));
static void (*setg_gcc)(void*);

void
x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase)
{
setg_gcc = setg;

_cgo_set_stacklo(g, NULL);

if (x_cgo_inittls) {
Expand Down
63 changes: 0 additions & 63 deletions src/runtime/cgo/gcc_linux_arm.c

This file was deleted.

63 changes: 0 additions & 63 deletions src/runtime/cgo/gcc_linux_loong64.c

This file was deleted.

65 changes: 0 additions & 65 deletions src/runtime/cgo/gcc_linux_mips64x.c

This file was deleted.

66 changes: 0 additions & 66 deletions src/runtime/cgo/gcc_linux_mipsx.c

This file was deleted.

63 changes: 0 additions & 63 deletions src/runtime/cgo/gcc_linux_riscv64.c

This file was deleted.

0 comments on commit 23e4a4b

Please sign in to comment.