This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: rs6000.c tests TREE_ASM_WRITTEN too early.


----- Original Message -----
From: "Richard Henderson" <rth@redhat.com>
Sent: Thursday, December 28, 2000 7:32 PM


> On Thu, Dec 28, 2000 at 01:42:43PM -0500, David Edelsohn wrote:
> > +    We also record that the function exists in the current
compilation
> > +    unit, reachable by short branch, by setting SYMBOL_REF_FLAG.
> [...]
> > +     if (!DECL_WEAK (DECL)) \
> > +       SYMBOL_REF_FLAG (sym_ref) = 1; \
>
> At least for sysv4 you probably also need to be checking flag_pic,
> since a non-static function in a shared library can still be
> overridden.  I don't know if the semantics of AIX shared libraries
> differ.

     Hi Richard,

  Since David wants to take care of the V3 details of this fix, and since
it's only a code quality improvement rather than a bugfix which means that
it's not in the running for 2.95.3, I don't really need to ask you these
questions, but I like to *understand* things, so I will:

1)  Are you informing me here that if the shared lib contains

void foo(void) { ... }
void bar(void) { ....; foo(); ... }

and there's a function foo() in the application that links with the lib,
the call to foo() in bar() will be pointer by the linker at the foo() in
the app, not the foo() in the lib? And is this in any way different from a
weak declaration? Should we just make a new predicate
DECL_WEAK_OR_OVERRIDEABLE ? Or should globally visible symbols in sysv4
shared libraries be declared weak by default ?

2)  Can I infer from your suggestion above that flag_pic is only ever set
when building a shared library? IOW, it's not legitimate to use it just
because you want code that can be stored in a flat .bin format without
reloc info?

     cheers,
            DaveK



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]