http://sourceware.org/bugzilla/show_bug.cgi?id=12772

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2011-05-17 21:21:11 
UTC ---
Works for me:

[hjl@gnu-6 pr12772]$ cat x.cc
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

extern "C" int __attribute__((visibility("default"))) func(char *ptr)
{
    static const char g_const[] = { 1, 1, 0 };
    memcpy(ptr, g_const, 3);

    return 0;
}

extern "C" char *func2(char *ptr)
{
    static char buf[4096];
    if (!getcwd(buf, sizeof(buf)))
        buf[0] = 0;
#define STR "test_string"
    memcpy(ptr, STR, sizeof(STR));
    return buf;
}
[hjl@gnu-6 pr12772]$ make
g++  -c -fpic -O3 -fdata-sections -ffunction-sections
-fvisibility-inlines-hidden -fvisibility=hidden -o x.o x.cc
g++  -shared -Wl,-gc-sections -o x.so x.o
readelf -r x.so

Relocation section '.rela.dyn' at offset 0x3f0 contains 4 entries:
  Offset          Info           Type           Sym. Value    Sym. Name +
Addend
000000200640  000000000008 R_X86_64_RELATIVE                   
0000000000200640
0000002007f8  000200000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ +
0
000000200800  000300000006 R_X86_64_GLOB_DAT 0000000000000000
_Jv_RegisterClasses + 0
000000200808  000400000006 R_X86_64_GLOB_DAT 0000000000000000 __cxa_finalize +
0

Relocation section '.rela.plt' at offset 0x450 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name +
Addend
000000200828  000400000007 R_X86_64_JUMP_SLO 0000000000000000 __cxa_finalize +
0
[hjl@gnu-6 pr12772]$

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to