Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 227509 - RPM's debugedit can't edit compilation directory of unoptimized binaries
Summary: RPM's debugedit can't edit compilation directory of unoptimized binaries
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-02-06 15:49 UTC by Lubomir Kundrak
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-03-13 15:20:02 UTC


Attachments (Terms of Use)

Description Lubomir Kundrak 2007-02-06 15:49:29 UTC
Description of problem:

Binaries compiled without any optimization can not be properly edited with
/usr/lib/rpm/debugedit.

How reproducible:

Always.

Steps to Reproduce:

Compile the binary.
$ cc -g -O1 test.c -o test-O1

The binary was compiled in /home/lkundrak/db-dir-test
$ readelf -w test-O1 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
    DW_AT_comp_dir     DW_FORM_strp
     DW_AT_comp_dir    : (indirect string, offset: 0x2f): /home/lkundrak/db-dir-test
$ cc -g -O0 test.c -o test-O0
$ readelf -w test-O0 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
    DW_AT_comp_dir     DW_FORM_string
     DW_AT_comp_dir    : /home/lkundrak/db-dir-test

Now attempt to change the compile base:
$ /usr/lib/rpm/debugedit -b ~ -d /woo/hoo -l cwac test-O1
$ /usr/lib/rpm/debugedit -b ~ -d /woo/hoo -l cwac test-O0

Actual results:

The compile base dir of unoptimized binary didn't change, unlike the uptimized one
$ readelf -w test-O1 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
    DW_AT_comp_dir     DW_FORM_strp
     DW_AT_comp_dir    : (indirect string, offset: 0x2f): /woo/hoo/db-dir-test
$ readelf -w test-O0 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
    DW_AT_comp_dir     DW_FORM_string
     DW_AT_comp_dir    : /home/lkundrak/db-dir-test

Expected results:

Compilation directory of the binary changes.

Comment 1 Jeff Johnson 2007-02-06 18:07:59 UTC
Can you give me ptrs to test-O0 and test-O1? There has been
a fix to handle -O0 within the last year, I'll verify whether the
fix "works".

Comment 2 Lubomir Kundrak 2007-02-06 18:31:32 UTC
compile any C file, say main () {}, with -O0 and with -O1

Comment 3 Jeff Johnson 2007-02-06 21:56:25 UTC
OK, so the representaion DW_AT_comp_dir is different
depending on -O0 and -O1, one of which is changed,
the other of which is not, by debugedit.

Why is this an rpm, not an elfutils/binutils/gcc, problem?

And why are you trying to use debugedit in this fashion?


Comment 4 Paul Nasrat 2007-03-13 11:25:39 UTC
Lubomir - what version of rpm are you using? I thought rpm-4.4.2-34 and later
had a fix for this.

Please confirm on latest rawhide.

Comment 5 Lubomir Kundrak 2007-03-13 12:36:23 UTC
I am using rpm-4.4.2-32.
I will try with the latest and report shortly.


Comment 6 Lubomir Kundrak 2007-03-13 13:10:59 UTC
Seems like it works as expected. Much thanks.

$ cc -g -O1 test.c -o test-O1
$ readelf -w test-O1 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
     DW_AT_comp_dir    : (indirect string, offset: 0x2f): /home/lkundrak/qok
    DW_AT_comp_dir     DW_FORM_strp
$  cc -g -O0 test.c -o test-O0
$ readelf -w test-O0 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
     DW_AT_comp_dir    : /home/lkundrak/qok
    DW_AT_comp_dir     DW_FORM_string
$ /usr/lib/rpm/debugedit -b ~ -d /woo/hoo -l cwac test-O1
$ /usr/lib/rpm/debugedit -b ~ -d /woo/hoo -l cwac test-O0
$ readelf -w test-O1 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
     DW_AT_comp_dir    : (indirect string, offset: 0x2f): /woo/hoo/qok
    DW_AT_comp_dir     DW_FORM_strp
$ readelf -w test-O0 2>/dev/null |grep DW_AT_comp_dir |sort |uniq
     DW_AT_comp_dir    : /woo/hoo///////qok
    DW_AT_comp_dir     DW_FORM_string
$


Note You need to log in before you can comment on or make changes to this bug.