Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding tcc support #73

Open
norayr opened this issue Oct 10, 2019 · 13 comments
Open

adding tcc support #73

norayr opened this issue Oct 10, 2019 · 13 comments

Comments

@norayr
Copy link
Member

norayr commented Oct 10, 2019

hello, @dcwbrown

I have added initial support for tcc compiler.
I did it mostly because I have a request to add it by the company, which has to use only tcc compiler for one important project.
Also, tcc seems to be a fairly good compiler (I checked it back 10 years ago, and it wasn't stable enough, as I remember) nowadays, fairly fast, much faster than gcc/clanng, and generates slimmer binaries.

Please review my changes in dedicated tcc_support branch:
a35668b
9626a95

I had to add:

  • #elif defined(TINYC) case in src/tools/make/configure.c

  • ifeq condition for tcc compiler in src/tools/make/oberon.mk
    (though tcc seems to support -static flag, it was not able to combine object files into one executable while using that flag).

  • I had to change the line snprintf(libspec, sizeof(libspec), " -l%s", oname); where I removed whitespace between -l and %s because otherwise tcc was failing.

I also had to update bootstrap sources.

I only have linux/x86_64, and cannot test the changes now on other Unix systems.
Also, tcc is available for Windows, so I am looking forward for your suggestions on how to integrate tcc related changes in to the mainline voc source.

@dcwbrown
Copy link
Contributor

dcwbrown commented Oct 10, 2019 via email

@antranigv
Copy link
Member

antranigv commented Oct 10, 2019 via email

@dcwbrown
Copy link
Contributor

I have finished making my build server work again. It's building all except the android platform (there is no problem but I need to stop for today).

It should be responding to github checkin hooks though I haven't tested this.

I added a feature for manually triggering builds: If you open webpage

https://brownsmeet.com/githubhook/vishaps-trigger/tcc_support

-- you will trigger a new build of the branch named at the end of the url.

The build status is updated dynamically on the github/visshaps/voc readme, or you can view

https://brownsmeet.com/githubhook/vishaps-status.svg

Note that if you click on any line in the status you will be shown the build log for that particular build. This even works during the build so you can see how far it has got.


With regard to BuildBot - I'm afraid I'm out of my depth there. I've no idea how much it can do.

You are very welcome to have a go :-).

Can it build with mingw, or MSVC, or on android? Can it parse logs and show status of test parts?

Good luck! I think you may have big job on your hands ...

@norayr
Copy link
Member Author

norayr commented Oct 11, 2019

thank you all,
yes, I have noticed your comment, but probably would not notice if you didn't mention it.
tomorrow will try as you've pointed out.

also, i am afraid, building software with -M (link statically) won't work.
will try tomorrow.

@norayr
Copy link
Member Author

norayr commented Oct 11, 2019

So, I have updated the branch, and it is ready to be merged with master.
I have checked, -M flag doesn't cause crashes, just the static linking of output binaries does not take place. So, well, may be that's ok.

I think Readme also should be updated.
It should also point out that tcc is only supported on Unix systems (for now).

About Windows, it only passed somewhere on the web, that for linking to Windows libraries tcc needs some .def files, and headers alone are not enough.

@dcwbrown
Copy link
Contributor

Looks good - all the existing tests passed. You're fine to do the merge.

Re comment - I'll update doc/compiler.md once you've merged. And maybe I will get around to updating the compiler help display to indicate which link types it supports depending on how it has been built, perhaps.

I'm not planning to do the work to make tcc work on windows and document it.

-- Dave.

@norayr
Copy link
Member Author

norayr commented Oct 11, 2019

merged to master.

@norayr
Copy link
Member Author

norayr commented Oct 11, 2019

also, there is no test currently for tcc on the main page.

@dcwbrown
Copy link
Contributor

It will need creating ...

I can do so if you wish - for a couple of architectures.

Which of centos, freebsd, fedora, ubuntu, opensuse would you most want to test?

@norayr
Copy link
Member Author

norayr commented Oct 11, 2019

i don't know, don't want to cause you unnecessary/extra work.

if or when you find mood to do so, i think ubuntu or fedora are okay, because they have more recent tcc, and if anything changes, it will be noticeable on those platforms? so just pick one of those. and may be freebsd as well.

and thank you.

@dcwbrown
Copy link
Contributor

On Ubuntu tcc went smoothly. The latest tcc is easily installed with apt install tcc.

On Fedora (29 or 30) the tcc compiler itself segfaults.

There are some messages about it on the tcc mailing list, but no resolution.

Did you try on Fedora, and if you solved this, how did you do it?

Now trying freebsd.

-- Dave.

@dcwbrown
Copy link
Contributor

Also getting segfault in tcc on freebsd.

@norayr
Copy link
Member Author

norayr commented Oct 14, 2019

hmmm. No, I only have gentoo (or funtoo) or all my computers.
But I have CentOS in the vicinity, and Debian, I will try on them.

I guess, I did not do a research yet, I guess, this might be about stack protection. Or something like address space randomization, some modern security feature related to address space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants