Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Jul 2013 14:05:07 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: Re: [PATCH 2/3] Unwind support for ARM EABI

On Wed, Jul 10, 2013 at 08:35:18PM +0300, Timo Teras wrote:
> > diff --git a/arch/arm/src/find_exidx.c b/arch/arm/src/find_exidx.c
> > new file mode 100644
> > index 0000000..ffbea1f
> > --- /dev/null
> > +++ b/arch/arm/src/find_exidx.c
> > @@ -0,0 +1,44 @@
> > +#define _GNU_SOURCE
> > +#include <link.h>
> > +
> > +typedef unsigned _Unwind_Ptr;
> 
> As noted on #musl, this has  __attribute__((pointer)) in the original
> definition. But trying to avoid the #include <unwind.h> on GCC's
> headers, and the GCCisms. 
> 
> Would uintptr_t be more suitable here then?

Yes. unsigned "works" but only because this code is ARM-specific and
ARM is 32-bit.

> > +struct find_exidx_data {
> > +	_Unwind_Ptr pc, exidx_start;
> > +	int exidx_len;
> > +};
> > +
> > +static int find_exidx(struct dl_phdr_info *info, size_t size, void
> > *ptr) +{
> > +	struct find_exidx_data *data = ptr;
> > +	const ElfW(Phdr) *phdr = info->dlpi_phdr;
> > +	_Unwind_Ptr addr;
> > +	int match = 0, i;
> > +
> > +	for (i = info->dlpi_phnum; i > 0; i--, phdr++) {
> > +		addr = info->dlpi_addr + phdr->p_vaddr;
> > +		switch (phdr->p_type) {
> > +		case PT_LOAD:
> > +			match |= data->pc >= addr && data->pc < addr
> > + phdr->p_memsz;
> > +			break;
> > +		case PT_ARM_EXIDX:
> > +			data->exidx_start = addr;
> > +			data->exidx_len = phdr->p_memsz;
> > +			break;
> > +		}
> > +	}
> > +	return match;
> > +}
> 
> The above function has a slight bug in it, so I'll fix that for next
> send. Basically it can return other dso's exidx data if the matching
> dso did not have PT_ARM_EXIDX at all.

OK, I'll wait for your next version of this patch.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.