This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 55c7af19f41 tools/symbolprefix: pass objcopy rename arguments via a 
file
55c7af19f41 is described below

commit 55c7af19f41710969e3671eec710c7518c584c84
Author: anjiahao <[email protected]>
AuthorDate: Sun Nov 29 00:12:49 2026 +0800

    tools/symbolprefix: pass objcopy rename arguments via a file
    
    process_one() builds the --rename-section list as a bash array and
    expands it on the objcopy command line.  A library with many allocated
    sections can make that command line exceed the system argument limit,
    and objcopy then fails with E2BIG.  Write the arguments to a temporary
    file and pass it with @file instead.
    
    Signed-off-by: anjiahao <[email protected]>
---
 tools/symbolprefix.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/symbolprefix.sh b/tools/symbolprefix.sh
index 100c03b6fae..d27645c4b53 100755
--- a/tools/symbolprefix.sh
+++ b/tools/symbolprefix.sh
@@ -132,7 +132,8 @@ process_one() {
     local output_file="$2"
     local prefix="$3"
 
-    local rename_args=()
+    local rename_args
+    rename_args=$(mktemp)
 
     # search all alloc section to rename
     while read -r section flags; do
@@ -143,7 +144,8 @@ process_one() {
             fi
 
             newname=".${prefix}${section#.}"
-            rename_args+=(--rename-section "$section=$newname")
+            printf -- '--rename-section\n%s=%s\n' "$section" "$newname" \
+                   >> "$rename_args"
         fi
     done < <($READELF -W -S "$input" | awk '
             /^\s*\[[[:space:]]*[0-9]+[[:space:]]*\]/ {
@@ -155,7 +157,8 @@ process_one() {
             }
             ' | sort -u)
 
-    $OBJCOPY "${rename_args[@]}" --prefix-symbols=$prefix "$input" 
"$output_file"
+    $OBJCOPY "@$rename_args" --prefix-symbols=$prefix "$input" "$output_file"
+    rm -f "$rename_args"
 }
 
 remove_prefix_args=()

Reply via email to