Hiding global symbols declared in assembly files

115 views
Skip to first unread message

Andrew Scherkus

unread,
Aug 18, 2011, 12:42:33 AM8/18/11
to Chromium-dev
While attempting to link libvpx.a directly instead of loading it via libffmpegsumo.so, src/chrome/tools/build/mac/verify_order alerted me that additional symbols were being exported.

A quick scan reveals the global symbols declared inside of libvpx .asm files are now getting exported by Chrome.

Typically, -fvisibility=hidden takes care of this for us but it appears that yasm has no such global option but rather an ELF-specific option you can tack on to a global symbol [1].

FFmpeg actually uses said option via its cglobal() macro [2] but libvpx's sym() macro does no such thing [3]. Even if we were to patch libvpx it wouldn't solve the issue for mac's machoness.

I had something really hacky that uses objcopy to hide the offending symbols on a resulting binary, but that feels pretty dirty.

Andrew

Hironori Bono (坊野 博典)

unread,
Aug 18, 2011, 3:22:47 AM8/18/11
to sche...@chromium.org, Chromium-dev
Greetings Andrew,

Our local copy of yasm has a local patch that allows us to set
private_extern bits of a Mach-O object, which is the same option as
the hidden option of ELF. (This change is r73761
<http://crrev.com/73761>.) Therefore, even though this works only on
Chromium, we can create hidden symbols if we add private_extern flags
to them as my 73971 <http://crrev.com/73971> did for libjpeg-turbo.
(Even though I have filed a bug to yasm
<http://www.tortall.net/projects/yasm/ticket/236> and sent my patch, I
cannot receive any responses.)

Regards,

Hironori Bono
E-mail: hb...@google.com

> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
>

Andrew Scherkus

unread,
Aug 19, 2011, 12:00:29 AM8/19/11
to Hironori Bono (坊野 博典), Chromium-dev
Hironori! You're a life saver!

Much cleaner than anything I was planning on doing with objcopy haha

Shame that your yasm patch hasn't gained any traction :\

Andrew
Reply all
Reply to author
Forward
0 new messages