On Fri, Nov 13, 2020, 13:11 Timm Bäder <tbae...@redhat.com> wrote:

> On 12/11/2020 17:52, Navin P wrote:
> > Hi,
> >   I already have a patch that makes elfutils compile with clang. Since
> > you are working
> > this will be of use to you. I've attached the patch since it is big.
> >
> >   Here are some of the changes
> >   1. All functions at file scope have static qualifier so that no
> > collison with other files.
> >   2. Non global variables declared in the outer function should be
> > passed as pointer variable
> >      in the new outer file scope function whenever they are assigned in
> > the nested  function. The
> >      argument  addition in new functions are at the end.
> >
> > 3.  With the applied patch above , gcc passes all 220 tests where
> > clang fails 3 tests which
> >     is due to llvm_addrsig (change in libelf/elf.h ) and other 2 tests
> > are error related to
> > .rela.eh_frame.
>
> Thanks, Navin. Has this been proposed for inclusion in elfutils? What's
> the status on that? Or are you just keeping this locally?
>
> Locally.  It is not proposed for inclusion in elfutils but you can  fix
few things or compare/modify and include it.


> Looking at the patch, I'm not really a fan of a few of those changes,
> from a code point of view. consider_phdr() takes 35 arguments now
> for example.
>
 You have few options like collect them in a struct and pass a pointer to
struct with
those members as fields.
Create static global variables but it is bound to collision within same
file.
 Macros are not a good idea because if you have return in a nested func
it returns to the outer func ,where as in  macro it returns from the outer
func.

Once you have all the tests passing , you can refactor it. or you can fix
it and
make the tests pass.

>
> Do you have more information on the test failures? Are they caused by
> LLVM/clang bugs?
>
Well i don't think they are compiler bugs but rather extra output from
utilities
is causing the diff to fail like elflint size.o  . I think we are good from
that
perspective unless i missed something .

With patch applied gcc passes all tests, clang fails 3 out of 220.

>
>
>
> Thanks,
> Timm
>
>

Reply via email to