https://sourceware.org/bugzilla/show_bug.cgi?id=17590

            Bug ID: 17590
           Summary: Order of multiple defsym commands irrelevant
           Product: binutils
           Version: 2.24
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: climberking2000 at gmail dot com

Hey all,

So I may be misunderstanding something basic about linking, if it sounds like
I'm asking something crazy I probably am.

I'm trying to redefine some symbols using defsym in an attempt to emulate
wrapping in a context where -wrap doesn't work. I have symbols (representing
functions) one, two, and three.

I want one to get the value of two, where two will call one.. To do this, I set
one to two, have two call three, and have three overridden by the original
address of one.

In gcc world, this leaves me with

g++ symboltest.o -Wl,-defsym=_three=_one -Wl,-defsym=_one=_two

But this results in all three symbols having the same value. I tested for
whether perhaps things were done backwards and reversed the defsyms, only to
get the same result. Why does this happen?

Note that I'm in a situation where I *can't* require shared linking and
LD_PRELOAD as I would prefer to, nor can I modify the code such that symbols
will be unresolved and thus copacetic for use with wrap. I am game for writing
linker scripts if it becomes necessary, but would prefer to handle this with
command line flags.

Thanks,

David

-- 
You are receiving this mail because:
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to