From: H. Peter Anvin Date: Sun, 10 Jun 2007 19:34:30 +0000 (-0700) Subject: lstadjust: handle struc/endstruc correctly X-Git-Tag: syslinux-3.51~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3da458594240844d94d912328979037fdc1925df;p=platform%2Fupstream%2Fsyslinux.git lstadjust: handle struc/endstruc correctly struc/endstruc effectively push/pop the context around them. --- diff --git a/lstadjust.pl b/lstadjust.pl index 84b6e8b..e2e395f 100755 --- a/lstadjust.pl +++ b/lstadjust.pl @@ -33,6 +33,8 @@ while (defined($line = )) { close(MAP); $offset = 0; +@ostack = (); + while (defined($line = )) { chomp $line; @@ -41,15 +43,16 @@ while (defined($line = )) { $source = $1; } - if ($source =~ /^\S*\s+(\S+)\s+(\S+)/) { - $op = $1; - $arg = $2; - - if ($op =~ /^(|\[)section$/i) { - $offset = $vstart{$arg}; - } elsif ($op =~ /^(absolute|\[absolute|struc)$/i) { - $offset = 0; - } + ($label, $op, $arg, $tail) = split(/\s+/, $source); + if ($op =~ /^(|\[)section$/i) { + $offset = $vstart{$arg}; + } elsif ($op =~ /^(absolute|\[absolute)$/i) { + $offset = 0; + } elsif ($op =~ /^struc$/i) { + push(@ostack, $offset); + $offset = 0; + } elsif ($op =~ /^endstruc$/i) { + $offset = pop(@ostack); } if ($line =~ /^(\s*[0-9]+ )([0-9A-F]{8})(\s.*)$/) {