PR27725, better objcopy -p times

Simon Marchi simon.marchi@polymtl.ca
Fri Apr 16 01:07:40 GMT 2021


On 2021-04-15 8:16 p.m., Alan Modra wrote:
> On Thu, Apr 15, 2021 at 02:41:04PM -0400, Simon Marchi wrote:
>> On 2021-04-15 4:42 a.m., Alan Modra wrote:
>>> Nanosecond rather than second resolution.
>> Starting with this patch, I get:
>>
>> libtool: link: ccache gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I/home/simark/src/binutils-gdb/binutils/../zlib -g3 -O0 -fsanitize=address -fmax-errors=1 -fuse-ld=gold -fsanitize=address -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o  ../bfd/.libs/libbfd.a -L/home/simark/build/binutils-gdb/zlib -lz ../libiberty/libiberty.a -lfl -ldl
>> /home/simark/src/binutils-gdb/binutils/rename.c:169: error: undefined reference to 'get_stat_atime'
>> /home/simark/src/binutils-gdb/binutils/rename.c:170: error: undefined reference to 'get_stat_mtime'
> 
> ccache weirdness?  There are definition of those two functions a few
> lines above the references.

Hmm nope, I tried a build from scratch with ccache completely out of the
way, it still does it:

    $ readelf --syms rename.o | grep get_stat
       244: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND get_stat_atime
       245: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND get_stat_mtime

This fixes it though:

    diff --git a/binutils/rename.c b/binutils/rename.c
    index fe6019b26317..d63ab1681406 100644
    --- a/binutils/rename.c
    +++ b/binutils/rename.c
    @@ -129,7 +129,7 @@ get_stat_mtime_ns (struct stat const *st ATTRIBUTE_UNUSED)
     }

     /* Return *ST's access time.  */
    -inline struct timespec
    +static struct timespec
     get_stat_atime (struct stat const *st)
     {
     #ifdef STAT_TIMESPEC
    @@ -143,7 +143,7 @@ get_stat_atime (struct stat const *st)
     }

     /* Return *ST's data modification time.  */
    -inline struct timespec
    +static struct timespec
     get_stat_mtime (struct stat const *st)
     {
     #ifdef STAT_TIMESPEC

This is with gcc 10.2.0, btw.

Simon


More information about the Binutils mailing list