tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Linking with cosmopolitan: Invalid relocation entry


From: Domingo Alvarez Duarte
Subject: [Tinycc-devel] Linking with cosmopolitan: Invalid relocation entry
Date: Wed, 12 Oct 2022 17:44:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

Hello !

I'm trying to use tcc to build a test program using cosmopolitan libc https://github.com/jart/cosmopolitan and I'm getting this error : "cosmopolitan.a: error: Invalid relocation entry [ 2] '.rela.text' @ 0000000c".

Here is the C program:

=====

typedef short __CHAR16_TYPE__;
typedef int __CHAR32_TYPE__;
typedef signed char __INT8_TYPE__;
typedef unsigned char __UINT8_TYPE__;
typedef short __INT16_TYPE__ ;
typedef unsigned short __UINT16_TYPE__;
typedef unsigned int __UINT32_TYPE__;
typedef unsigned long __UINT64_TYPE__;
typedef long long __INTMAX_TYPE__;
typedef unsigned long long __UINTMAX_TYPE__;

typedef signed char __INT_LEAST8_TYPE__;
typedef unsigned char __UINT_LEAST8_TYPE__;
typedef short __INT_LEAST16_TYPE__;
typedef unsigned short __UINT_LEAST16_TYPE__;
typedef int __INT_LEAST32_TYPE__;
typedef unsigned int __UINT_LEAST32_TYPE__;
typedef long __INT_LEAST64_TYPE__;
typedef unsigned long __UINT_LEAST64_TYPE__;

typedef signed char __INT_FAST8_TYPE__;
typedef unsigned char __UINT_FAST8_TYPE__;
typedef short __INT_FAST16_TYPE__;
typedef unsigned short __UINT_FAST16_TYPE__;
typedef int __INT_FAST32_TYPE__;
typedef unsigned int __UINT_FAST32_TYPE__;
typedef long __INT_FAST64_TYPE__;
typedef unsigned long __UINT_FAST64_TYPE__;

#define __STRICT_ANSI__

#include "cosmopolitan.h"
int main(int argc, char *argv) {
    printf("hello world\n");
    return 0;
}

=====

And here is the command line:

=====

# run gcc compiler in freestanding mode
tinycc-env tcc -nostdlib -nostdinc \
  -o hello-tcc.com.dbg hello-tcc.c  \
   crt.o ape-no-modify-self.o cosmopolitan.a
#objcopy -S -O binary hello-tcc.com.dbg hello-tcc.com

# NOTE: scp it to windows/mac/etc. *before* you run it!
# ~40kb static binary (can be ~16kb w/ MODE=tiny)
#./ape.elf ./hello-tcc.com

=====

Here is the folder content:

=====

total 54520
-rwxr-xr-x 1 mingo mingo    22192 oct 11 06:07 ape-copy-self.o
-rwxr-xr-x 1 mingo mingo   146720 oct 11 06:07 ape.lds
-rwxr-xr-x 1 mingo mingo    31000 oct 11 06:07 ape-no-modify-self.o
-rwxr-xr-x 1 mingo mingo    22192 oct 11 06:07 ape.o
-rwxr-xr-x 1 mingo mingo 54084380 oct 11 06:07 cosmopolitan.a
-rwxr-xr-x 1 mingo mingo  1472975 oct 11 06:08 cosmopolitan.h
-rwxr-xr-x 1 mingo mingo     3608 oct 11 06:07 crt.o
-rw-rw-r-- 1 mingo mingo    12620 oct 12 17:16 gcc-macros.h
-rwxrwxr-x 1 mingo mingo     3648 oct 12 17:23 hello-tcc
-rw-rw-r-- 1 mingo mingo     1135 oct 12 17:22 hello-tcc.c
-rwxrw-r-- 1 mingo mingo      348 oct 12 17:33 mk-hello-tcc.sh
-rw-rw-r-- 1 mingo mingo       66 oct 12 17:16 mk-it-tcc.sh

=====

Can someone with more experience shed some light here ?

Cheers !




reply via email to

[Prev in Thread] Current Thread [Next in Thread]