Handle .debug_macro in debugedit.
When compiling with -g3 gcc will generate a .debug_macro section which has pointers to the .debug_str section. Since we might rewrite the .debug_str section, we also need to update any .debug_macro pointers. Updated the debugedit.at testcase by building everything with -g and add various checks to see the .debug_macro section looks OK after running debugedit. Added a new rpmbuild.at testcase to check handing of .debug_macro in the whole rpmbuild debuginfo pipeline to double check the separate .debug file also contains the macros. Original patch by Michael Schroeder <mls@suse.de>. Extended by Mark Wielaard <mark@klomp.org> to deal with relocations and possible multiple COMDAT .debug_macro sections.
This commit is contained in:
parent
ab0b014eaa
commit
a78871c0bc
@ -35,11 +35,11 @@ cp "${abs_srcdir}"/data/SOURCES/foobar.h subdir_headers
|
||||
cp "${abs_srcdir}"/data/SOURCES/baz.c .
|
||||
|
||||
# First three object files (foo.o subdir_bar/bar.o and baz.o)
|
||||
gcc -g -Isubdir_headers -c subdir_foo/foo.c
|
||||
gcc -g3 -Isubdir_headers -c subdir_foo/foo.c
|
||||
cd subdir_bar
|
||||
gcc -g -I../subdir_headers -c bar.c
|
||||
gcc -g3 -I../subdir_headers -c bar.c
|
||||
cd ..
|
||||
gcc -g -I$(pwd)/subdir_headers -c $(pwd)/baz.c
|
||||
gcc -g3 -I$(pwd)/subdir_headers -c $(pwd)/baz.c
|
||||
|
||||
# Then a partially linked object file (somewhat like a kernel module).
|
||||
# This will still have relocations between the debug sections.
|
||||
@ -47,7 +47,7 @@ ld -r -o foobarbaz.part.o foo.o subdir_bar/bar.o baz.o
|
||||
|
||||
# Create an executable. Relocations between debug sections will
|
||||
# have been resolved.
|
||||
gcc -g -o foobarbaz.exe foo.o subdir_bar/bar.o baz.o
|
||||
gcc -g3 -o foobarbaz.exe foo.o subdir_bar/bar.o baz.o
|
||||
]])
|
||||
|
||||
# ===
|
||||
@ -320,3 +320,74 @@ readelf --debug-dump=line ./foobarbaz.exe \
|
||||
]],[0],[expout])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
# ===
|
||||
# Make sure .debug_macro strings are still there
|
||||
# in objects.
|
||||
# ===
|
||||
AT_SETUP([debugedit .debug_macro objects])
|
||||
AT_KEYWORDS([debuginfo] [debugedit])
|
||||
RPM_DEBUGEDIT_SETUP
|
||||
|
||||
# We expect 3 for each compile unit.
|
||||
AT_DATA([expout],
|
||||
[NUMBER 42
|
||||
NUMBER 42
|
||||
NUMBER 42
|
||||
])
|
||||
|
||||
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foo.o]])
|
||||
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]])
|
||||
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]])
|
||||
AT_CHECK([[
|
||||
readelf --debug-dump=macro foo.o subdir_bar/bar.o baz.o \
|
||||
| grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
|
||||
]],[0],[expout])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
# ===
|
||||
# Make sure .debug_macro strings are still there
|
||||
# in partial linked object.
|
||||
# ===
|
||||
AT_SETUP([debugedit .debug_macro partial])
|
||||
AT_KEYWORDS([debuginfo] [debugedit])
|
||||
RPM_DEBUGEDIT_SETUP
|
||||
|
||||
# We expect 3 for each compile unit.
|
||||
AT_DATA([expout],
|
||||
[NUMBER 42
|
||||
NUMBER 42
|
||||
NUMBER 42
|
||||
])
|
||||
|
||||
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]])
|
||||
AT_CHECK([[
|
||||
readelf --debug-dump=macro ./foobarbaz.part.o \
|
||||
| grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
|
||||
]],[0],[expout])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
# ===
|
||||
# Make sure .debug_macro strings are still there
|
||||
# in executable.
|
||||
# ===
|
||||
AT_SETUP([debugedit .debug_macro exe])
|
||||
AT_KEYWORDS([debuginfo] [debugedit])
|
||||
RPM_DEBUGEDIT_SETUP
|
||||
|
||||
# We expect 3 for each compile unit.
|
||||
AT_DATA([expout],
|
||||
[NUMBER 42
|
||||
NUMBER 42
|
||||
NUMBER 42
|
||||
])
|
||||
|
||||
AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]])
|
||||
AT_CHECK([[
|
||||
readelf --debug-dump=macro ./foobarbaz.exe \
|
||||
| grep NUMBER | rev | cut -d: -f1 | rev | cut -c2-
|
||||
]],[0],[expout])
|
||||
|
||||
AT_CLEANUP
|
||||
|
Loading…
Reference in New Issue
Block a user