summaryrefslogtreecommitdiffstats
path: root/lib/csu/common
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-01-13 20:44:31 +0000
committerdim <dim@FreeBSD.org>2011-01-13 20:44:31 +0000
commitab827c028eedd7664bee6500a872dffb5123b112 (patch)
treebed14e15d037c7e323186851d3d94c920705aec5 /lib/csu/common
parent27096771668041179314af70a766a06feacf4578 (diff)
downloadFreeBSD-src-ab827c028eedd7664bee6500a872dffb5123b112.zip
FreeBSD-src-ab827c028eedd7664bee6500a872dffb5123b112.tar.gz
Apply a workaround for a binutils issue with the .note.ABI-tag section
generated from lib/csu/common/crtbrand.c (which ultimately ends up in executables and shared libraries, via crt1.o, gcrt1.o or Scrt1.o). For all arches except sparc, gcc emits the section directive for the abitag struct in crtbrand.c with a PROGBITS type. However, newer versions of binutils (after 2.16.90) require the section to be of NOTE type, to guarantee that the .note.ABI-tag section correctly ends up in the first page of the final executable. Unfortunately, there is no clean way to tell gcc to use another section type, so crtbrand.c (or the C files that include it) must be compiled in multiple steps: - Compile the .c file to a .s file. - Edit the .s file to change the 'progbits' type to 'note', for the section directive that defines the .note.ABI-tag section. - Compile the .s file to an object file. These steps are done in the invididual Makefiles for each applicable arch. Reviewed by: kib
Diffstat (limited to 'lib/csu/common')
-rw-r--r--lib/csu/common/crtbrand.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/csu/common/crtbrand.c b/lib/csu/common/crtbrand.c
index 684a48e..444d7f1 100644
--- a/lib/csu/common/crtbrand.c
+++ b/lib/csu/common/crtbrand.c
@@ -36,6 +36,23 @@ __FBSDID("$FreeBSD$");
* Special ".note" entry specifying the ABI version. See
* http://www.netbsd.org/Documentation/kernel/elf-notes.html
* for more information.
+ *
+ * For all arches except sparc, gcc emits the section directive for the
+ * following struct with a PROGBITS type. However, newer versions of binutils
+ * (after 2.16.90) require the section to be of NOTE type, to guarantee that the
+ * .note.ABI-tag section correctly ends up in the first page of the final
+ * executable.
+ *
+ * Unfortunately, there is no clean way to tell gcc to use another section type,
+ * so this C file (or the C file that includes it) must be compiled in multiple
+ * steps:
+ *
+ * - Compile the .c file to a .s file.
+ * - Edit the .s file to change the 'progbits' type to 'note', for the section
+ * directive that defines the .note.ABI-tag section.
+ * - Compile the .s file to an object file.
+ *
+ * These steps are done in the invididual Makefiles for each applicable arch.
*/
static const struct {
int32_t namesz;
OpenPOWER on IntegriCloud