Commit Graph

645 Commits

Author SHA1 Message Date
Jessica Hamilton
9866b1a47a Add -rdynamic as a no-op, similar to -pthread.
Haiku binaries already export their symbols, which is the same
behaviour as using `-rdynamic` on other platforms; so add
`-rdynamic` as a no-op to simplify porting software that depends
on the behaviour of `-rdynamic`.
2023-05-08 22:27:04 +12:00
Trung Nguyen
a877b4dce9 gcc/config: Drop cdecl and stdcall built-in defines
Droped the `__cdecl` and `__stdcall` built-in macros except for
32-bit i386 compilation.

These macros refer to calling conventions that are specific to
32-bit x86 and have no meaning for other architectures. Using them
does nothing except producing a compiler warning.

These macros were present in BeOS times but only for i386. At the
time of writing, they are not used anywhere throughout the Haiku
source tree, and some HaikuPorts recipes even have to provide
workarounds for these macros' prescence.

Change-Id: I70369a64a71d8e29ccc0bd6282ba93832c1a6adf
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/6384
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2023-05-08 09:24:31 +00:00
Alexander von Gluck IV
a370f9b4e0 gcc/config/riscv64: Drop custom architecture defines for Haiku
* We decided to go with the more standadard __riscv, __riscv_xlen
* No references to these in Haiku source code

Change-Id: Ia3aa9c239a5313f404fad1163fac3334a10f0eb4
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/6199
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-03-13 18:21:45 +00:00
Alexander von Gluck IV
934127e8f1 gcc/riscv: Align Haiku spec to gcc 11 design
Change-Id: I6f67c79ddefe85a7d1e8773e88f50cd3b70a4f80
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/5444
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-12-26 15:17:05 +00:00
PulkoMandy
57c9179de2 Merge gcc 11.3.0 with Haiku changes
Change-Id: I8bf3c653051e1853ac63379d3b140f813dd8d590
2022-07-15 19:57:13 +02:00
Adrien Destugues
d65f2977c7 import gcc 11.3.0
Change-Id: Ibbd34379df256b6994d7d12448cde98c84294aab
2022-07-15 19:23:24 +02:00
Adrien Destugues
5e75222e07 import mpc 1.2.0 2022-07-15 15:15:39 +02:00
Adrien Destugues
b8f3cf881a import gmp 6.2.1 2022-07-15 15:12:25 +02:00
Adrien Destugues
680f0e1112 import ISL 0.24 2022-07-15 15:05:28 +02:00
Adrien Destugues
7487388f51 Merge 'vendor-gcc' branch in master
No changes to the code, this is just to ease tracking of gcc merges and
comparison of our code with upstream.
2022-07-15 14:53:21 +02:00
Adrien Destugues
39ede93a70 import gcc 11.2.0 2022-07-15 14:33:44 +02:00
Adrien Destugues
a4e1e0eca1 import gcc 8.3.0 2022-07-15 14:28:41 +02:00
Adrien Destugues
4e0a65840e import gcc 7.3.0 2022-07-15 14:14:32 +02:00
Adrien Destugues
a484705173 Merge 'vendor-binutils' branch into master
This merge is made using the "ours" strategy so it does not change
anything to the master branch content. This is here only to make it
easier to do the next updates of binutils.

The process to update the binutils vendor branch is:

git checkout vendor-binutils         # Work on the vendor branch
git rm -rf binutils                  # Delete the previous binutils version
wget http://.../binutils.tar         # Download the new binutils version
tar xvf binutils.tar                 # Extract the new binutils version
mv binutils-2.36 binutils            # Move the extracted directory in the correct place
git add binutils                     # Add the new files
git status                           # Make sure everything is ok
git commit -m "import binutils 2.36" # Commit the new version

git checkout master
git merge vendor-binutils            # Merge the changes in the master branch
                                     # Resolve conflicts as needed

When this process is followed, it is a lot easier to compare our branch
with the original sources:

git diff binutils/ vendor-binutils   # Compare the binutils directory with the upstream version

There is also less risk to miss a patch when merging the changes,
because Git will keep track of the changes.

This process is named "vendor branches" and originates from SVN. It had
been used until binutils 2.28.1, but the next two updates were not done
this way. This commits sets us up to use this workflow again.
2022-07-15 13:54:11 +02:00
Adrien Destugues
6e159495d4 import binutils 2.36.1 2022-07-15 13:48:03 +02:00
Adrien Destugues
1fbf4ff7c7 import binutils 2.32 2022-07-15 13:44:19 +02:00
Trung Nguyen
0665c85caf gcc: Pass --eh-frame-hdr to linker by default
This creates a PT_EH_FRAME section in Haiku binaries,
allowing 3rd party unwind libraries (libunwind) to obtain
frame information for unwind procedures.

Change-Id: If475909d182bcac11024ebbc8220456733330fe8
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/5434
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-07-07 15:02:22 +00:00
PulkoMandy
493aaad4dc gcc: make -fPIE do the same as -fPIC
Should fix the root cause of https://github.com/haikuports/haikuports/issues/4316

Some CPU architectures do similar things (for example because they don't
support PIC at all). So it should be fine to do it here. See for example
gcc/gcc/config/gcn/gcn.c

Change-Id: Ie23e4ece0d09c1083ad3c3bf43756f3207bbdafe
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/5194
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-04-21 15:43:56 +00:00
Mashijams
faaf2fe1c8 Fixes build error on MacOS
This patch fixes build error caused due to HOST_HOOKS_INITIALIZER

Change-Id: I2094a5258e0100bd027b6780a214e3869f56368e
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/5114
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-04-17 08:24:24 +00:00
Jessica Hamilton
016003468a legacy/gcc: add -pthread no-op. 2022-03-23 02:13:11 +00:00
Jessica Hamilton
5db2362242 haiku: allow passing -pthread as a no-op.
Reduces the need to patch configure/build scripts that assume
`-pthread` is available on POSIX/UNIX-ish systems.
2022-03-22 23:03:28 +00:00
Adrien Destugues
795d2053a0 binutils: enable PE on 32bit build
Needed for the 32bit EFI bootloader. Haiku build on Haiku fails
currently because this is not enabled.
2022-02-28 19:12:34 +01:00
Alexander von Gluck IV
b70d54b657 gcc: backport fix for Canadian builds
* Canadian builds are broken in gcc 11.2.0
* error: 'fenv_t' has not been declared in '::'
* https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587255.html
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017
* https://gcc.gnu.org/g:01a70ccd723eb9a479186fe37c972b0d0f8676cf

Change-Id: I0bbadd3bec5ddc4b1f1e01e7e6a648f54bfd59bf
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4835
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2022-02-26 11:38:01 +00:00
Alexander von Gluck IV
7b6c9e88a2 gcc/config: Fix LINK_SPEC on aarch64,m68k,mips,riscv,rs6000
* Results in an internal compiler error: in do_spec_1, at gcc.c:5971
* %{!o*:-o %b} is "no output flag to linker, add one with input name"
* ld blah.o becomes ld blah.o -o blah
* We really shouldn't be playing with this in linker specs... It also
  breaks on gcc 11.

Change-Id: I63d0afecd16f25423874419c0ac9496404b2069e
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4834
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-28 18:37:54 +00:00
David Karoly
55771191ca gcc/config/arm: fix LINK_SPEC
Change-Id: I03f5dfc0fa4f0427de5256d9d8683e85602e4c44
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4779
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-12-12 21:06:08 +00:00
Alexander von Gluck IV
1e3a9f6730 gcc: Fix m68k, mipsel
Change-Id: I537c70d4326ffae23c867deff6be0c6291608e00
2021-12-07 16:15:11 -06:00
Augustin Cavalier
2b5dc2481e Merge our changes into GCC 11.2. 2021-12-06 22:03:28 -05:00
waddlesplash
a2d83d7eeb Import GCC 11.2. 2021-12-06 21:18:24 +00:00
Augustin Cavalier
de507584b8 Merge changes from HaikuPorts patches. 2021-12-06 14:57:24 -05:00
Maciej Bałuta
19aaa79362 jam: make compile_commands.json valid JSON
There was a comma in compile_commands.json after the last entry what
prevented from using file directly in some tools.

Test plan:
verified new compile_commands.json with "python3 -m json.tool compile_commands.json"

Change-Id: I6c2582f7285a3409d95081a93f3c05b5cc9322b9
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4671
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-11-03 11:48:45 +00:00
David Karoly
7f682463a1 binutils/ld: adjust default page sizes for arm
Change-Id: Ia36ce9ddcca6adf41eaa7c26f2c304a8e934597a
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4661
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-10-26 13:49:35 +00:00
Maciej Bałuta
9e6821c209 jam: update version
Version string was not updated for 10 years, but there were some changes made.
This commit updates the date to avoid confusion.

Test plan:
~/buildtools/jam> jam -v
Jam 2.5-haiku-20211020. OS=HAIKU. Copyright 1993-2002 Christopher Seiwald.

Change-Id: Ieea0ed2a533396f664948f58798acee0f6c811e9
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4618
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-10-20 17:56:33 +00:00
Maciej Bałuta
72c791bc1f jam: update default paths in Jambase
Running "./jam0 install" installed jam in /boot/common/bin/ which
is no longer used. Other directories also looked outdated so they
are updated too.

Test plan:
1. make
2. ./jam0 install
   Install /boot/system/non-packaged/bin/jam
3. which jam
   /boot/system/non-packaged/bin/jam

Change-Id: I69c719eab0bd211f545c17337e3bc73bb1ab78fe
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4617
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-10-20 17:56:33 +00:00
Franck LeCodeur
4b7b6c63e8 jam: Remove ignored archiver flag modifier
The call of make in buildtools/jam produces the following output:

LINKLIBS= ./jam0
...patience...
...found 271 target(s)...
...updating 33 target(s)...
MkDir1 bin.linuxx86
Cc bin.linuxx86/builtins.o
< reduced output >
Cc bin.linuxx86/variable.o
Archive bin.linuxx86/libjam.a
ar: `u' modifier ignored since `D' is the default (see `U')
ar: creating bin.linuxx86/libjam.a
...

'make' bootstraps 'jam0' which calls 'ar' to create the static library 'libjam.a'.
The call looks like this:

ar ru bin.linuxx86/libjam.a bin.linuxx86/builtins.o <reduced output> bin.linuxx86/variable.o

The modifier 'u' gets ignored.

The underlying cause is that the build was done in deterministic mode ('D'), a.o. NOT using timestamps, which is completely fine.
But because of this the archiver tool (ar) can never update files in the archive based on timestamps.
"ru" means replace files (flag 'r') only if they are updated (flag suffix 'u') based on timestamps.
This patch removes the flag suffix 'u'.

Change-Id: I57fa2d50c2081ee66d1b71648714e773ecb7cd59
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4419
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-09-13 06:10:36 +00:00
Fredrik Holmqvist
0ff4d6adaf gcc: Use initarray for ARM64 and RISC-v.
Change-Id: I6695707357f8dba467b09f700e7efe702102a42e
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4408
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-09-08 08:54:03 +00:00
Augustin Cavalier
139f4e7c6c jam: Pass -e to JAMSHELL.
Equivalent to hrev55387 in Haiku.
2021-09-06 16:11:04 -04:00
Alexander von Gluck IV
bc70af2399 binutils/ld: Fix arm target emulation typo
Change-Id: Ia8e6631b3aae04c302104826d1e98a33590ed440
2021-09-03 20:18:36 -05:00
Franck LeCodeur
c3d8487752 jam: Fix build warnings. Add missing include for POSIX compliant systems.
Warnings were:

Cc bin.linuxx86/fileunix.o
fileunix.c: In function ‘file_archscan’:
fileunix.c:217:6: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
  217 |  if( read( fd, buf, SARMAG ) != SARMAG ||
      |      ^~~~
      |      fread
fileunix.c:220:6: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
  220 |      close( fd );
      |      ^~~~~
      |      pclose
fileunix.c:272:3: warning: implicit declaration of function ‘lseek’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
  272 |   lseek(fd, offset + SARHDR, 0);
      |   ^~~~~
      |   fseek

Change-Id: Iedcdec01deb929d6c91ebc9d7eb72497fe078dd4
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4399
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-09-02 19:34:43 +00:00
Franck LeCodeur
f5c73e1b90 jam: Fix build warning. Correct expression.
Pointer to struct on stack was given instead of the calculated value.

Warning was:

Cc bin.linuxx86/expand.o
expand.c: In function ‘var_expand’:
expand.c:210:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘LIST *’ {aka ‘struct _list *’} [-Wformat=]
  210 |       printf("MAXSYM is too low! Need at least %d\n", l);
      |                                                ~^     ~
      |                                                 |     |
      |                                                 int   LIST * {aka struct _list *}

Change-Id: I65ab593287fc1b9aa2aba0056714726e29467012
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4398
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-09-02 19:32:44 +00:00
Michael Matz
1673cf9c0f binutils: elf/riscv: Fix relaxation with aliases [PR28021]
* This is a backport of a fix in binutils master and 2.37
  commit: 235f5ef4a6b8fbdcfaea8b629f7c6a9792a789de
* Solves a dobuble-relaxation optimization in binutils under riscv64

Change-Id: I6a2ed520615b5e36bbb0003bf3a6a186c0aaeca1
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4412
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-09-01 20:51:50 +00:00
Franck LeCodeur
cc988c8c90 jam: Fix build warning. Add missing include for Linux.
Warning was:

Cc bin.linuxx86/execunix.o
execunix.c: In function ‘execwait’:
execunix.c:301:19: warning: implicit declaration of function ‘wait’ [-Wimplicit-function-declaration]
  301 |      while( ( w = wait( &status ) ) == -1 && errno == EINTR )
      |

Change-Id: I7c0e53db8d18e9e6cb317980cb9be9026b7fce20
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4400
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-08-30 16:36:29 +00:00
Franck LeCodeur
88d0e51d38 jam: Fix warning. Argument has type long int but indicated format was int.
Cc bin.linuxx86/variable.o
variable.c: In function ‘var_defines’:
variable.c:121:46: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
  121 |    printf("MAXSYM is too low, need at least %d\n", val - *e);
      |                                             ~^     ~~~~~~~~
      |                                              |         |
      |                                              int       long int
      |                                             %ld

Change-Id: I389577a71416029fdff0f486af745ea482b14ddd
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4397
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-08-30 16:34:35 +00:00
Fredrik Holmqvist
5cccbfddba aarch64-haiku config, remove file_end_indicate_exec_stack
This causes unwanted .note.GNU-stack entries which we don't want.
It seems to be an old flag for executable permissions on stack.
2021-08-29 18:36:12 +02:00
Franck LeCodeur
dcd0415ded jam: Fix warning. Include missing header file.
Include header file for function prototypes hcache_init, hcache_done.
Note that include order is important, i.e. include has to be placed after the lists.h and rules.h includes.

Change-Id: Ic8a286662c8267bdfd19011b5ed8e825ee16d7ee
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4396
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-08-28 06:25:13 +00:00
Franck LeCodeur
1456812988 buildtools: Remove build warnings which are caused by missing return type declarations.
Change-Id: I3cba648f45e9eb537eb43ee2345c59fc33976dc7
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4376
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-08-27 13:29:07 +00:00
Alexander von Gluck IV
2f8f3a16b7 binutils/emulparams: Rely on elf_i386.sh, layering haiku on top
* Solves a new segfault encountered while linking our 32-bit
  bios_ia32 loader under x86_64 (-m elf_i386_haiku)
  backtrace:
    _bfd_x86_elf_link_setup_gnu_properties() : reason: SIGSEGV
    elf_i386_link_setup_gnu_properties()
    ldelf_after_open()
    lang_process()
    main()
* I maintained our adjustments which differ / don't exist in
  elf_i386.  Lots of new code inclusions though in elf_i386

Change-Id: I9220730ba41bc029e40d1b4a8e5fbd85b312c1b5
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4375
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-26 20:24:40 +00:00
Alexander von Gluck IV
7c3988da64 binutils: Apply Haiku patches to 2.36.1
* a82c1c - Base Haiku patches
* d113c7 - Fix powerpc gas target for Haiku
* e97614 - arm64 target support
* f91439 - don't require coff, we don't need it anyway
* c3903e - enable PE support for ARM
* f4963f - Add missing __exidx_* to fix arm bootstrap

Change-Id: I27d810fa49c38ed6e1548fc1f880bebb62ee0d64
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4374
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-26 20:24:40 +00:00
Alexander von Gluck IV
46e1ce6913 binutils: Import binutils 2.36.1
Change-Id: I06fc1c19229e26c20132c255c92b7e71ea3cc31a
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4372
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-26 20:24:40 +00:00
Przemysław Buczkowski
9c6e71079b GCC: Patch for Apple Silicon compatibility
This patch fixes a linker error occuring when compiling
the cross-compiler on macOS and ARM64 architecture.

Adapted from:
https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404

Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-08-23 18:31:22 +00:00
Fredrik Holmqvist
4ab0fe4d95 Redo gcc AARCH64 config
Previous setup failed to do link bootstrap libz with msissing
unwind symbols due to not finding libgcc_s.so.1

Change-Id: I80a85502843f82d2324cf816cb761ddfa78e289f
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/3754
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-15 21:51:09 +00:00