libtool-patches
[Top][All Lists]
Advanced

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

[PATCH] msvc: handle symbols from different files independently.


From: Peter Rosin
Subject: [PATCH] msvc: handle symbols from different files independently.
Date: Thu, 30 Sep 2010 21:06:16 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2

Hi!

I tried libtool with MSVC 10 and found a bug.  When you feed two or more
objects or libraries to dumpbin for symbol extraction, the awk program
hides some sections, but those hidden sections carry over to future files
which is a problem.  The content of one object/library might hide content
from later objects/libraries.

Example output (from tagdemo-shared I think):

-------------------------------------------------------------
$ dumpbin -symbols  .libs/foo.obj   ./.libs/conv.lib
Microsoft (R) COFF/PE Dumper Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file .libs/foo.obj

File Type: COFF OBJECT

COFF SYMBOL TABLE
000 00AB766F ABS    notype       Static       | @comp.id
001 00000001 ABS    notype       Static       | @feat.00
002 00000000 SECT1  notype       Static       | .drectve
    Section length   8F, #relocs    0, #linenums    0, checksum        0
004 00000000 SECT2  notype       Static       | .debug$S
    Section length 44B4, #relocs   1C, #linenums    0, checksum        0
006 00000000 SECT3  notype       Static       | .rdata
    Section length    1, #relocs    0, #linenums    0, checksum        0, 
selection    2 (pick any)
008 00000000 SECT3  notype       External     | 
address@hidden@_N$0A@@address@hidden@@2_NB (public: static bool const 
std::tr1::integral_constant<bool,0>::value)
009 00000000 SECT4  notype       Static       | .rdata
    Section length    1, #relocs    0, #linenums    0, checksum 77073096, 
selection    2 (pick any)
00B 00000000 SECT4  notype       External     | 
address@hidden@address@hidden@std@@2_NB (public: static bool const 
std::tr1::integral_constant<bool,1>::value)

*snip lots of uninteresting crap*

12A 00000000 SECT5B notype       Static       | .text
    Section length   4B, #relocs    2, #linenums    0, checksum 22AE8362, 
selection    2 (pick any)
12C 00000000 SECT5C notype       Static       | .debug$S
    Section length  150, #relocs    B, #linenums    0, checksum        0, 
selection    5 (pick associative Section 0x5B)
12E 00000000 SECT5B notype ()    External     | 
address@hidden@address@hidden@std@@@std@@address@hidden (public: __thiscall 
std::basic_ostream<char,struct std::char_traits<char> 
>::_Sentry_base::~_Sentry_base(void))
12F 00000000 SECT5D notype       Static       | .debug$T
    Section length   5C, #relocs    0, #linenums    0, checksum        0

String Table Size = 0x15EF bytes


Dump of file ./.libs/conv.lib

File Type: LIBRARY

COFF SYMBOL TABLE
000 00AB766F ABS    notype       Static       | @comp.id
001 00000001 ABS    notype       Static       | @feat.00
002 00000000 SECT1  notype       Static       | .drectve
    Section length   2F, #relocs    0, #linenums    0, checksum        0
004 00000000 SECT2  notype       Static       | .debug$S
    Section length  70C, #relocs    5, #linenums    0, checksum        0
006 00000000 SECT3  notype       Static       | .text
    Section length    A, #relocs    0, #linenums    0, checksum BAFC81C1
008 00000000 SECT3  notype ()    External     | _convenience
009 00000000 SECT4  notype       Static       | .debug$T
    Section length   5C, #relocs    0, #linenums    0, checksum        0

String Table Size = 0x11 bytes

  Summary

        5B3C .debug$S
          B8 .debug$T
          BE .drectve
         129 .rdata
           C .sxdata
         613 .text
          6C .text$x
          B8 .xdata$x
-------------------------------------------------------------

In this example, these lines from foo.obj:

006 00000000 SECT3  notype       Static       | .rdata
    Section length    1, #relocs    0, #linenums    0, checksum        0, 
selection    2 (pick any)

will cause SECT3 to be hidden, and that will cause the _convenience
symbol from .libs/conv.lib to be ignored:

008 00000000 SECT3  notype ()    External     | _convenience

This patch resets all hidden sectors when moving to the next file
during symbol extraction.

I haven't actually tried but the output of "dumpbin -symbols" is
consistent with at least MSVC 6 (from 1998), so it seems pretty
safe to rely on "^COFF SYMBOL TABLE" as the file-change-trigger.

Ok to push when I have tested with various MSVC versions?

Cheers,
Peter



>From cd30a11c9702b6102fcdb62b67af4c226f87f300 Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Thu, 30 Sep 2010 15:06:31 +0200
Subject: [PATCH] msvc: handle symbols from different files independently.

* libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS)
<dumpbin, lt_cv_sys_global_symbol_pipe>: Make all sections
viable for symbol extraction again when the symbols from a new
file starts.  Fixes tests/tagdemo-make.test for MSVC 10.

Signed-off-by: Peter Rosin <address@hidden>
---
 ChangeLog             |    8 ++++++++
 libltdl/m4/libtool.m4 |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a7aa489..47f21c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-09-30  Peter Rosin  <address@hidden>
+
+       msvc: handle symbols from different files independently.
+       * libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS)
+       <dumpbin, lt_cv_sys_global_symbol_pipe>: Make all sections
+       viable for symbol extraction again when the symbols from a new
+       file starts.  Fixes tests/tagdemo-make.test for MSVC 10.
+
 2010-09-27  Peter Rosin  <address@hidden>
 
        tests: check if sys_lib_search_path_spec works on MSVC.
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index fd732d0..967dd38 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -3645,6 +3645,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-- 
1.7.1




reply via email to

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