[openbeos] Re: How not to actively prevent a PPC version of your software and write better code at the same time

  • From: "Nathan Whitehorn" <nathan.whitehorn@xxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sat, 06 Apr 2002 13:21:58 EST (-0500)

> >> >I'm trying to compile various pieces of OBOS software for PPC. 
> > > > Here 
> >> > are 
> >> >some quick rules that both create better code and make my life a 
> > > > *
> >> > lot* 
> >> >easier.
> >> >
> >> >1. BEFORE you include your class interface file, do this:
> >> >class _EXPORT MyFooClass.
> >> 
> >> Ugghh. This is *so* ugly. Isn't this a Metrowerks thing? Does GCC 
> > > PPC 
> >> need this?
> >> 
> >> >2. Please put an _EXPORT before all exported global functions, 
> > > > like 
> >> >this:
> >> >_EXPORT status_t MyFooFunction() {
> >> >  DoSomeStuff();
> >> >}
> >> 
> >> Ditto.
> >
> >It may be ugly, but until we are building exclusively on the NewOS 
> >kernel, it is absolutely necessary. Sorry :(
> >-Nathan
> 
> So is it a Metrowerks thing?
> See - I am not sure that I want to ask developers to nastify up their 
> code like this.
> The other things that you pointed out are good style, and I can 100% 
> agree with.
> And having a second compiler like MW is great for that sort of thing.
> But changing the code with cruft like this is not, IMHO, a worthy 
> endeavor.
> I know that makes PPC hard/impossible. I 100% understand that. This 
> is, though, the sort
> of thing that I forsaw when I said that I didn't want to make PPC an 
> "official" piece, right now.
> We would have to buy into a little more legacy than I feel 
> comfortable with.

It's a non-ELF thing. ELF is the only binary format (AFAIK) that 
exports all symbols by default. I can turn on -export all in mwld, but 
then we get pages of warnings like this, which I would vastly prefer 
not to have, and can be detrimental to the app function in some cases.
-Nathan

### mwldppc Linker Warning :
#   Link Warning : ignored 'max_protohdr' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored 'protocols' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored 'domains' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored '__start' (descriptor) in _APP_
#   Previously defined in common/start_dyn.c
### mwldppc Linker Warning :
#   Link Warning : ignored '_term_routine_' (descriptor) in _APP_
#   Previously defined in common/init_term_dyn.c
### mwldppc Linker Warning :
#   Link Warning : ignored 'mbpool' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored 'longjmp' (descriptor) in _APP_
#   Previously defined in glue-noinit.a
### mwldppc Linker Warning :
#   Link Warning : ignored 'in_ifaddr' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored 'max_hdr' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored '_init_routine_' (descriptor) in _APP_
#   Previously defined in common/init_term_dyn.c
### mwldppc Linker Warning :
#   Link Warning : ignored '__destroy_global_chain' (descriptor) in 
_APP_
#   Previously defined in glue-noinit.a
### mwldppc Linker Warning :
#   Link Warning : ignored 'clpool' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored '__register_global_object' (descriptor) in 
_APP_
#   Previously defined in glue-noinit.a
### mwldppc Linker Warning :
#   Link Warning : ignored '__ptmf_null' (data) in _APP_
#   Previously defined in glue-noinit.a
### mwldppc Linker Warning :
#   Link Warning : ignored 'rt_tables' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored 'max_linkhdr' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored 'rtstat' (data) in _APP_
#   Previously defined in raw.c
### mwldppc Linker Warning :
#   Link Warning : ignored '__global_destructor_chain' (data) in _APP_
#   Previously defined in glue-noinit.a  


--
Fortune Cookie Says:

"I have made this letter longer than usual because I lack the time to
make it shorter."
                -- Blaise Pascal


Other related posts: