public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* version scripts and default/C language mangling
@ 2010-07-06 20:03 Mike Frysinger
  2010-07-11 11:57 ` Ian Lance Taylor
  2010-12-09 20:56 ` [PATCH] bfd/ld: handle ABI prefixes in version scripts Mike Frysinger
  0 siblings, 2 replies; 20+ messages in thread
From: Mike Frysinger @ 2010-07-06 20:03 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1782 bytes --]

the current version script page does not define a default language:
	http://sourceware.org/binutils/docs/ld/VERSION.html
presumably it works with linker-visible symbols by default which means targets 
that have an ABI prefix (like the Blackfin port) wont usually match.

to speak in exact terms, if i compile the code on my x86_64 system:
	extern "C" int foo(void) {}
	extern "C" int var(void) {}
	int f(int x, double d) {}
i get an object with the linker visible symbols:
	foo
	bar
	_Z1fid

if i compile it with my Blackfin toolchain, i get:
	_foo
	_bar
	__Z1fid

using a version script of:
	{
		global:
			foo;
			extern "C" { bar; };
			extern "C++" { "f(int, double)"; };
		local: *;
	};

on x86_64, all the symbols will be GLOBAL.  on Blackfin, all will be LOCAL.  
i'm ok with "foo" being LOCAL, but it seems like the other two should be 
exported per the declared language.

at the moment, ldlang.c:lang_vers_match() doesnt do demangling for C symbols, 
and the cplus_demangle() doesnt account for the ABI prefix.  that is only 
declared via USER_LABEL_PREFIX in the emulparams subfolder, but it isnt 
exported to any C code that i can see.  not that we'd really want to since 
this is a bfd target specific issue.  any tips on how best to proceed here to 
fix things ?

also, i noticed the example script in the referenced URL above seems to have 
some errors in it.  it suggests:
	extern "C++" { "int f(int, double)"; }
but a C++ function like that doesnt encode the return type into the mangled 
name, so when the linker demangles things, it ends up with "f(int, double)" 
and so it never matches.  the example also lacks a trailing semicolon after 
the brace, so the linker complains about a syntax error in the file.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-02-14 17:11 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06 20:03 version scripts and default/C language mangling Mike Frysinger
2010-07-11 11:57 ` Ian Lance Taylor
2010-07-11 22:07   ` Mike Frysinger
2010-07-12  8:05     ` Ian Lance Taylor
2010-07-19 23:34       ` Mike Frysinger
2010-07-22  2:26         ` Alan Modra
2010-08-17 11:11         ` Will Newton
2010-08-17 12:42           ` Mike Frysinger
2010-12-09 20:56 ` [PATCH] bfd/ld: handle ABI prefixes in version scripts Mike Frysinger
2010-12-09 21:43   ` Joseph S. Myers
2010-12-10  3:52     ` Mike Frysinger
2010-12-10 10:45       ` Joseph S. Myers
2010-12-10 22:04         ` Mike Frysinger
2010-12-13 19:40           ` Mike Frysinger
2010-12-13 23:15             ` Joseph S. Myers
2010-12-14  0:44               ` Mike Frysinger
2011-01-14  0:33   ` Mike Frysinger
2011-02-14  5:19     ` Mike Frysinger
2011-02-14  6:07   ` Alan Modra
2011-02-14 17:11     ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).