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

libffi assembler relocation check is not robust, fails with clang #55938

Closed
donmez mannequin opened this issue Mar 31, 2011 · 21 comments
Closed

libffi assembler relocation check is not robust, fails with clang #55938

donmez mannequin opened this issue Mar 31, 2011 · 21 comments
Assignees
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@donmez
Copy link
Mannequin

donmez mannequin commented Mar 31, 2011

BPO 11729
Nosy @doko42, @pitrou, @benjaminp, @merwok, @skrah, @koobs

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/skrah'
closed_at = <Date 2013-01-16.22:35:47.493>
created_at = <Date 2011-03-31.12:38:37.839>
labels = ['type-bug', 'build']
title = 'libffi assembler relocation check is not robust, fails with clang'
updated_at = <Date 2013-04-30.08:05:39.172>
user = 'https://bugs.python.org/donmez'

bugs.python.org fields:

activity = <Date 2013-04-30.08:05:39.172>
actor = 'python-dev'
assignee = 'skrah'
closed = True
closed_date = <Date 2013-01-16.22:35:47.493>
closer = 'skrah'
components = ['Build']
creation = <Date 2011-03-31.12:38:37.839>
creator = 'donmez'
dependencies = []
files = []
hgrepos = []
issue_num = 11729
keywords = []
message_count = 21.0
messages = ['132663', '132675', '132676', '132677', '132679', '132680', '135233', '135234', '135236', '136639', '180103', '180105', '180114', '180115', '180182', '180184', '180185', '180243', '180771', '180776', '188141']
nosy_count = 9.0
nosy_names = ['doko', 'pitrou', 'donmez', 'benjamin.peterson', 'eric.araujo', 'Arfrever', 'skrah', 'python-dev', 'koobs']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue11729'
versions = ['Python 3.3', 'Python 3.4']

@donmez
Copy link
Mannequin Author

donmez mannequin commented Mar 31, 2011

The check under Modules/_ctypes/libffi/configure.ac does;

echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
    libffi_cv_as_x86_pcrel=no
fi  

With clang; we get:

clang: warning: argument unused during compilation: '-g'

So it fails to detect pc relocation support due to an unrelated warning.

@donmez donmez mannequin added the build The build process and cross-build label Mar 31, 2011
@benjaminp
Copy link
Contributor

I suggest you complain to the libffi maintainers.

@donmez
Copy link
Mannequin Author

donmez mannequin commented Mar 31, 2011

This is already fixed in upstream, check has been changed into:

libffi_cv_as_x86_pcrel=no
echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
if $CC $CFLAGS -c conftest.s > /dev/null; then
libffi_cv_as_x86_pcrel=yes
fi
])

@Arfrever
Copy link
Mannequin

Arfrever mannequin commented Mar 31, 2011

You can install the newest libffi and pass --with-system-ffi option to main configure of Python.

@donmez
Copy link
Mannequin Author

donmez mannequin commented Mar 31, 2011

Yes I can workaround it but I'd like to get it fixed inside Python too ;)

@Arfrever
Copy link
Mannequin

Arfrever mannequin commented Mar 31, 2011

Internal copies of third-party libraries are rather always outdated, so it's better to always use system libraries. IMHO Python shouldn't bundle any third-party libraries and should force users to use system libraries. At least, system libraries could be used by default and main configure could accept --with-internal-expat and --with-internal-libffi options.

@donmez
Copy link
Mannequin Author

donmez mannequin commented May 5, 2011

Ping? Shall I submit a fix for Modules/_ctypes/libffi/configure.ac or better yet will you sync in-tree libffi?

@pitrou
Copy link
Member

pitrou commented May 5, 2011

Well, ctypes is kindof unmaintained right now, and the private libffi copy belongs to that module.
(the reason we have a libffi copy is that, IIUC, it's patched)

@donmez
Copy link
Mannequin Author

donmez mannequin commented May 5, 2011

Patch for configure.ac then?

@merwok
Copy link
Member

merwok commented May 23, 2011

See also bpo-12081.

@skrah
Copy link
Mannequin

skrah mannequin commented Jan 16, 2013

In 3.3 libffi has been updated to 3.0.11. Our clang buildbot does not
show this particular warning, but still fails to compile libffi:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%2Bclang%203.3/builds/320/steps/compile/logs/stdio

It would help if you provided a link to the upstream patch.

@donmez
Copy link
Mannequin Author

donmez mannequin commented Jan 16, 2013

See http://sourceware.org/ml/libffi-discuss/2011/msg00024.html for the libffi patch.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jan 16, 2013

New changeset 190a115b7748 by Stefan Krah in branch '3.3':
Issue bpo-11729: Backport commit bff052d from libffi upstream in order to fix
http://hg.python.org/cpython/rev/190a115b7748

@skrah
Copy link
Mannequin

skrah mannequin commented Jan 16, 2013

Thanks for the link. The diff was committed last week to the upstream
libffi development tree, so I backported it.

@skrah skrah mannequin closed this as completed Jan 16, 2013
@skrah skrah mannequin self-assigned this Jan 16, 2013
@skrah skrah mannequin added the type-bug An unexpected behavior, bug, or error label Jan 16, 2013
@koobs
Copy link

koobs commented Jan 18, 2013

@skrah
Copy link
Mannequin

skrah mannequin commented Jan 18, 2013

koobs <report@bugs.python.org> wrote:

Stefan, can we merge this to the 2.7 branch as well please?

If Benjamin is okay with it, yes. The problem with these configure fixes
is that they might break other systems in unexpected ways. I already hesitated
to put it into 3.3, but the buildbots are fine.

@koobs
Copy link

koobs commented Jan 18, 2013

Thanks for the quick response. I'd be happy for it to be FreeBSD conditional/specific if that's more suitable, safer?

Having said that, our buildbot OS coverage is pretty good, no?

@skrah
Copy link
Mannequin

skrah mannequin commented Jan 19, 2013

The buildbot coverage is good, but the number of (OS, shell, compiler)
combinations is much higher.

@benjaminp
Copy link
Contributor

Okay with me to backport.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jan 27, 2013

New changeset b9792b27d410 by Stefan Krah in branch '2.7':
Issue bpo-11729: Backport commit bff052d from libffi upstream in order to fix
http://hg.python.org/cpython/rev/b9792b27d410

@python-dev
Copy link
Mannequin

python-dev mannequin commented Apr 30, 2013

New changeset 7a2e0c1bb1a9 by Gregory P. Smith in branch '3.2':

New changeset aa3371fa9773 by Gregory P. Smith in branch '3.3':

New changeset e0fdc21c7d13 by Gregory P. Smith in branch 'default':

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants