This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Another minor incompatibility between gold and ld in naming of '.note.ABI-tag' section.


Greetings,

Gold-linked executables have their NT_GNU_ABI_TAG note in section
named '.note', while ld-linked ones have it in '.note.ABI-tag'
(which is how that section is named in crt1.o).

This is happening because Layout::output_section_name() truncates
names at the first '.'

Attached patch fixes that (it is convenient to keep the name,
so one could do "readelf -x.note.ABI-tag a.out" and have it work
as expected).

Ok to commit?

Thanks,

P.S. "make check" currently fails for me with (unrelated) failures:

make[3]: Target `ver_test_1.syms' not remade because of errors.
make[3]: Target `ver_test_2.syms' not remade because of errors.
make[3]: Target `ver_test_5.syms' not remade because of errors.
make[3]: Target `ver_test_7.syms' not remade because of errors.
make[3]: Target `ver_test_10.syms' not remade because of errors.
make[3]: Target `ver_matching_test.stdout' not remade because of errors.
make[3]: Target `script_test_4.stdout' not remade because of errors.
make[3]: Target `script_test_5.stdout' not remade because of errors.
make[3]: Target `dynamic_list.stdout' not remade because of errors.

All of the above look like this:

g++ -W -Wall   -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -g -O2   -o ver_test_4.so -Bgcctestdir/ -shared -Wl,--version-script,../../../src/gold/testsuite/ver_test_4.script ver_test_4.o
gcctestdir/ld: internal error in options, at ../../src/gold/parameters.h:84
collect2: ld returned 1 exit status

--
Paul Pluzhnikov


2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>

	    * layout.cc (Layout::output_section_name): Preserve names
	    of '.note.' sections.


Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.120
diff -u -p -u -r1.120 layout.cc
--- layout.cc	17 Mar 2009 20:36:30 -0000	1.120
+++ layout.cc	19 Mar 2009 18:10:30 -0000
@@ -2899,6 +2899,9 @@ Layout::output_section_name(const char* 
   // initial '.', we use the name unchanged (i.e., "mysection" and
   // ".text" are unchanged).
 
+  // If the name starts with '.note', we keep it unchanged (e.g. to
+  // avoid truncating '.note.ABI-tag' to '.note').
+
   // If the name starts with ".data.rel.ro.local" we use
   // ".data.rel.ro.local".
 
@@ -2914,6 +2917,8 @@ Layout::output_section_name(const char* 
   const char* sdot = strchr(s, '.');
   if (sdot == NULL)
     return name;
+  if (strncmp(name, ".note.", 6) == 0)
+    return name;
 
   const char* const data_rel_ro_local = ".data.rel.ro.local";
   if (strncmp(name, data_rel_ro_local, strlen(data_rel_ro_local)) == 0)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]