Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 May 2013 23:30:20 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Yuri <yuri@rawbw.com>
Cc:        FreeBSD Hackers <hackers@freebsd.org>
Subject:   Re: What is the correct way to declare assembler global variable ?
Message-ID:  <20130503203020.GR3047@kib.kiev.ua>
In-Reply-To: <518419B5.4000602@rawbw.com>
References:  <518419B5.4000602@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--P9SDCAjI7+EA+Yxm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, May 03, 2013 at 01:10:29PM -0700, Yuri wrote:
> I am trying to compile this code fragment into my program (taken from=20
> lib/libc/amd64/sys/sbrk.S):
> void my_func() {
>   ...
>    __asm__ __volatile__(
>        "movq .curbrk(%%rip), %%rax;"
>        "lea  .curbrk(%%rip), %%rdx;"
>        "movq %%rax, %0;"
>        "movq %%rdx, %1;"
>        : "=3Dr" (my_curbrk),
>          "=3Dr" (my_curbrk_ptr)
>        :: "%rax", "%rdx");
>    ...
> }
>=20
> I get a warning:
> /usr/bin/ld: warning: type and size of dynamic symbol=20
> `.curbrk@@FBSDprivate_1.0' are not defined
>=20
> What is the correct way to declare .curbrk in in-place assembly?

Formal answer is for you to read about the .type directive in the GNU
as manual. Also, you need to read about either common symbols, or about
the .size directive.

But, note that you cannot access hidden libc symbols from the code which
links to libc (dynamically). You probably need to re-consider higher-level
approach to your issue.


--P9SDCAjI7+EA+Yxm
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iQIcBAEBAgAGBQJRhB5bAAoJEJDCuSvBvK1BoskQAIfFweH431RG4kmVPemM0LMS
XI4oi4lPok/0icWi0BP11a9JsWXnzeBgEBV1Hm2dXNyDEmOI7DMEmkuy7+7qPRph
0tD/Tcs6Atm6cEnsFB6eSc/b5aZWlNBYgYyFZdS8CTyrmKh7hVSxQkMFBzmtDgHW
MZxZj/wMelSy3b0t6DojpHPp39tFBc01jdZqeiEL+yNo4qRbR6uZumy3AiSbmPAS
m4am1NV+E27AQDa5yPdog0pjm0NRBC0SYbs5nm/lm3v7s5q48ogcnoPn34JwDtaX
E5yMCf9/I+R5PdCbkaIrpUokXPt3EUNfrv33SUSeq9SBaVLy4lEjuoGqq8JZe17V
WHXtHr33NL8KMzvotNefE965RM8UTN57BAOrrCfOsdVj7uTUlvI7Zzkmzk+FQrdM
p3dPRu/RPhn+JuC7pzH3PZyqjev9q/C8Wnsftxudh5d77GN8kfhY3zO/E3aO29CN
fct6PdBeGXcfUrOEHTZOj2aF9RVYcOm6BzoXMMo9naWOHrLPFMlfuxNKxTFBPR02
V3/mIqrgeHeXEjvCjzmVnHcJWJuZwUkr+Br/NoAvnznUm7ooo8vyiY92zkb61efp
CNhWpQmkDlKCgq5olkQzxkDIUuumYoD87jvPHaPoSlv0T5Lz78HeYfGDzLprNr5J
rhP2ssX781Rm/r+C1n7P
=wGld
-----END PGP SIGNATURE-----

--P9SDCAjI7+EA+Yxm--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130503203020.GR3047>