aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-14 03:12:53 +0000
committerIan Lance Taylor <iant@google.com>2007-10-14 03:12:53 +0000
commite2305dc04cdf5a1aefe22b954d747b1ac41948dd (patch)
tree080537ddc2022f923af69cd6542e126185191441 /gold
parent4eff2974c2948d23a81afd4e4d025fc2561d7491 (diff)
downloadgdb-e2305dc04cdf5a1aefe22b954d747b1ac41948dd.zip
gdb-e2305dc04cdf5a1aefe22b954d747b1ac41948dd.tar.gz
gdb-e2305dc04cdf5a1aefe22b954d747b1ac41948dd.tar.bz2
From Craig Silverstein: always use 32-bit format for gold note.
Diffstat (limited to 'gold')
-rw-r--r--gold/layout.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index e5c6492..cb9475c 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -640,7 +640,22 @@ Layout::create_note_section()
if (parameters->output_is_object())
return;
+ // Authorities all agree that the values in a .note field should
+ // be aligned on 4-byte boundaries for 32-bit binaries. However,
+ // they differ on what the alignment is for 64-bit binaries.
+ // The GABI says unambiguously they take 8-byte alignment:
+ // http://sco.com/developers/gabi/latest/ch5.pheader.html#note_section
+ // Other documentation says alignment should always be 4 bytes:
+ // http://www.netbsd.org/docs/kernel/elf-notes.html#note-format
+ // GNU ld and GNU readelf both support the latter (at least as of
+ // version 2.16.91), and glibc always generates the latter for
+ // .note.ABI-tag (as of version 1.6), so that's the one we go with
+ // here.
+#ifdef GABI_FORMAT_FOR_DOTNOTE_SECTION // this is not defined by default
const int size = parameters->get_size();
+#else
+ const int size = 32;
+#endif
// The contents of the .note section.
const char* name = "GNU";