Re: Change symbol visibility in library (local -> external)

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

 



Jeffrey Walton <noloader@xxxxxxxxx> writes:

> I'm working on a project which uses automake and friends. 'make check'
> builds the test files and executes the test programs.
>
> I'd like to write some tests targeted at the private functions. From
> nm(1), I know the symbols of interest are present in the text section,
> but they are local.
>
> Adding a configure switch might fly, but I don't know automake well.
> Changing the source files ((ie, static -> non-static)) will probably
> be denied.
>
> Other binutils tools, such as objdump and readelf looked like a dead end.
>
> Is there a way change visibility?

You can use objcopy to turn an externally visible symbol into a local
symbol, but as far as I know there is no way to turn a local symbol into
an externally visible symbol.  It would probably be possible to modify
objcopy to add such an option.  Note that in certain cases it would not
work correctly; for example, gcc will sometimes use a different calling
convention when calling a local symbol, and thus making it globally
visible will give you a function which can not be called correctly from
outside the file.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux