aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2013-09-26 07:53:18 +0000
committerAndrew Turner <andrew@FreeBSD.org>2013-09-26 07:53:18 +0000
commit27b7672219e459d95f0904f994c355387758ac5b (patch)
tree6138d1411d6512a61bc5ec2dfd2cfe2dbf6944ba /lib
parente10b5a023e204666d6a09fc8fff7ca2014a31a05 (diff)
downloadsrc-27b7672219e459d95f0904f994c355387758ac5b.tar.gz
src-27b7672219e459d95f0904f994c355387758ac5b.zip
Add an elf note on ARM to store the MACHINE_ARCH an executable was built
for. This is useful for software needing to know which architecture a binary is built for as arm and armv6 have slight differences meaning only some binaries build for one will work as expected on the other. It is expected pkgng will be able to make use of this to simplify the logic to determine which package ABI to use. Approved by: re (kib)
Notes
Notes: svn path=/head/; revision=255874
Diffstat (limited to 'lib')
-rw-r--r--lib/csu/arm/crt1.c14
-rw-r--r--lib/csu/common/notes.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/csu/arm/crt1.c b/lib/csu/arm/crt1.c
index e3529b81dd05..d9f8a2d07a5b 100644
--- a/lib/csu/arm/crt1.c
+++ b/lib/csu/arm/crt1.c
@@ -115,6 +115,20 @@ __start(int argc, char **argv, char **env, struct ps_strings *ps_strings,
exit(main(argc, argv, env));
}
+static const struct {
+ int32_t namesz;
+ int32_t descsz;
+ int32_t type;
+ char name[sizeof(NOTE_FREEBSD_VENDOR)];
+ char desc[sizeof(MACHINE_ARCH)];
+} archtag __attribute__ ((section (NOTE_SECTION), aligned(4))) __used = {
+ .namesz = sizeof(NOTE_FREEBSD_VENDOR),
+ .descsz = sizeof(int32_t),
+ .type = ARCH_NOTETYPE,
+ .name = NOTE_FREEBSD_VENDOR,
+ .desc = MACHINE_ARCH
+};
+
#ifdef GCRT
__asm__(".text");
__asm__("eprol:");
diff --git a/lib/csu/common/notes.h b/lib/csu/common/notes.h
index fcc2b6684617..b2c53bf0351c 100644
--- a/lib/csu/common/notes.h
+++ b/lib/csu/common/notes.h
@@ -34,5 +34,6 @@
#define ABI_NOTETYPE 1
#define CRT_NOINIT_NOTETYPE 2
+#define ARCH_NOTETYPE 3
#endif