[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Avoid bad paths for crt files in debug info



When building EGLIBC, some crt*.S files are generated by processing the 
output of compile commands.  The processing can leave .file lines output 
by the compiler in the generated files - but those .file lines are 
misleading.  Such .file lines can give a relative path name that is then 
interpreted relative to the wrong directory by the assembler to create 
debug info, leading to debug info pointing to files that don't exist.  
(This appears particularly on MIPS, apparently as a side-effect of using 
".file 1 initfini.c" instead of plain ".file initfini.c" as used on other 
targets.)  This patch arranges for the .file lines to be removed, so that 
any debug info accurately references the generated .S files in their 
correct directories.  Applied to EGLIBC trunk.

Index: csu/Makefile
===================================================================
--- csu/Makefile	(revision 7012)
+++ csu/Makefile	(working copy)
@@ -104,12 +104,12 @@
 # We only have one kind of startup code files.	Static binaries and
 # shared libraries are build using the PIC version.
 $(objpfx)crti.S: $(objpfx)initfini.s
-	sed -n -e '1,/@HEADER_ENDS/p' \
+	sed -n -e '/^[ 	]*\.file[ 	]/d' -e '1,/@HEADER_ENDS/p' \
 	       -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
 	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
 
 $(objpfx)crtn.S: $(objpfx)initfini.s
-	sed -n -e '1,/@HEADER_ENDS/p' \
+	sed -n -e '/^[ 	]*\.file[ 	]/d' -e '1,/@HEADER_ENDS/p' \
 	       -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
 	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
 
Index: nptl/Makefile
===================================================================
--- nptl/Makefile	(revision 7012)
+++ nptl/Makefile	(working copy)
@@ -564,11 +564,11 @@
 # We only have one kind of startup code files.  Static binaries and
 # shared libraries are build using the PIC version.
 $(objpfx)crti.S: $(objpfx)pt-initfini.s
-	sed -n -e '1,/@HEADER_ENDS/p' \
+	sed -n -e '/^[ 	]*\.file[ 	]/d' -e '1,/@HEADER_ENDS/p' \
 	       -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
 	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
 $(objpfx)crtn.S: $(objpfx)pt-initfini.s
-	sed -n -e '1,/@HEADER_ENDS/p' \
+	sed -n -e '/^[ 	]*\.file[ 	]/d' -e '1,/@HEADER_ENDS/p' \
 	       -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
 	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
 
Index: ChangeLog.eglibc
===================================================================
--- ChangeLog.eglibc	(revision 7012)
+++ ChangeLog.eglibc	(working copy)
@@ -1,3 +1,10 @@
+2008-09-24  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* csu/Makefile ($(objpfx)crti.S, $(objpfx)crtn.S): Remove .file
+	lines from generated .S file.
+	* nptl/Makefile ($(objpfx)crti.S, $(objpfx)crtn.S): Remove .file
+	lines from generated .S file.
+
 2008-09-08  Pete Eberlein  <eberlein@xxxxxxxxxx>
 
 	* elf/ldd.bash.in: Make pipefail check more robust when using

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx