How to download a file from godbolt?

109 Views Asked by At

I'd like to download the shared library libc.so.6 from godbolt. The site is running GNU libc version: 2.31 and I downloaded that package from https://ftp.gnu.org/gnu/libc/glibc-2.31.tar.xz and rebuilt the shared object. But, things didn't go well and I suspect there's a difference between godbolt's shared object and mine, so I'd rather download it directly from godbolt.

Is there a way to chunk the output then assemble them locally to produce the libc.so.6 binary?

Currently it produces this [Truncated] output

Program returned: 143
Program stdout
0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 ... [Truncated]

Demo

#include <stdio.h>
#include <stdint.h>

int main() {
    FILE *libc_file = fopen("/lib/x86_64-linux-gnu/libc.so.6", "rb");
    uint8_t byte;
    while (fread(&byte, 1, 1, libc_file) == 1) {
        printf("0x%02X ", byte);
    }
    fclose(libc_file);
    return 0;
}
0

There are 0 best solutions below