ObjFW  Check-in [029db9e275]

Overview
Comment:runtime/exception.m: Implement DW_EH_PE_aligned
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 029db9e275f8415b79e7f30948fb8ec8687fa35430b362b8f1426bbcf16671a6
User & Date: js on 2021-01-01 21:43:18
Other Links: manifest | tags
Context
2021-01-01
21:52
Restore -O2 on HP-UX check-in: 66da30b8a9 user: js tags: trunk
21:43
runtime/exception.m: Implement DW_EH_PE_aligned check-in: 029db9e275 user: js tags: trunk
18:49
Handle pthread attrs being unavailable check-in: e45e320379 user: js tags: trunk
Changes

Modified src/runtime/exception.m from [50eac6751c] to [02f7c2294e].

334
335
336
337
338
339
340
341
342








343
344
345
346
347
348
349
334
335
336
337
338
339
340


341
342
343
344
345
346
347
348
349
350
351
352
353
354
355







-
-
+
+
+
+
+
+
+
+







}

static uint64_t
readValue(uint8_t enc, const uint8_t **ptr)
{
	uint64_t value;

	if (enc == DW_EH_PE_aligned)
		OBJC_ERROR("DW_EH_PE_aligned is not implemented!");
	if (enc == DW_EH_PE_aligned) {
		const uintptr_t *aligned = (const uintptr_t *)
		    OF_ROUND_UP_POW2(sizeof(void *), (uintptr_t)*ptr);

		*ptr = (const uint8_t *)(aligned + 1);

		return *aligned;
	}

#define READ(type)					\
	{						\
		type tmp;				\
		memcpy(&tmp, *ptr, sizeof(type));	\
		value = tmp;				\
		*ptr += sizeForEncoding(enc);		\
378
379
380
381
382
383
384
385
386


387
388
389
390
391
392
393
384
385
386
387
388
389
390


391
392
393
394
395
396
397
398
399







-
-
+
+







	return value;
}

#ifndef HAVE_ARM_EHABI_EXCEPTIONS
static uint64_t
resolveValue(uint64_t value, uint8_t enc, const uint8_t *start, uint64_t base)
{
	if (value == 0)
		return 0;
	if (value == 0 || enc == DW_EH_PE_aligned)
		return value;

	value += ((enc & 0x70) == DW_EH_PE_pcrel ? (uintptr_t)start : base);

	if (enc & DW_EH_PE_indirect)
		value = *(uintptr_t *)(uintptr_t)value;

	return value;