diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2018-08-24 15:00:31 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-28 10:30:28 +0100 |
commit | c0abc412bc63f8792ec45695d665c9bd057d2ac7 (patch) | |
tree | 574468c1b85954a24603dc0f183efb442729dd8d /meta | |
parent | 87d3a9685dd9613e4f6718031d4ebd9344b01c47 (diff) | |
download | poky-c0abc412bc63f8792ec45695d665c9bd057d2ac7.tar.gz |
package.bbclass: only one hardlink of separated debug info file in each directory
While multiple hardlinks of binary located in different dirs,
there are also multiple hardlinks of separated debug info file
with the same binary name in same debug dirs. But in each dir,
only one debug file with original name works. Because all of
binary hardlinks have one `.gnu_debuglink' which is added in
`splitdebuginfo'. It caused gdb could not find debugging
symbols.
[Before the patch]
$ find .
./usr/bin/foo
./usr/bin/foo-hd1
./usr/bin/.debug
./usr/bin/.debug/foo
./usr/bin/.debug/foo-hd1
./usr/libexec/foo-hd2
./usr/libexec/.debug
./usr/libexec/.debug/foo-hd2
$ readelf --debug-dump usr/libexec/foo-hd2
Contents of the .gnu_debuglink section:
Separate debug info file: foo
$ gdb usr/libexec/foo-hd2
Reading symbols from usr/libexec/foo-hd2...(no debugging symbols found)...done.
[Before the patch]
[Apply the patch]
$ find .
./usr/bin/foo
./usr/bin/foo-hd1
./usr/bin/.debug
./usr/bin/.debug/foo
./usr/libexec/foo-hd2
./usr/libexec/.debug
./usr/libexec/.debug/foo
$ gdb usr/libexec/foo-hd2
Reading symbols from usr/libexec/foo-hd2...Reading symbols from usr/libexec/.debug/foo...done.
[Apply the patch]
(From OE-Core rev: d4eaf42f7708f8d3a31a04d958bd7420dd7dd6b9)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/package.bbclass | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index df9aacb237..9cfe43cbd1 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -1043,15 +1043,18 @@ python split_and_strip_files () { | |||
1043 | for ref in inodes: | 1043 | for ref in inodes: |
1044 | if len(inodes[ref]) == 1: | 1044 | if len(inodes[ref]) == 1: |
1045 | continue | 1045 | continue |
1046 | |||
1047 | target = inodes[ref][0][len(dvar):] | ||
1046 | for file in inodes[ref][1:]: | 1048 | for file in inodes[ref][1:]: |
1047 | src = file[len(dvar):] | 1049 | src = file[len(dvar):] |
1048 | dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend | 1050 | dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(target) + debugappend |
1049 | fpath = dvar + dest | 1051 | fpath = dvar + dest |
1050 | target = inodes[ref][0][len(dvar):] | ||
1051 | ftarget = dvar + debuglibdir + os.path.dirname(target) + debugdir + "/" + os.path.basename(target) + debugappend | 1052 | ftarget = dvar + debuglibdir + os.path.dirname(target) + debugdir + "/" + os.path.basename(target) + debugappend |
1052 | bb.utils.mkdirhier(os.path.dirname(fpath)) | 1053 | bb.utils.mkdirhier(os.path.dirname(fpath)) |
1053 | #bb.note("Link %s -> %s" % (fpath, ftarget)) | 1054 | # Only one hardlink of separated debug info file in each directory |
1054 | os.link(ftarget, fpath) | 1055 | if not os.access(fpath, os.R_OK): |
1056 | #bb.note("Link %s -> %s" % (fpath, ftarget)) | ||
1057 | os.link(ftarget, fpath) | ||
1055 | 1058 | ||
1056 | # Create symlinks for all cases we were able to split symbols | 1059 | # Create symlinks for all cases we were able to split symbols |
1057 | for file in symlinks: | 1060 | for file in symlinks: |