fix: use system installed objcopy to copy debug symbols (#23835)
This commit is contained in:
parent
e8ea007104
commit
b086197968
3 changed files with 13 additions and 31 deletions
|
@ -5,7 +5,7 @@ import os
|
|||
import sys
|
||||
|
||||
from lib.config import LINUX_BINARIES, PLATFORM
|
||||
from lib.util import execute, get_objcopy_path, get_out_dir
|
||||
from lib.util import execute, get_out_dir
|
||||
|
||||
def add_debug_link_into_binaries(directory, target_cpu, debug_dir):
|
||||
for binary in LINUX_BINARIES:
|
||||
|
@ -14,18 +14,15 @@ def add_debug_link_into_binaries(directory, target_cpu, debug_dir):
|
|||
add_debug_link_into_binary(binary_path, target_cpu, debug_dir)
|
||||
|
||||
def add_debug_link_into_binary(binary_path, target_cpu, debug_dir):
|
||||
try:
|
||||
objcopy = get_objcopy_path(target_cpu)
|
||||
except:
|
||||
if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or
|
||||
target_cpu == 'arm64'):
|
||||
# Skip because no objcopy binary on the given target.
|
||||
return
|
||||
raise
|
||||
if PLATFORM == 'linux' and (target_cpu == 'x86' or target_cpu == 'arm' or
|
||||
target_cpu == 'arm64'):
|
||||
# Skip because no objcopy binary on the given target.
|
||||
return
|
||||
|
||||
debug_name = get_debug_name(binary_path)
|
||||
# Make sure the path to the binary is not relative because of cwd param.
|
||||
real_binary_path = os.path.realpath(binary_path)
|
||||
cmd = [objcopy, '--add-gnu-debuglink=' + debug_name, real_binary_path]
|
||||
cmd = ['objcopy', '--add-gnu-debuglink=' + debug_name, real_binary_path]
|
||||
execute(cmd, cwd=debug_dir)
|
||||
|
||||
def get_debug_name(binary_path):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue