mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
compiler: emit non-PIE executables
This fixes a problem on baremetal targets, where PIE doesn't make any sense. Specifically, on ARM, the compiler sometimes inserted GOT pointers for linker-defined globals.
This commit is contained in:
+1
-1
@@ -93,7 +93,7 @@ func NewCompiler(pkgName, triple string, dumpSSA bool) (*Compiler, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.machine = target.CreateTargetMachine(triple, "", "", llvm.CodeGenLevelDefault, llvm.RelocPIC, llvm.CodeModelDefault)
|
||||
c.machine = target.CreateTargetMachine(triple, "", "", llvm.CodeGenLevelDefault, llvm.RelocStatic, llvm.CodeModelDefault)
|
||||
c.targetData = c.machine.CreateTargetData()
|
||||
|
||||
c.mod = llvm.NewModule(pkgName)
|
||||
|
||||
@@ -25,10 +25,11 @@ type TargetSpec struct {
|
||||
// Load a target specification
|
||||
func LoadTarget(target string) (*TargetSpec, error) {
|
||||
spec := &TargetSpec{
|
||||
Triple: target,
|
||||
BuildTags: []string{runtime.GOOS, runtime.GOARCH},
|
||||
Linker: "cc",
|
||||
Objcopy: "objcopy",
|
||||
Triple: target,
|
||||
BuildTags: []string{runtime.GOOS, runtime.GOARCH},
|
||||
Linker: "cc",
|
||||
PreLinkArgs: []string{"-no-pie"}, // WARNING: clang < 5.0 requires -nopie
|
||||
Objcopy: "objcopy",
|
||||
}
|
||||
|
||||
// See whether there is a target specification for this target (e.g.
|
||||
|
||||
Reference in New Issue
Block a user