Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 831472 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/Makefile (-5 / +2 lines)
Lines 4-10 include $(TOPDIR)/src/include/deprecated.mk Link Here
4
include $(TOPDIR)/src/include/version.mk
4
include $(TOPDIR)/src/include/version.mk
5
include $(TOPDIR)/src/include/rules.mk
5
include $(TOPDIR)/src/include/rules.mk
6
include $(TOPDIR)/src/include/defaults.mk
6
include $(TOPDIR)/src/include/defaults.mk
7
include $(TOPDIR)/src/include/workarounds.mk
8
7
9
LIBTARGETS=libefivar.so libefiboot.so libefisec.so
8
LIBTARGETS=libefivar.so libefiboot.so libefisec.so
10
STATICLIBTARGETS=libefivar.a libefiboot.a libefisec.a
9
STATICLIBTARGETS=libefivar.a libefiboot.a libefisec.a
Lines 30-36 EFISECDB_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFISECDB_SOURCES))) Link Here
30
GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c
29
GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c
31
MAKEGUIDS_SOURCES = makeguids.c util-makeguids.c
30
MAKEGUIDS_SOURCES = makeguids.c util-makeguids.c
32
MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES)))
31
MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES)))
33
MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES) guids.lds
32
MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES)
34
33
35
util-makeguids.c : util.c
34
util-makeguids.c : util.c
36
	cp util.c util-makeguids.c
35
	cp util.c util-makeguids.c
Lines 84-90 $(MAKEGUIDS_OUTPUT) : guids.txt Link Here
84
	if [ "$${missing}" != "no" ]; then \
83
	if [ "$${missing}" != "no" ]; then \
85
		exit 1 ; \
84
		exit 1 ; \
86
	fi
85
	fi
87
	./makeguids $(LD_DASH_T) guids.txt guid-symbols.c include/efivar/efivar-guids.h guids.lds
86
	./makeguids guids.txt guid-symbols.c include/efivar/efivar-guids.h
88
87
89
prep : makeguids $(GENERATED_SOURCES)
88
prep : makeguids $(GENERATED_SOURCES)
90
89
Lines 96-102 libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS)) Link Here
96
libefivar.so : $(LIBEFIVAR_OBJECTS)
95
libefivar.so : $(LIBEFIVAR_OBJECTS)
97
libefivar.so : | $(GENERATED_SOURCES) libefivar.map
96
libefivar.so : | $(GENERATED_SOURCES) libefivar.map
98
libefivar.so : LIBS=dl
97
libefivar.so : LIBS=dl
99
libefivar.so : LDSCRIPTS=guids.lds
100
libefivar.so : MAP=libefivar.map
98
libefivar.so : MAP=libefivar.map
101
99
102
efivar : $(EFIVAR_OBJECTS) | libefivar.so
100
efivar : $(EFIVAR_OBJECTS) | libefivar.so
Lines 137-143 deps : $(ALL_SOURCES) Link Here
137
clean : 
135
clean : 
138
	@rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
136
	@rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
139
		makeguids guid-symbols.c include/efivar/efivar-guids.h \
137
		makeguids guid-symbols.c include/efivar/efivar-guids.h \
140
		guids.lds \
141
		$(TARGETS) $(STATICTARGETS)
138
		$(TARGETS) $(STATICTARGETS)
142
	@# remove the deps files we used to create, as well.
139
	@# remove the deps files we used to create, as well.
143
	@rm -rfv .*.P .*.h.P *.S.P include/efivar/.*.h.P
140
	@rm -rfv .*.P .*.h.P *.S.P include/efivar/.*.h.P
(-)a/src/include/rules.mk (-4 / +1 lines)
Lines 3-9 default : all Link Here
3
.PHONY: default all clean install test
3
.PHONY: default all clean install test
4
4
5
include $(TOPDIR)/src/include/version.mk
5
include $(TOPDIR)/src/include/version.mk
6
include $(TOPDIR)/src/include/workarounds.mk
7
6
8
comma:= ,
7
comma:= ,
9
empty:=
8
empty:=
Lines 36-44 family = $(foreach FAMILY_SUFFIX,$(FAMILY_SUFFIXES),$($(1)_$(FAMILY_SUFFIX))) Link Here
36
	$(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS)
35
	$(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS)
37
36
38
%.so :
37
%.so :
39
	$(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) \
38
	$(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) -o $@ $^ $(LDLIBS)
40
		$(foreach LDS,$(LDSCRIPTS),$(LD_DASH_T) $(LDS)) \
41
		-o $@ $^ $(LDLIBS)
42
	ln -vfs $@ $@.1
39
	ln -vfs $@ $@.1
43
40
44
%.abixml : %.so
41
%.abixml : %.so
(-)a/src/include/workarounds.mk (-24 lines)
Lines 1-24 Link Here
1
# SPDX-License-Identifier: SPDX-License-Identifier: LGPL-2.1-or-later
2
#
3
# workarounds.mk - workarounds for weird stuff behavior
4
5
LD_FLAVOR := $(shell LC_ALL=C $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g')
6
LD_VERSION := $(shell LC_ALL=C $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //')
7
# 2.35 is definitely broken and 2.36 seems to work
8
LD_DASH_T := $(shell \
9
	if [ "x${LD_FLAVOR}" = xLLD ] ; then \
10
		echo '-T' ; \
11
	elif [ "x${LD_FLAVOR}" = xGNU ] ; then \
12
		if echo "${LD_VERSION}" | grep -q -E '^2\.3[6789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \
13
			echo '-T' ; \
14
		else \
15
			echo "" ; \
16
		fi ; \
17
	else \
18
		echo "Your linker is not supported" ; \
19
		exit 1 ; \
20
	fi)
21
22
export LD_DASH_T
23
24
# vim:ft=make
(-)a/src/makeguids.c (-48 / +24 lines)
Lines 107-157 write_guidnames(FILE *out, const char *listname, Link Here
107
			gn->symbol, gn->name, gn->description);
107
			gn->symbol, gn->name, gn->description);
108
	}
108
	}
109
	fprintf(out, "};\n");
109
	fprintf(out, "};\n");
110
        fprintf(out, "const struct efivar_guidname\n"
111
			"\t__attribute__((__visibility__ (\"default\")))\n"
112
			"\t* const %s = %s_;\n", listname, listname);
113
        fprintf(out, "const struct efivar_guidname\n"
114
			"\t__attribute__((__visibility__ (\"default\")))\n"
115
                        "\t* const %s_end = %s_\n\t+ %zd;\n",
116
                        listname, listname, n - 1);
110
}
117
}
111
118
112
int
119
int
113
main(int argc, char *argv[])
120
main(int argc, char *argv[])
114
{
121
{
115
	int rc;
122
	int rc;
116
	int argstart = 0;
123
	FILE *symout, *header;
117
	FILE *symout, *header, *ldsout;
118
	int dash_t = 0;
119
124
120
	if (argc < 5) {
125
	if (argc < 4) {
121
		errx(1, "Not enough arguments.\n");
126
		errx(1, "Not enough arguments.\n");
122
	} else if (argc > 5 && !strcmp(argv[1],"-T")) {
127
	} else if (argc > 4) {
123
		argstart = 1;
124
		dash_t = 1;
125
	} else if (argc > 5) {
126
		errx(1, "Too many arguments.\n");
128
		errx(1, "Too many arguments.\n");
127
	}
129
	}
128
130
129
	symout = fopen(argv[argstart + 2], "w");
131
	symout = fopen(argv[2], "w");
130
	if (symout == NULL)
132
	if (symout == NULL)
131
		err(1, "could not open \"%s\"", argv[argstart + 2]);
133
		err(1, "could not open \"%s\"", argv[2]);
132
	rc = chmod(argv[argstart + 2], 0644);
134
	rc = chmod(argv[2], 0644);
133
	if (rc < 0)
135
	if (rc < 0)
134
		warn("chmod(%s, 0644)", argv[argstart + 2]);
136
		warn("chmod(%s, 0644)", argv[2]);
135
137
136
	header = fopen(argv[argstart + 3], "w");
138
	header = fopen(argv[3], "w");
137
	if (header == NULL)
139
	if (header == NULL)
138
		err(1, "could not open \"%s\"", argv[argstart + 3]);
140
		err(1, "could not open \"%s\"", argv[3]);
139
	rc = chmod(argv[argstart + 3], 0644);
141
	rc = chmod(argv[3], 0644);
140
	if (rc < 0)
141
		warn("chmod(%s, 0644)", argv[argstart + 3]);
142
143
	ldsout = fopen(argv[argstart + 4], "w");
144
	if (ldsout == NULL)
145
		err(1, "could not open \"%s\"", argv[argstart + 4]);
146
	rc = chmod(argv[argstart + 4], 0644);
147
	if (rc < 0)
142
	if (rc < 0)
148
		warn("chmod(%s, 0644)", argv[argstart + 4]);
143
		warn("chmod(%s, 0644)", argv[3]);
149
144
150
	struct guidname_index *guidnames = NULL;
145
	struct guidname_index *guidnames = NULL;
151
146
152
	rc = read_guids_at(AT_FDCWD, argv[argstart + 1], &guidnames);
147
	rc = read_guids_at(AT_FDCWD, argv[1], &guidnames);
153
	if (rc < 0)
148
	if (rc < 0)
154
		err(1, "could not read \"%s\"", argv[argstart + 1]);
149
		err(1, "could not read \"%s\"", argv[1]);
155
150
156
	struct efivar_guidname *outbuf;
151
	struct efivar_guidname *outbuf;
157
152
Lines 243-254 struct efivar_guidname {\n\ Link Here
243
	fprintf(header,
238
	fprintf(header,
244
		"extern const struct efivar_guidname\n"
239
		"extern const struct efivar_guidname\n"
245
			"\t__attribute__((__visibility__ (\"default\")))\n"
240
			"\t__attribute__((__visibility__ (\"default\")))\n"
246
			"\tefi_well_known_guids[%d];\n",
241
			"\t* const efi_well_known_guids;\n");
247
		i);
248
	fprintf(header,
242
	fprintf(header,
249
		"extern const struct efivar_guidname\n"
243
		"extern const struct efivar_guidname\n"
250
			"\t__attribute__((__visibility__ (\"default\")))\n"
244
			"\t__attribute__((__visibility__ (\"default\")))\n"
251
			"\tefi_well_known_guids_end;\n");
245
			"\t* const efi_well_known_guids_end;\n");
252
	fprintf(header,
246
	fprintf(header,
253
		"extern const uint64_t\n"
247
		"extern const uint64_t\n"
254
			"\t__attribute__((__visibility__ (\"default\")))\n"
248
			"\t__attribute__((__visibility__ (\"default\")))\n"
Lines 256-267 struct efivar_guidname {\n\ Link Here
256
	fprintf(header,
250
	fprintf(header,
257
		"extern const struct efivar_guidname\n"
251
		"extern const struct efivar_guidname\n"
258
			"\t__attribute__((__visibility__ (\"default\")))\n"
252
			"\t__attribute__((__visibility__ (\"default\")))\n"
259
			"\tefi_well_known_names[%d];\n",
253
			"\t* const efi_well_known_names;\n");
260
		i);
261
	fprintf(header,
254
	fprintf(header,
262
		"extern const struct efivar_guidname\n"
255
		"extern const struct efivar_guidname\n"
263
			"\t__attribute__((__visibility__ (\"default\")))\n"
256
			"\t__attribute__((__visibility__ (\"default\")))\n"
264
			"\tefi_well_known_names_end;\n");
257
			"\t* const efi_well_known_names_end;\n");
265
	fprintf(header,
258
	fprintf(header,
266
		"extern const uint64_t\n"
259
		"extern const uint64_t\n"
267
			"\t__attribute__((__visibility__ (\"default\")))\n"
260
			"\t__attribute__((__visibility__ (\"default\")))\n"
Lines 310-332 struct efivar_guidname {\n\ Link Here
310
303
311
	fclose(symout);
304
	fclose(symout);
312
305
313
	fprintf(ldsout,
314
		"SECTIONS\n"
315
		"{\n"
316
		"  .data :\n"
317
		"  {\n"
318
		"    efi_well_known_guids = efi_well_known_guids_;\n"
319
		"    efi_well_known_guids_end = efi_well_known_guids_ + %zd;\n"
320
		"    efi_well_known_names = efi_well_known_names_;\n"
321
		"    efi_well_known_names_end = efi_well_known_names_ + %zd;\n"
322
		"  }\n"
323
		"}%s;\n",
324
		(line - 1) * sizeof(struct efivar_guidname),
325
		(line - 1) * sizeof(struct efivar_guidname),
326
		dash_t ? " INSERT AFTER .data" : "");
327
328
	fclose(ldsout);
329
330
	free(guidnames->strtab);
306
	free(guidnames->strtab);
331
	free(guidnames);
307
	free(guidnames);
332
308

Return to bug 831472