AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  AIX ld problems

    Posted Sat December 02, 2006 02:35 PM

    Originally posted by: SystemAdmin


    There doesn't seem to be much action over in AIX for Developers, so I thought I would post my question here.

    The AIX ld docs state that .csects with the same name and attributes will get combined across objects into a single section in the image. This isn't happening and I need help understanding why not.

    --Doug
    #AIX-Forum


  • 2.  Re: AIX ld problems

    Posted Mon December 04, 2006 07:54 AM

    Originally posted by: SystemAdmin


    Doug: perhaps you could describe what you think the linker should be doing (and what it is doing) in more detail for us. What do you mean by "combine" in this context? It seems to me that a linker can be expected to know only so much logically about the contents of objects it works with. If your input has 2 control sections with the same name containing different executable code how should these be combined? What would the external symbol naming the csect resolve to in the output, the first entry point or the second one? I'm thinking by analogy to a former life as a mainframer here but the principles are the same, I'm sure.

    Regards,
    Jim Lane
    #AIX-Forum


  • 3.  Re: AIX ld problems

    Posted Mon December 04, 2006 12:30 PM

    Originally posted by: SystemAdmin


    I have a set of csects with predefined names in each object that contain data needed by a software tool. I want the csect named .foo_bars in object foo2.o to be appended onto the end of the csect named .foo_bars in object foo1.o and the csect names .foo_bums in foo2.o to be appended onto the end of .foo_bums in foo1.o. I don't really care about the appending order (link order is fine), as long as all the .foo_bars data is consecutive and the .foo_bums data is consecutive. My software tool will then reference each data block by the unique section symbol.

    What AIX ld is doing is interspersing the csects so the final data block contains something like bars bums bars bums which seems contrary to what the ld doc says it should do.

    FWIW, this is what ld does, or can be made to do, on every Unix, VMS, and Windows system that I've worked with and I'm hoping it's possible to make it work on AIX.

    --Doug
    #AIX-Forum


  • 4.  Re: AIX ld problems

    Posted Tue December 05, 2006 07:28 AM

    Originally posted by: SystemAdmin


    Doug: by default the AIX linker tries to "help" you by rearranging the order of objects in the output so as to optimize locality of reference. You can turn this off with the option "noobjreorder". I've never used this so I'm not sure what happens but you might want to give it a try.

    Regards,

    Jim Lane
    #AIX-Forum


  • 5.  Re: AIX ld problems

    Posted Wed December 06, 2006 02:43 AM

    Originally posted by: SystemAdmin


    noobjreorder made no difference. :-(

    It's completely amazing to me that AIX ld doesn't combine sections, instead leaving them scattered willy nilly throughout the executable file. It has so many cool features like RTL and GC, but then doesn't allow any fine control over section layout.

    --Doug
    #AIX-Forum