----- Original Message -----
> From: [email protected]
> To: "Jan Stancek" <[email protected]>
> Cc: [email protected]
> Sent: Wednesday, 20 August, 2014 4:32:52 PM
> Subject: Re: [LTP] [PATCH/RFC] profil01: don't use address of function
>
> Hi!
> > This testcase is failing on ppc64 BE system, because
> > address of &test_profil does not reference beginning of code,
> > but entry in .opd section:
> > "This section contains the official procedure descriptors.
> > A pointer to a function shall reference a procedure descriptor
> > in this section."
> > which was at address larger than all .text of test_profil.
> >
> > This patch is replacing address of function approach with gcc's
> > __builtin_return_address() to get current pc value.
>
> How is it with compatibility? In which gcc version was this building
> introduced?
> Does it work with clang?
I think it was introduced in 90s, though not every architecture supported
it at first.
I see it in very first release of clang 1.0 sources:
./src/gcc/builtins.def:DEF_GCC_BUILTIN
(BUILT_IN_RETURN_ADDRESS, "return_address", BT_FN_PTR_UNSIGNED,
ATTR_NULL)
but I didn't try to compile it with that.
>
> If we are in doubt, we should add a configure check and use it only when
> available. And probably to default to &test_profil in all cases but
> ppc64 BE which is known to fail.
I'm trying one other idea:
+static inline void *get_pc(void)
+{
+ extern void *profil01_label;
+
+ asm("profil01_label:");
+ return &profil01_label;
+}
Regards,
Jan
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list