Mark entrypointFunctions as used for clang+lto

LLVM currently ignores inline assembly references to symbols during
dead code and data elimination while linking with link-time optimizations
enabled.

This manifests in a very large amount of unresolved references to
entrypointFunctions when building libglvnd using clang with LTO enabled.

This issue fixes #220 by marking the entrypointFunctions array as used,
using a compiler attribute.

Signed-off-by: Charlotte Delenk <darkkirb@darkkirb.de>
This commit is contained in:
Charlotte Delenk 2021-09-19 16:28:54 +02:00
parent 34a0755168
commit 97db5662c1
No known key found for this signature in database
GPG key ID: 015E3768A70AFBC5

View file

@ -29,6 +29,7 @@
#include "glvnd_genentry.h"
#include "utils_misc.h"
#include "compiler.h"
#include <string.h>
#include <stdint.h>
@ -45,7 +46,7 @@
#define GLX_STUBS_COUNT
#include "g_glx_dispatch_stub_list.h"
static GLVNDentrypointStub entrypointFunctions[GENERATED_ENTRYPOINT_MAX];
USED static GLVNDentrypointStub entrypointFunctions[GENERATED_ENTRYPOINT_MAX];
static char *entrypointNames[GENERATED_ENTRYPOINT_MAX] = {};
static int entrypointCount = 0;