On Mon, 2007-01-22 at 16:20 -0800, Nishanth Aravamudan wrote:
> On 22.01.2007 [17:08:34 -0600], Adam Litke wrote:
> > The current extracopysize detection algorithm does not include weak
> > objects in the copy window. These are symbols marked with 'W' and 'V'
> > in nm output. These can in fact be initialized global variables (just
> > like STB_GLOBAL symbols) and should be included in the extracopy window.
> >
> > The following patch adds STB_WEAK symbols to the extracopy window.
> > Since the if statement is getting a bit large and out of hand, move the
> > logic out of the function and into its own macro "keep_symbol".
> >
> > This patch resolves an eon (speccpu2000 benchmark) failure.
> >
> > Signed-off-by: Adam Litke <[EMAIL PROTECTED]>
> >
> > diff --git a/elflink.c b/elflink.c
> > index 6b260c9..9556dad 100644
> > --- a/elflink.c
> > +++ b/elflink.c
> > @@ -464,6 +464,23 @@ static int find_numsyms(Elf_Sym *symtab,
> > return ((void *)strtab - (void *)symtab) / sizeof(Elf_Sym);
> > }
> >
> > +/*
> > + * To reduce the size of the extra copy window, we can eliminate certain
> > + * symbols based on information in the dynamic section. The following
> > + * characteristics apply to symbols which may require copying:
> > + * - Within the BSS
> > + * - Global or Weak binding
> > + * - Object type (variable)
> > + * - Non-zero size (zero size means the symbol is just a marker with no
> > data)
> > + */
> > +#define keep_symbol(s) \
> > + ((((void *)s->st_value >= start_orig) && \
> > + ((void *)s->st_value <= end_orig)) && \
> > + ((ELF_ST_BIND(s->st_info) == STB_GLOBAL) || \
> > + (ELF_ST_BIND(s->st_info) == STB_WEAK)) && \
> > + (ELF_ST_TYPE(sym->st_info) == STT_OBJECT) && \
>
> typo --^ ? Shouldn't that be s->st_info, not sym->st_info?
Oops! That's what I get for trying to hustle this out the door right at
the end of the day.
> > + (s->st_size > 0))
>
> You really should encapsulate every use of "s" with parentheses too, or
> make it explicit that it can't be of a particular type (this is a common
> problem in the kernel, for instance).
>
> Would this be cleaner as a static inline function (would have also
> caught the typo above)? That way, we also get type checking (admittedly
> only one invocation and there probably won't be any more, but in case we
> need to make this statement longer anytime in the future I'd rather it
> were made a function now).
>
> Something like
>
> static inline int keep_symbol(Elf_Sym *s)
> {
> if (((void *)s->st_value >= start_orig) &&
> ((void *)s->st_value <= end_orig) &&
> ((ELF_ST_BIND(s->st_info) == STB_GLOBAL) ||
> (ELF_ST_BIND(s->st_info) == STB_WEAK)) &&
> (ELF_ST_TYPE(s->st_info) == STT_OBJECT) &&
> (s->st_size > 0)) {
> return 1;
> else
> return 0;
> }
Sure. I am fine with that too. Want to handle it directly or shall I
spin another patch?
--
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel