forked from platformio/platformio-core
Improve finding of actual LD Script
This commit is contained in:
@ -292,16 +292,23 @@ def GetCompilerType(env):
|
|||||||
|
|
||||||
|
|
||||||
def GetActualLDScript(env):
|
def GetActualLDScript(env):
|
||||||
|
|
||||||
|
def _lookup_in_ldpath(script):
|
||||||
|
for d in env.get("LIBPATH", []):
|
||||||
|
path = join(env.subst(d), script)
|
||||||
|
if isfile(path):
|
||||||
|
return path
|
||||||
|
return None
|
||||||
|
|
||||||
script = None
|
script = None
|
||||||
for f in env.get("LINKFLAGS", []):
|
for f in env.get("LINKFLAGS", []):
|
||||||
if f.startswith("-Wl,-T"):
|
if f.startswith("-Wl,-T"):
|
||||||
script = env.subst(f[6:].replace('"', "").strip())
|
script = env.subst(f[6:].replace('"', "").strip())
|
||||||
if isfile(script):
|
if isfile(script):
|
||||||
return script
|
return script
|
||||||
for d in env.get("LIBPATH", []):
|
path = _lookup_in_ldpath(script)
|
||||||
path = join(env.subst(d), script)
|
if path:
|
||||||
if isfile(path):
|
return path
|
||||||
return path
|
|
||||||
|
|
||||||
if script:
|
if script:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
@ -309,7 +316,13 @@ def GetActualLDScript(env):
|
|||||||
(script, env.subst("$LIBPATH")))
|
(script, env.subst("$LIBPATH")))
|
||||||
env.Exit(1)
|
env.Exit(1)
|
||||||
|
|
||||||
return None
|
if not script and "LDSCRIPT_PATH" in env:
|
||||||
|
path = _lookup_in_ldpath(env['LDSCRIPT_PATH'])
|
||||||
|
if path:
|
||||||
|
return path
|
||||||
|
|
||||||
|
sys.stderr.write("Error: Could not find LD script\n")
|
||||||
|
env.Exit(1)
|
||||||
|
|
||||||
|
|
||||||
def VerboseAction(_, act, actstr):
|
def VerboseAction(_, act, actstr):
|
||||||
|
Reference in New Issue
Block a user