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

Add platform support for Linux/m68k #51

Merged
merged 4 commits into from Oct 14, 2016

Conversation

glaubitz
Copy link
Contributor

Hello!

Here's my V2 patch series to add platform support for Linux/m68k. I will open another PR shortly for the 3.0 branch.

Thanks,
Adrian

glaubitz and others added 3 commits October 13, 2016 16:21
…ALIGN

On m68k, 'long long' is 16-bit aligned while 'sem_t' is 32-bit aligned
and we must therefore include 'sem_t' when determining the values for
FB_ALIGNMENT and FB_DOUBLE_ALIGN. Otherwise, the futex system call
will fail on these systems.
@glaubitz
Copy link
Contributor Author

I just added another patch on top to fix the generator script for the linker version script.

The version scripts must include _IO_stdin_used when using the glibc as otherwise the application can crash or caused unexpected behavior on some architectures, see:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840666
http://lists.gnu.org/archive/html/bug-glibc/2001-12/msg00203.html

The GNU C library supports two ABIs for libio, one is the pre-2.1
ABI and the other is the current one. In order to determine which
ABI is to be used, the C library checks whether the _IO_stdin_used
symbol is exported by the executable. In case the symbol is present,
the new ABI is assumed, if the symbol is missing, the old ABI is
assumed. Thus, if an application is linked against a modern version
of glibc, it must export the _IO_stdin_used symbol as otherwise the
executable can crash or provoke other unexpected behavior on some
architectures like PowerPC or MIPS because the C library is using
the old ABI in this case.
@AlexPeshkoff
Copy link
Member

AlexPeshkoff commented Oct 14, 2016

Looks like fix with _IO_stdin_used will be useful for linux on any HW platform?

@glaubitz
Copy link
Contributor Author

Hi Alex!

Yes, this fix should be included regardless the architecture. Without the additional symbol, Firebird will crash or misbehave on PowerPC, MIPS, Alpha among others and the toolchain therefore always includes the symbol by default when not using a linker script, e.g. amd64:

glaubitz@ikarus:$ dpkg --print-architecture
amd64
glaubitz@ikarus:
$ objdump -T /bin/bash |grep _IO_stdin_used
00000000004c5300 g DO .rodata 0000000000000004 Base _IO_stdin_used
glaubitz@ikarus:~$

Damyan has also included this fix in the Debian package [1] and firebird3.0 now builds fine everywhere which it didn't before.

[1] https://anonscm.debian.org/cgit/pkg-firebird/3.0.git/commit/?id=57d5f607e9c083438d108e25daf5e8a3d3c225de

@AlexPeshkoff AlexPeshkoff merged commit 7ba4616 into FirebirdSQL:master Oct 14, 2016
@themaddoctor
Copy link

With gcc 7.1.0 on x86_64, and firebird 2.5.8 sources, I'm also getting this:

make[2]: *** [../gen/Makefile.refDatabases:68: empty.fdb] Segmentation fault

@glaubitz
Copy link
Contributor Author

glaubitz commented Jan 17, 2018

@themaddoctor This is a different issue. Version 2.5.8 doesn't use any version scripts, so it cannot be affected by the missing _IO_stdin_used on Linux.

You should open a new issue instead. Although I'm not sure whether 2.5.8 is still supported.

@themaddoctor
Copy link

Then what is this issue, which has the same symptoms, and seg faults on the same executable?

@glaubitz
Copy link
Contributor Author

A segfault is a very generic error message. Just because you see two cases of a segfault, does not mean you are seeing the same bug. As I said before, Firebird 2.5.x does not use version scripts, so this cannot be the same bug.

If you want to know what your problem is, please build Firebird with debug symbols enabled and use gdb to generate a usable backtrace.

@themaddoctor
Copy link

gdb create_db
(gdb) run test.fdb
Starting program: /building/libreoffice/create_db test.fdb
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff458d700 (LWP 21842)]
[New Thread 0x7ffff3b7a700 (LWP 21843)]
[New Thread 0x7ffff3379700 (LWP 21844)]

Thread 1 "create_db" received signal SIGSEGV, Segmentation fault.
0x00000000006d2eb0 in RSE_open (tdbb=tdbb@entry=0x7fffffffdc90, rsb=0x7ffff2b459c8)
    at ../src/jrd/rse.cpp:380
380       if (rsb->rsb_invariants)

@glaubitz
Copy link
Contributor Author

Can you please open a new issue for that? This isn't related.

@themaddoctor
Copy link

Do you mean a new "pull request"? Because there is no "issues" tab in this project, as far as I can see.

@hvlad
Copy link
Member

hvlad commented Jan 18, 2018

Bug tracker is here
http://tracker.firebirdsql.org/

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

Successfully merging this pull request may close these issues.

None yet

5 participants