libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: state of MSVC patches for HEAD


From: Peter Ekberg
Subject: RE: state of MSVC patches for HEAD
Date: Tue, 30 Aug 2005 14:46:34 +0200

Ralf Wildenhues wrote:
> Hi Peter,
> 
> * Peter Ekberg wrote on Tue, Aug 30, 2005 at 12:43:16PM CEST:
> > 
> > CRAP! After fixing some problems with this patch (it doesn't work
> > for a number of reasons, so don't waste your time trying) I have
> > realized that sed is not the correct tool for this pipe. It is
> > best written in some other language. Which languages can I select
> > from? awk?
> 
> Before answering that:  I don't understand what exactly you are
> trying to achieve.
> 
> > More context than one row plus one hold buffer is needed to
> > determine if a symbol is global...
> > 
> > (Symbols marked SECTn in the above snippet should be mapped to the
> >  nth section line)
> 
> Can you describe the format a bit more precisely (pointer to docs?)?
> Then we might be able to come up with something that works better.
> 
> Can section lines be repeated?  Are section lines guaranteed to come
> before their contents (or can we do separate calls to only get at
> one or the other output?)
> 
> awk is a possible candidate, but please try to stay within POSIX
> features.

There is *little* documentation that I have found which is helpful.

Here is some:
http://msdn.microsoft.com/library/en-us/vccore/html/_dumpbin_.2f.symbols
.asp

I look at the output and then try to make educated guesses,
which has not been 100% successful. I think I'm closing in
on the target though.

An example:
------------8<-------------
Microsoft (R) COFF/PE Dumper Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file foo1.obj

File Type: COFF OBJECT

COFF SYMBOL TABLE
000 00000000 DEBUG  notype       Filename     | .file
    c:/cygwin/home/peda/libtool/head-msvc/libtool/tests/mdemo/foo1.c
005 005F0C05 ABS    notype       Static       | @comp.id
006 00000001 ABS    notype       Static       | @feat.00
007 00000000 SECT1  notype       Static       | .drectve
    Section length   2A, #relocs    0, #linenums    0, checksum        0
009 00000000 SECT2  notype       Static       | .debug$S
    Section length   92, #relocs    0, #linenums    0, checksum        0
00B 00000000 SECT3  notype       Static       | .data
    Section length   28, #relocs    0, #linenums    0, checksum DBF01B20
00D 00000010 SECT3  notype       Static       | $SG913
00E 00000000 SECT3  notype       Static       | $SG910
00F 00000004 UNDEF  notype       External     | _foo1_LTX_nothing
010 00000000 SECT4  notype       Static       | .text
    Section length   57, #relocs    8, #linenums    0, checksum C722AC18
012 00000000 SECT4  notype ()    External     | __foo1_helper
013 00000000 UNDEF  notype ()    External     | _sub
014 00000010 SECT4  notype ()    External     | _foo1_LTX_foo1
015 00000000 UNDEF  notype ()    External     | _printf
016 00000000 UNDEF  notype ()    External     | _cos
017 00000000 SECT5  notype       Static       | .rdata
    Section length    8, #relocs    0, #linenums    0, checksum
0, selection    2 (pick any)
019 00000000 SECT5  notype       External     | address@hidden
01A 00000000 UNDEF  notype ()    External     | __fltused
01B 00000040 SECT4  notype ()    External     | _foo1_LTX_hello

String Table Size = 0x65 bytes

  Summary

          28 .data
          92 .debug$S
          2A .drectve
           8 .rdata
          57 .text
------------8<-------------

In the above there are five section lines, and SECT5 is the
Highest SECTn there is. This is documented in the above URL.

The following are my educated guesses:

Section lines are never repeated.

Immediately before the nth section line, a "section symbol"
appears which is the first reference with SECTn. This symbol
appears to be the section name, so may contain info as
to what kind of segment it is. I mean .drectve, .debug$S,
.data, .text and .rdata are probably pretty standard names.
To me, the last three look familiar, but using the section
name to deduce section type seems fragile, so I'd go for
the "(pick any)" string in the section line following the
first "section symbol" of the new section instead.

So, I think what's needed is to keep track of if which
sections are marked "(pick any)", and ignore any symbols
from those sections.

This will be cumbersome to do with sed as symbols from e.g.
the 4th section may appear after the 5th section header
(see _foo1_LTX_hello, which should be exported), so it is
best to keep track of all previous sections.

I think awk will be a good tool to solve this, but awk is
another tool which I will need to read up on...

Cheers,
Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]