Skip to content

Commit

Permalink
Untitled commit
Browse files Browse the repository at this point in the history
commit_hash:738c0e3b90d7c428015a34c302c8bcba5b98b759
  • Loading branch information
pg committed Feb 11, 2025
1 parent fabc611 commit 02028c3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions build/conf/linkers/ld.conf
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ LINK_SCRIPT_EXE_FLAGS=

REAL_LINK_EXE_CMDLINE =\
$YMAKE_PYTHON ${input:"build/scripts/link_exe.py"} \
REAL_LINK_EXE_CMDLINE+=--start-plugins ${ext=.pyplugin:SRCS_GLOBAL} --end-plugins
REAL_LINK_EXE_CMDLINE+=--clang-ver $CLANG_VER
REAL_LINK_EXE_CMDLINE+=$_LD_LINKER_OUTPUT
REAL_LINK_EXE_CMDLINE+=\
Expand Down
19 changes: 16 additions & 3 deletions build/scripts/link_exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import os.path
import sys
import json
import subprocess
import optparse
import textwrap
Expand Down Expand Up @@ -321,7 +322,7 @@ def fix_blas_resolving(cmd):
return cmd


def parse_args():
def parse_args(args):
parser = optparse.OptionParser()
parser.disable_interspersed_args()
parser.add_option('--musl', action='store_true')
Expand All @@ -341,11 +342,23 @@ def parse_args():
parser.add_option('--whole-archive-libs', action='append')
parser.add_option('--exclude-libs', action='append')
thinlto_cache.add_options(parser)
return parser.parse_args()
return parser.parse_args(args)


if __name__ == '__main__':
opts, args = parse_args()
args = sys.argv[1:]
ib = args.index('--start-plugins')
ie = args.index('--end-plugins')
plugins = args[ib + 1:ie]
args = args[:ib] + args[ie + 1:]

for p in plugins:
res = subprocess.check_output([sys.executable, p] + args).decode().strip()

if res:
args = json.loads(res)

opts, args = parse_args(args)
args = pcf.skip_markers(args)

cmd = fix_blas_resolving(args)
Expand Down
10 changes: 7 additions & 3 deletions build/ymake.core.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
###
### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
module _LINK_UNIT: _BASE_UNIT {
.EXTS=.o .obj .supp .sbom .tidyjson .ld .a .lib
.EXTS=.o .obj .supp .sbom .tidyjson .ld .a .lib .pyplugin
.CMD=$LINK_EXE
.STRUCT_CMD=yes
.ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
Expand Down Expand Up @@ -1800,7 +1800,7 @@ module _LIBRARY: _BASE_UNIT {
.STRUCT_CMD=yes
.NODE_TYPE=Library
.PEERDIR_POLICY=as_include
.EXTS=.o .obj .a .mf .supp .sbom .tidyjson .ld .lib .sdcmeta
.EXTS=.o .obj .a .mf .supp .sbom .tidyjson .ld .lib .sdcmeta .pyplugin
.ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
.GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB _LINK_EXCLUDE_LIBRARIES
.RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
Expand Down Expand Up @@ -1951,7 +1951,7 @@ module RESOURCES_LIBRARY: _BARE_UNIT {
.ALIASES=EXTRALIBS=PY_EXTRALIBS
.NODE_TYPE=Library
.PEERDIR_POLICY=as_include
.EXTS=.o .obj .a .mf .supp .sbom .tidyjson .ld .lib
.EXTS=.o .obj .a .mf .supp .sbom .tidyjson .ld .lib .pyplugin
.GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH OBJADDE_LIB SRCS


Expand Down Expand Up @@ -3136,6 +3136,10 @@ macro _SRC_f_old(SRC, SRCFLAGS...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${hide;output_include:"f2c.h"} ${hide;kv:"p FT"} ${hide;kv:"pc light-green"}
}

macro LD_PLUGIN(name) {
SRCS(GLOBAL $name.pyplugin)
}

USE_FLANG=no

when ($USE_FLANG == "yes") {
Expand Down

0 comments on commit 02028c3

Please sign in to comment.