-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorganize everything in a single invocation (take 2)
- Loading branch information
Showing
13 changed files
with
358 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
import os.path | ||
import subprocess | ||
import sys | ||
|
||
from .parse import * | ||
from .shared import eprintf | ||
|
||
def cc_relink_objs(verbose, cc_bin, arch, inputs, output, cflags): | ||
archflag = '-m64' if arch == "x86_64" else '-m32' | ||
|
||
cctyp, ccver = get_cc_version(cc_bin) | ||
assert cctyp == "gcc", "A GCC compiler is needed for relinking objects!" | ||
relink_arg = "-flinker-output=rel" if ccver < (9,0) else "-flinker-output=nolto-rel" | ||
|
||
args = [cc_bin, archflag, '-nostartfiles', '-nostdlib', \ | ||
'-r', relink_arg, '-o', output] + cflags + inputs | ||
|
||
if verbose: eprintf("cc: %s" % repr(args)) | ||
subprocess.check_call(args, stdout=subprocess.DEVNULL) | ||
|
||
def nasm_assemble_elfhdr(verbose, nasm_bin, arch, rtdir, intbl, output, asflags): | ||
if rtdir[-1] != '/': rtdir = rtdir + '/' | ||
archflag = 'elf64' if arch == "x86_64" else 'elf32' | ||
|
||
args = [nasm_bin, '-I', rtdir, '-f', archflag] + asflags + [intbl, '-o', output] | ||
|
||
if verbose: eprintf("nasm: %s" % repr(args)) | ||
subprocess.check_call(args, stdout=subprocess.DEVNULL) | ||
|
||
def ld_link_final(verbose, cc_bin, arch, lddir, inobjs, output, ldflags): | ||
archflag = '-m64' if arch == "x86_64" else '-m32' | ||
|
||
args = [cc_bin, archflag, '-T', lddir+'/link.ld', \ | ||
'-Wl,--oformat=binary', '-nostartfiles', '-nostdlib', \ | ||
'-o', output] + inobjs + ldflags | ||
|
||
if verbose: eprintf("ld: %s" % repr(args)) | ||
subprocess.check_call(args, stdout=subprocess.DEVNULL) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.