Reproduction sequence for fcntl64 bug.

Rob Landley rob at landley.net
Sun Apr 18 20:58:37 UTC 2010


On Sunday 18 April 2010 02:08:30 Rob Landley wrote:
> It's CONFIG_LFS.  If that's enabled, busybox builds with these flags:
>
> -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
>
> In the previous release, they were a NOP on 64 bit platforms.  Now they
> make fcntl into a nonexistent reference to fcntl64 and break the build.
>
> Rob

Simple standalone reproduction for the fcntl64 bug.  Create a "hello.c" 
containing:

  #include <unistd.h>
  #include <fcntl.h>
  #include <stdio.h>

  int main(int argc, char *argv[])
  {
    printf("%d\n", fcntl(0, F_GETFL));
    return 0;
  }

Then build it normally to make sure it works:

  $ x86_64-cc hello.c --static
  $ ./a.out
  32770

Then build it with -D_FILE_OFFSET_BITS=64:

  $ x86_64-cc hello.c --static -D_FILE_OFFSET_BITS=64
  /tmp/ccQNby1P.o: In function `main':
  hello.c:(.text+0x1f): undefined reference to `fcntl64'
  collect2: ld returned 1 exit status

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds


More information about the uClibc mailing list