Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159473436
D47524.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D47524.diff
View Options
Index: contrib/elftoolchain/readelf/readelf.c
===================================================================
--- contrib/elftoolchain/readelf/readelf.c
+++ contrib/elftoolchain/readelf/readelf.c
@@ -47,6 +47,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <vis.h>
#include <zlib.h>
#include <libcasper.h>
@@ -371,6 +372,7 @@
static const char *mips_abi_fp(uint64_t fp);
static const char *note_type(const char *note_name, unsigned int et,
unsigned int nt);
+static const char *note_type_fdo(unsigned int nt);
static const char *note_type_freebsd(unsigned int nt);
static const char *note_type_freebsd_core(unsigned int nt);
static const char *note_type_go(unsigned int nt);
@@ -1151,6 +1153,8 @@
return note_type_freebsd_core(nt);
else
return note_type_freebsd(nt);
+ else if (strcmp(name, "FDO") == 0 && et != ET_CORE)
+ return note_type_fdo(nt);
else if (strcmp(name, "GNU") == 0 && et != ET_CORE)
return note_type_gnu(nt);
else if (strcmp(name, "Go") == 0 && et != ET_CORE)
@@ -1164,6 +1168,15 @@
return note_type_unknown(nt);
}
+static const char *
+note_type_fdo(unsigned int nt)
+{
+ switch (nt) {
+ case NT_FDO_PACKAGING_METADATA: return "NT_FDO_PACKAGING_METADATA";
+ default: return (note_type_unknown(nt));
+ }
+}
+
static const char *
note_type_freebsd(unsigned int nt)
{
@@ -3820,7 +3833,30 @@
}
ubuf = (const uint32_t *)(const void *)buf;
- if (strcmp(name, "FreeBSD") == 0) {
+ if (strcmp(name, "FDO") == 0) {
+ switch (type) {
+ case NT_FDO_PACKAGING_METADATA:
+ {
+ char *visbuf;
+
+ if (sz > SIZE_MAX / 4 - 1) {
+ warnx("invalid note data");
+ return;
+ }
+ /* Ignore trailing NULs. */
+ while (sz > 0 && buf[sz - 1] == '\0') {
+ sz--;
+ }
+ if ((visbuf = malloc(sz * 4 + 1)) == NULL) {
+ err(1, "malloc");
+ }
+ (void)strvisx(visbuf, buf, sz, VIS_CSTYLE);
+ printf(" Package metadata: %s\n", visbuf);
+ free(visbuf);
+ return;
+ }
+ }
+ } else if (strcmp(name, "FreeBSD") == 0) {
switch (type) {
case NT_FREEBSD_ABI_TAG:
if (sz != 4)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jun 15, 3:01 PM (15 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33970757
Default Alt Text
D47524.diff (2 KB)
Attached To
Mode
D47524: readelf: add support for ELF package metadata note
Attached
Detach File
Event Timeline
Log In to Comment