ObjFW  Diff

Differences From Artifact [50eac6751c]:

To Artifact [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;