Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on gcc 12 and non-Fedora #73

Merged
merged 6 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"jobs": {
"linux": {
"runs-on": "ubuntu-latest",
"container": "vathpela/efi-ci:f35-x64",
"container": "vathpela/efi-ci:f36-x64",
"steps": [
{ "uses": "actions/checkout@v2" },
{ "run": "dnf -y install efivar-devel gcc" },
{ "run": "dnf -y update efivar-devel gcc" },
{ "run": "make" },
],
},
Expand Down
6 changes: 5 additions & 1 deletion Make.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ ARCH := $(shell uname -m | sed s,i[3456789]86,ia32,)

SOFLAGS ?= -shared
clang_cflags =
gcc_cflags = -Wmaybe-uninitialized -grecord-gcc-switches -fplugin=annobin \
gcc_cflags = -Wmaybe-uninitialized -grecord-gcc-switches \
$(call enabled,ENABLE_LEAK_CHECKER,$(call enabled,ENABLE_LEAK_CHECKER_LTO,-flto,),) \
$(DIAGFLAGS)
ifneq (,$(wildcard /usr/lib/gcc/x86_64-redhat-linux/*/plugin/annobin.so))
gcc_cflags += -fplugin=annobin
endif

cflags = $(CFLAGS) $(ARCH3264) \
-Wall -Wextra -Wsign-compare -Wno-unused-result \
-Wno-unused-function -Wno-missing-field-initializers \
Expand Down
2 changes: 1 addition & 1 deletion libdpe/pe_updatefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ __pe_updatemmap(Pe *pe, size_t shnum UNUSED)
char *msync_end = (char *)dd + sizeof(*dd);
msync(msync_start, msync_end - msync_start, MS_SYNC);

#warning this is not done yet.
/* TODO: this is not done yet. */
//struct section_header *sh = __get_last_section(pe);

size_t dd_size = sizeof (*dd) / sizeof (dd->exports);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
* compiler has support to do so.
*/
#define compiletime_assert(condition, msg) \
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__ - 1)
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)

/**
* BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied
Expand Down
5 changes: 5 additions & 0 deletions src/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,10 @@ do_shutdown(context *ctx, int nsockets, struct pollfd *pollfds)
free(pollfds);
}

/* GCC -fanalyzer has trouble with realloc
* https://bugzilla.redhat.com/show_bug.cgi?id=2047926 */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
static int
handle_events(context *ctx)
{
Expand Down Expand Up @@ -994,6 +998,7 @@ handle_events(context *ctx)
}
return 0;
}
#pragma GCC diagnostic pop

static int
get_uid_and_gid(context *ctx, char **homedir)
Expand Down
5 changes: 5 additions & 0 deletions src/password.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,16 @@ SECU_FilePasswd(PK11SlotInfo *slot, PRBool retry, void *arg)
int rc;
char c;

/* Workaround for -fanalzer/reallocarray() bug
* https://bugzilla.redhat.com/show_bug.cgi?id=2047926 */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-mismatching-deallocation"
new_phrases = reallocarray(phrases, nphrases + 1, sizeof(struct token_pass));
if (!new_phrases)
goto err_phrases;
phrases = new_phrases;
memset(&new_phrases[nphrases], 0, sizeof(struct token_pass));
#pragma GCC diagnostic pop

span = strspn(start, whitespace_and_eol_chars);
dprintf("whitespace span is %zd", span);
Expand Down
2 changes: 1 addition & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ read_file(int fd, char **bufp, size_t *lenptr) {
size += i;
if ((size + (page_size >> 2)) > alloced) {
alloced += page_size;
buf = realloc(buf, ALIGN_UP(alloced + 1, page_size));
buf = xrealloc(buf, ALIGN_UP(alloced + 1, page_size));
}
} while ((i = read(fd, buf + size, page_size >> 2)) > 0);

Expand Down