Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
efivar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
certo
efivar
Commits
886f8d10
Commit
886f8d10
authored
Sep 13, 2019
by
Vladimir Bashkirtsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed efivar for compilation with gcc9
parent
b97ce36a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
139 additions
and
0 deletions
+139
-0
Makefile
Makefile
+1
-0
efivar-37-gcc9_fix.patch
efivar-37-gcc9_fix.patch
+138
-0
No files found.
Makefile
View file @
886f8d10
all
:
tar
xf efivar-37.tar.bz2
patch
-Np1
-d
efivar-37 < efivar-37-gcc9_fix.patch
$(MAKE)
-C
efivar-37
libdir
=
/usr/lib
bindir
=
/usr/bin
mandir
=
/usr/share/man
includedir
=
/usr/include
$(MAKE)
-C
efivar-37
libdir
=
/usr/lib
bindir
=
/usr/bin
mandir
=
/usr/share/man
includedir
=
/usr/include
install
rm
-rf
efivar-37
efivar-37-gcc9_fix.patch
0 → 100644
View file @
886f8d10
diff -uNr efivar-37/src/dp.h efivar-37-gcc9_fix/src/dp.h
--- efivar-37/src/dp.h 2018-12-06 02:47:42.000000000 +1030
+++ efivar-37-gcc9_fix/src/dp.h 2019-09-13 13:28:14.062649345 +0930
@@ -70,7 +70,10 @@
#define format_guid(buf, size, off, dp_type, guid) ({ \
int _rc; \
char *_guidstr = NULL; \
+ efi_guid_t _guid; \
+ const efi_guid_t * const _guid_p = &_guid; \
\
+ memmove(&_guid, guid, sizeof(_guid)); \
_rc = efi_guid_to_str(guid, &_guidstr); \
if (_rc < 0) { \
efi_error("could not build %s GUID DP string", \
@@ -79,7 +82,7 @@
_guidstr = onstack(_guidstr, \
strlen(_guidstr)+1); \
_rc = format(buf, size, off, dp_type, "%s", \
- _guidstr); \
+ _guidstr); \
} \
_rc; \
})
diff -uNr efivar-37/src/dp-message.c efivar-37-gcc9_fix/src/dp-message.c
--- efivar-37/src/dp-message.c 2018-12-06 02:47:42.000000000 +1030
+++ efivar-37-gcc9_fix/src/dp-message.c 2019-09-13 13:23:33.458170960 +0930
@@ -620,11 +620,13 @@
) / sizeof(efi_ip_addr_t);
format(buf, size, off, "Dns", "Dns(");
for (int i=0; i < end; i++) {
- const efi_ip_addr_t *addr = &dp->dns.addrs[i];
+ efi_ip_addr_t addr;
+
+ memcpy(&addr, &dp->dns.addrs[i], sizeof(addr));
if (i != 0)
format(buf, size, off, "Dns", ",");
format_ip_addr(buf, size, off, "Dns",
- dp->dns.is_ipv6, addr);
+ dp->dns.is_ipv6, &addr);
}
format(buf, size, off, "Dns", ")");
break;
diff -uNr efivar-37/src/guid.c efivar-37-gcc9_fix/src/guid.c
--- efivar-37/src/guid.c 2018-12-06 02:47:42.000000000 +1030
+++ efivar-37-gcc9_fix/src/guid.c 2019-09-13 13:29:54.746765852 +0930
@@ -31,7 +31,7 @@
extern const efi_guid_t efi_guid_zero;
int NONNULL(1, 2) PUBLIC
-efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
+efi_guid_cmp(const void * const a, const void * const b)
{
return memcmp(a, b, sizeof (efi_guid_t));
}
diff -uNr efivar-37/src/include/efivar/efivar.h efivar-37-gcc9_fix/src/include/efivar/efivar.h
--- efivar-37/src/include/efivar/efivar.h 2018-12-06 02:47:42.000000000 +1030
+++ efivar-37-gcc9_fix/src/include/efivar/efivar.h 2019-09-13 13:31:06.306491220 +0930
@@ -128,7 +128,7 @@
extern int efi_guid_is_zero(const efi_guid_t *guid);
extern int efi_guid_is_empty(const efi_guid_t *guid);
-extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);
+extern int efi_guid_cmp(const void * const a, const void * const b);
/* import / export functions */
typedef struct efi_variable efi_variable_t;
diff -uNr efivar-37/src/ucs2.h efivar-37-gcc9_fix/src/ucs2.h
--- efivar-37/src/ucs2.h 2018-12-06 02:47:42.000000000 +1030
+++ efivar-37-gcc9_fix/src/ucs2.h 2019-09-13 13:37:59.004227023 +0930
@@ -23,16 +23,21 @@
(((val) & ((mask) << (shift))) >> (shift))
static inline size_t UNUSED
-ucs2len(const uint16_t * const s, ssize_t limit)
+ucs2len(const void *vs, ssize_t limit)
{
ssize_t i;
- for (i = 0; i < (limit >= 0 ? limit : i+1) && s[i] != (uint16_t)0; i++)
+ const uint16_t *s = vs;
+ const uint8_t *s8 = vs;
+
+ for (i = 0;
+ i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
+ i++, s8 += 2, s++)
;
return i;
}
static inline size_t UNUSED
-ucs2size(const uint16_t * const s, ssize_t limit)
+ucs2size(const void *s, ssize_t limit)
{
size_t rc = ucs2len(s, limit);
rc *= sizeof (uint16_t);
@@ -69,10 +74,11 @@
}
static inline unsigned char * UNUSED
-ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
+ucs2_to_utf8(const void * const voidchars, ssize_t limit)
{
ssize_t i, j;
unsigned char *ret;
+ const uint16_t * const chars = voidchars;
if (limit < 0)
limit = ucs2len(chars, -1);
@@ -124,10 +130,12 @@
}
static inline ssize_t UNUSED NONNULL(4)
-utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
+utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, uint8_t *utf8)
{
ssize_t req;
ssize_t i, j;
+ uint16_t *ucs2 = ucs2void;
+ uint16_t val16;
if (!ucs2 && size > 0) {
errno = EINVAL;
@@ -162,10 +170,13 @@
val = utf8[i] & 0x7f;
i += 1;
}
- ucs2[j] = val;
+ val16 = val;
+ ucs2[j] = val16;
+ }
+ if (terminate) {
+ val16 = 0;
+ ucs2[j++] = val16;
}
- if (terminate)
- ucs2[j++] = (uint16_t)0;
return j;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment