Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#9772 closed Bugs (fixed)

[libs/context] make_i386_sysv_elf_gas.S:52: Error: invalid instruction suffix for `pop'

Reported by: ad@… Owned by: olli
Milestone: To Be Determined Component: context
Version: Boost Development Trunk Severity: Regression
Keywords: Cc: ad@…

Description

Since you moves the develop repo to git I don't really know where to create this ticket so I make it here ad it is linked in the Wiki page, and I made it here aswell in the github submodule page: https://github.com/boostorg/context/issues/1

Issue: I fail to crosscompile the git 1.56 develop while it works on the 1.55 from a windows host targeting linux Compiling the 64-bit lib also worked, I think it is affecting only the linux target with address-model=32 (a similar issue I got with OSX32_64 and 1.55 that I think you have fixed, but now occurs for me on linux32 and 1.56)

Command used:

b2 -j1 -d2 -q toolset=gcc variant=release abi=sysv address-model=32 binary-format=elf link=static,shared pch=off strip=on target-os=linux threading=multi threadapi=pthread cxxflags="-w -m32" linkflags="-w -m32" --stagedir=stage32 --with-context

1.56 returns

Jamfile<X:\libs\boost-dev\libs\context\build>.gas bin.v2\libs\context\build\gcc-4.8.2\release\abi-sysv\address-model-32\architecture-x86\binary-format-elf\link-static\pch-off\strip-on\target-os-linux\threadap
i-pthread\threading-multi\asm\make_i386_sysv_elf_gas.o

    cpp -x assembler-with-cpp "libs\context\src\asm\make_i386_sysv_elf_gas.S" | as -am -o "bin.v2\libs\context\build\gcc-4.8.2\release\abi-sysv\address-model-32\architecture-x86\binary-format-elf\link-static\
pch-off\strip-on\target-os-linux\threadapi-pthread\threading-multi\asm\make_i386_sysv_elf_gas.o"

libs\context\src\asm\make_i386_sysv_elf_gas.S: Assembler messages:
libs\context\src\asm\make_i386_sysv_elf_gas.S:52: Error: invalid instruction suffix for `pop'
libs\context\src\asm\make_i386_sysv_elf_gas.S:64: Error: invalid instruction suffix for `pop'
...failed Jamfile<X:\libs\boost-dev\libs\context\build>.gas bin.v2\libs\context\build\gcc-4.8.2\release\abi-sysv\address-model-32\architecture-x86\binary-format-elf\link-static\pch-off\strip-on\target-os-linu
x\threadapi-pthread\threading-multi\asm\make_i386_sysv_elf_gas.o...
...failed updating 1 target...
...updated 23 targets...

1.55 final returns success

As a workaround I'm changing

cpp -x assembler-with-cpp "$(>)" | as -am -o "$(<)"

to

cpp -x assembler-with-cpp "$(>)" | as --32 -am -o "$(<)"

But I'm unsure if that's the right thing to do in my case, at least it compiles fine 32bit with this

Change History (30)

comment:1 by ad@…, 9 years ago

I have the three windows hosted toolchains targeting win/linux/max ready on my googledrive let me know if you need any of them for testing purpose you are welcome

comment:2 by ad@…, 9 years ago

also another inconsistency I note building a darwin target with clang-darwin-4.2.1 and this change:

cpp -x assembler-with-cpp "$(>)" | as --32 -am -o "$(<)"

"cpp" does not exists with clang and "as" doesn't know the switch -a

comment:3 by class101 <ad@…>, 9 years ago

Summary: [libs/context] make_i386_sysv_elf_gas.S:52: Error: invalid instruction suffix for `pop'[FIXED] [libs/context] make_i386_sysv_elf_gas.S:52: Error: invalid instruction suffix for `pop'

You can close this ticket, it has been fixed in this report [1]

[1] https://svn.boost.org/trac/boost/ticket/9774#comment:2

comment:4 by olli, 9 years ago

I've added --32, --64, --x32 to GNU as command line - could you verify that the code is still working, please?

comment:5 by class101 <ad@…>, 9 years ago

Sure it works all the build I did in [1] are after this last commit

Revision: 2775fe1c5d38b49e9554ea485b8a6ada0dc6461a Author: olk <oliver.kowalke@…> Date: 13/03/2014 08:50:36 Message: Update Jamfile.v2

  • add word size specifier to GNU as command line (required for cross-compiling; ELF only)
  • use property <abi> in file selection

Modified: build/Jamfile.v2

comment:6 by olli, 9 years ago

Resolution: fixed
Status: newclosed

OK, thx

comment:7 by class101 <ad@…>, 9 years ago

A bit offtopic but olli I have a question

When you write "untested.cpp - code for this platform is untested - please remove this file from build/Jamfile.v2 and report the test-result on boost-track !"

What is the boost-track ? I can't seem to find a mailing list with this exact name

Reporting to you anyway this untested proc worked fine here with the combined build I have tested in link [1]

--- "a/X:\\libs\\boost-dev\\libs\\context\\build\\Jamfile.v2"
+++ "b/X:\\libs\\boost-dev\\libs\\context\\build\\Jamfile.v2"
@@ -400,7 +400,6 @@ alias asm_context_sources
 alias asm_context_sources
    : asm/make_i386_x86_64_sysv_macho_gas.S
      asm/jump_i386_x86_64_sysv_macho_gas.S
-     untested.cpp
    : <abi>sysv
      <address-model>32_64
      <architecture>x86

in reply to:  7 comment:8 by olli, 9 years ago

Replying to class101 <ad@…>:

When you write "untested.cpp - code for this platform is untested - please remove this file from build/Jamfile.v2 and report the test-result on boost-track !" What is the boost-track ?

boost's bug tracking system at https://svn.boost.org/trac/boost

Reporting to you anyway this untested proc worked fine here with the combined build I have tested in link [1]

--- "a/X:\\libs\\boost-dev\\libs\\context\\build\\Jamfile.v2"
+++ "b/X:\\libs\\boost-dev\\libs\\context\\build\\Jamfile.v2"
@@ -400,7 +400,6 @@ alias asm_context_sources
 alias asm_context_sources
    : asm/make_i386_x86_64_sysv_macho_gas.S
      asm/jump_i386_x86_64_sysv_macho_gas.S
-     untested.cpp
    : <abi>sysv
      <address-model>32_64
      <architecture>x86

yes, I've to remove untested.cpp from those entries which are verified to work

comment:9 by class101 <ad@…>, 9 years ago

Resolution: fixed
Status: closedreopened
Summary: [FIXED] [libs/context] make_i386_sysv_elf_gas.S:52: Error: invalid instruction suffix for `pop'[libs/context] make_i386_sysv_elf_gas.S:52: Error: invalid instruction suffix for `pop'

Reopening because I caught today the same error with Apple's gcc-5666.3 (4.2.1) It seems -m32 is not passed, because 64-bit generation works fine and I could work around the problem with address-model=64 and fixing -m32 in the flags but that's a bit ugly hehe

Issue:

    "g++" -x assembler-with-cpp -O3 -finline-functions -Wno-inline -Wall -gdwarf-2 -fexceptions -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE -DNDEBUG -I"." -c -o "bin.v2\libs\context\build\darwin-4.2.1\release
\abi-sysv\address-model-32\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi\asm\make_i386_sysv_macho_gas.o" "libs\context\src\asm\make_i386_sysv_macho_gas.S
"

libs\context\src\asm\make_i386_sysv_macho_gas.S:51:suffix or operands invalid for `pop'
...failed darwin.compile.asm bin.v2\libs\context\build\darwin-4.2.1\release\abi-sysv\address-model-32\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi\asm\m
ake_i386_sysv_macho_gas.o...
...failed updating 1 target...
...updated 82 targets...

Command used:

b2 -j1 -d2 -q toolset=darwin variant=release abi=sysv address-model=32 binary-format=mach-o link=static,shared pch=off strip=on target-os=darwin threading=multi threadapi=pthread cxxflags="-w -m32" linkflags="-w -m32 -lstdc++" --without-python --without-mpi

Configuration used:

import option ;

using gcc :
: "X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/g++.exe"
: <archiver>X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/ar.exe
  <ranlib>X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/ranlib.exe
  <rc>X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/as.exe
  <linker-type>darwin 
;

option.set keep-going : false ;

comment:10 by olli, 9 years ago

boost.context compiles only assembler code - if gcc is invoked with the wrong flags on your platform then create an bug-report for boost.build.

comment:11 by class101 <ad@…>, 9 years ago

ok thank you I will do that sorry

comment:12 by class101 <ad@…>, 9 years ago

You can close this ticket

It seems related to a wrong toolset because just after adding to the command line architecture=x86, boost attempted to use -arch that do not exist in gcc-5666.3

But unfortunately it does not compile too with toolset=gcc target-os=darwin, it always fall in the unsupported.cpp of context

https://svn.boost.org/trac/boost/ticket/9786#comment:1

comment:13 by class101 <ad@…>, 9 years ago

Hey olli I have been able to compile with gcc-5666.3 both 32-bit and 64-bit libs with

toolset=gcc linker-type=darwin

and the patch below

Not sure why gcc is left out support here because I don't get troubles compiling clangs 32, 64 and combined with the patch below too

--- Jamfile.v2.a	2014-03-18 15:33:05.377689400 +0100
+++ Jamfile.v2.b	2014-03-18 15:44:18.098748400 +0100
@@ -312,17 +312,6 @@
      <address-model>32
      <architecture>x86
      <binary-format>mach-o
-     <toolset>darwin
-   ;
-
-alias asm_context_sources
-   : asm/make_i386_sysv_macho_gas.S
-     asm/jump_i386_sysv_macho_gas.S
-   : <abi>sysv
-     <address-model>32
-     <architecture>x86
-     <binary-format>mach-o
-     <toolset>clang
    ;
 
 alias asm_context_sources
@@ -362,17 +351,6 @@
      <address-model>64
      <architecture>x86
      <binary-format>mach-o
-     <toolset>darwin
-   ;
-
-alias asm_context_sources
-   : asm/make_x86_64_sysv_macho_gas.S
-     asm/jump_x86_64_sysv_macho_gas.S
-   : <abi>sysv
-     <address-model>64
-     <architecture>x86
-     <binary-format>mach-o
-     <toolset>clang
    ;
 
 alias asm_context_sources

comment:14 by anonymous, 9 years ago

does the lib compile for clang and darwin with this modification too?

comment:15 by class101 <ad@…>, 9 years ago

For clang yes I can confirm it works for

toolset=clang-darwin target-os=darwin address-model=64 architecture=x86 toolset=clang-darwin target-os=darwin address-model=32 architecture=x86 toolset=clang-darwin target-os=darwin address-model=32_64 architecture=x86

toolset=gcc target-os=darwin linker-type=darwin address-model=64 architecture=x86 (gcc-4.2.1) toolset=gcc target-os=darwin linker-type=darwin address-model=32 architecture=x86 (gcc-4.2.1)

toolset=gcc target-os=linux address-model=64 architecture=x86 (gcc-4.8.2) toolset=gcc target-os=linux address-model=32 architecture=x86 (gcc-4.8.2)

toolset=gcc target-os=windows address-model=64 architecture=x86 (gcc-4.8.2) toolset=gcc target-os=windows address-model=32 architecture=x86 (gcc-4.8.2)

I could not test your set toolset=darwin because this set assumes it's a gcc supporting the -arch flag but the gcc-4.2.1 I have is gcc-5666.3 and -arch is unrecognized on this one, this is why I have to use toolset=gcc + <linker-type>darwin to work around this problem

comment:16 by class101 <ad@…>, 9 years ago

For clang yes I can confirm it works for

toolset=clang-darwin target-os=darwin address-model=64 architecture=x86
toolset=clang-darwin target-os=darwin address-model=32 architecture=x86 
toolset=clang-darwin target-os=darwin address-model=32_64 architecture=x86

toolset=gcc target-os=darwin linker-type=darwin address-model=64 architecture=x86 (gcc-4.2.1)
toolset=gcc target-os=darwin linker-type=darwin address-model=32 architecture=x86 (gcc-4.2.1)

toolset=gcc target-os=linux address-model=64 architecture=x86 (gcc-4.8.2)
toolset=gcc target-os=linux address-model=32 architecture=x86 (gcc-4.8.2)

toolset=gcc target-os=windows address-model=64 architecture=x86 (gcc-4.8.2)
toolset=gcc target-os=windows address-model=32 architecture=x86 (gcc-4.8.2)

I could not test your set toolset=darwin because this set assumes it's a gcc supporting the -arch flag but the gcc-4.2.1 I have is gcc-5666.3 and -arch is unrecognized on this one, this is why I have to use toolset=gcc + <linker-type>darwin to work around this problem

comment:17 by class101 <ad@…>, 9 years ago

I'm trying deeper with an untested set

toolset=gcc target-os=darwin linker-type=darwin address-model=32_64 architecture=x86 (gcc-4.2.1)

but this one doesn't seem to work, the produced libs are not multiarch, been searching around it seems someone works around with lipo but not sure it is worth working on this, anyway just sharing my links if you are interested in looking to gcc-5666.3 (4.2.1) and combined support: http://www.implbits.com/About/Blog/tabid/78/post/building-with-gcc-4-6-on-osx/Default.aspx

I doubt I will be using multiarch libs here anyway, I prefer to stick with gcc for all the three targeted arch rather than switching to clang just for the purpose of using multiarch

Anyway let me know if you happen to need so test build here I have compilers ready here

comment:18 by class101 <ad@…>, 9 years ago

little correction

I realized gcc-5666.3 supports -arch

http://opensource.apple.com/source/gcc/gcc-5666.3/driverdriver.c

Administrator@WIN81PRO /x/libs/
$ gcc -arch i386 -arch x86_64
x86_64-apple-darwin10-gcc.exe: no input files

Administrator@WIN81PRO /x/libs/
$ g++ -arch i386 -arch x86_64
x86_64-apple-darwin10-g++.exe: no input files

will investigate then why I'm getting the -arch is unrecognized with toolset=darwin tomorrow and let you know

comment:19 by class101 <ad@…>, 9 years ago

toolset=darwin is not suitable to the gcc-5666.3 I have here

    "X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/ar.exe" -static -o "bin.v2/libs/context/build/darwin-4.2.1/release/abi-sysv/address-model-64/binary-format-mach-o/link-static/pch-off/strip-on/target-os-darwi
n/threadapi-pthread/threading-multi/libboost_context-xgcc42-mt-1_56.a"    "bin.v2/libs/context/build/darwin-4.2.1/release/abi-sysv/address-model-64/binary-format-mach-o/link-static/pch-off/strip-on/target-os-
darwin/threadapi-pthread/threading-multi/asm/make_x86_64_sysv_macho_gas.o" "bin.v2/libs/context/build/darwin-4.2.1/release/abi-sysv/address-model-64/binary-format-mach-o/link-static/pch-off/strip-on/target-os
-darwin/threadapi-pthread/threading-multi/asm/jump_x86_64_sysv_macho_gas.o"

only one of -a and -[bi] options allowed
usage:  ar -d [-TLsv] archive file ...
        ar -m [-TLsv] archive file ...
        ar -m [-abiTLsv] position archive file ...
        ar -p [-TLsv] archive [file ...]
        ar -q [-cTLsv] archive file ...
        ar -r [-cuTLsv] archive file ...
        ar -r [-abciuTLsv] position archive file ...
        ar -t [-TLsv] archive [file ...]
        ar -x [-ouTLsv] archive [file ...]
...failed darwin.archive bin.v2\libs\context\build\darwin-4.2.1\release\abi-sysv\address-model-64\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi\libboost_
context-xgcc42-mt-1_56.a...
...failed updating 1 target...
...updated 18 targets...

Well anyway as this is a very old version I'm fine using toolset=gcc + <linker-type>darwin, it works fine for 32-bit, 64-bit, what it misses maybe a a toolset like toolset=gcc5663 to not require the need of setting <linker-type>darwin in a jam file

I will let you know if I can get a 32_64 build under gcc5666 working

comment:20 by class101 <ad@…>, 9 years ago

and gcc-5666.3 with -arch returns

    "X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/gcc.exe"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -arch x86_64 -w -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE -DNDEBUG  -I"." -c -o "bin
.v2\libs\context\build\gcc-4.2.1\release\abi-sysv\address-model-32_64\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi\unsupported.o" "libs\context\src\unsu
pported.cpp"

cc1plus.exe: error: unrecognized command line option "-arch"
...failed gcc.compile.c++ bin.v2\libs\context\build\gcc-4.2.1\release\abi-sysv\address-model-32_64\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi\unsuppor
ted.o...
...skipped <pbin.v2\libs\context\build\gcc-4.2.1\release\abi-sysv\address-model-32_64\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi>libboost_context-gcc4
2-mt-1_56.a for lack of <pbin.v2\libs\context\build\gcc-4.2.1\release\abi-sysv\address-model-32_64\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi>unsuppor
ted.o...
...failed updating 1 target...
...skipped 1 target...
...updated 14 targets...

I think it is a specific issue to my gcc-5666.3 cross compiler because I have used Ray Donnely's crosstool-ng to build it and I see he made patches to the driverdriver.c file so maybe something went wrong with such patch.

Will look with him if we eventually can get this fixed

comment:21 by class101 <ad@…>, 9 years ago

OK Finally

Disregard my error on gcc-5666.3 and 32_64, it is technically a known issue with the cross compiler, here is my may to Ray

Hi Ray,

While compiling boost I think I have found an issue in gcc-5666.3

It compiles fine the 32-bit or 64-bit libs separately

but when attempting to use Apple's argument to build a fat lib -arch
i386 -arch x86_64

I'm getting

    "X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/g++.exe"
-ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -arch
x86_64 -w -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE -DNDEBUG  -I"." -c
-o
"bin.v2\libs\context\build\gcc-4.2.1\release\abi-sysv\address-model-32_64\binary-format-mach-o\link-static\pch-off\strip-on\target-os-darwin\threadapi-pthread\threading-multi\unsupported.o"
"libs\context\src\unsupported.cpp"

cc1plus.exe: error: unrecognized command line option "-arch"

Is rejected by cc1plus.exe but when you try
"X:/libs/gcc-5666.3-x86_64-apple-darwin10/bin/g++.exe" -arch alone it
does not complain of an unknown parameter

As I see you have made patches on driverdriver.c with
5666.3/130-relocatable.patch maybe do you have an idea what could cause this

Ray

Yeah, this is a known issue, and you have got close to identifying the cause.

Basically we don't use driverdriver.c in ctng (my old toolchain4
project did use it though!)

If you look here:
  https://github.com/mingwandroid/toolchain4/blob/master/toolchain.sh#L1380

.. you can see how I compiled it in that project.

.. but really I want to (and started to) make the Autotools/Makefile
system in Apple's GCC build it automatically the way it should be
done.

.. but also, since GCC is fast becoming deprecated in the Apple world,
I wonder if I'll ever get round to that .. quite likely I wont.

So in short with a gcc-5666.3 crosscompiler, stick with toolset=gcc <linker-type>darwin and the patch in comment#13 and all is fine

comment:22 by olli, 9 years ago

Resolution: fixed
Status: reopenedclosed

commit pushed to branch develop - please verify (for merge with branch master required) and report, thx

PS: if possible please test it for universal build and combined architectures too

Last edited 9 years ago by olli (previous) (diff)

comment:23 by class101 <ad@…>, 9 years ago

I dont get you with (for merge with branch master required)

I got this on the develop branch

git.exe submodule update --init

Submodule path 'libs/atomic': checked out 'c56a76c0841b52ae1b962d1e4fc3e723b5d574ce'
Submodule path 'libs/log': checked out '7513db8bfe2fe4b33ef2e9d73635fce38d7840e9'

Success (47344 ms @ 19/03/2014 17:18:26)

comment:24 by class101 <ad@…>, 9 years ago

nvm I think I got it I do (correct me if I'm wrong Im not very familiar with git)

git checkout develop
git branch -vv
git pull
git submodule update --init

and then switching to master

git checkout master
git branch -vv
git pull
git submodule update --init

comment:25 by class101 <ad@…>, 9 years ago

For me all is ok on develop - a28a807afe362440a75e18acbd716a9d0ac57323

cross-compiled all these builds without problems

toolset=clang-darwin target-os=darwin address-model=64 architecture=x86 (clang-3.4)
toolset=clang-darwin target-os=darwin address-model=32 architecture=x86 (clang-3.4)
toolset=clang-darwin target-os=darwin address-model=32_64 architecture=x86 (clang-3.4)

toolset=gcc target-os=darwin linker-type=darwin address-model=64 architecture=x86 (gcc-5666.3-4.2.1)
toolset=gcc target-os=darwin linker-type=darwin address-model=32 architecture=x86 (gcc-5666.3-4.2.1)

toolset=gcc target-os=linux address-model=64 architecture=x86 (gcc-4.8.2)
toolset=gcc target-os=linux address-model=32 architecture=x86 (gcc-4.8.2)

toolset=gcc target-os=windows address-model=64 architecture=x86 (gcc-4.8.2)
toolset=gcc target-os=windows address-model=32 architecture=x86 (gcc-4.8.2)

comment:26 by olli, 9 years ago

OK, thx - will merge to branch master

comment:27 by class101 <ad@…>, 9 years ago

what is the difference between master and develop ? Is the develop branch where all days commits are made and the master is a much stabler branch where you merge verified things from the develop branch right ?

comment:28 by anonymous, 8 years ago

PPC/x86 - 32-64 was tested both with both clang-apple and gcc-apple

Toolsets are different from the vanilla gcc.

comment:29 by marco.serantoni@…, 8 years ago

10.9.1 - uses clang 
10.6.8 - uses gcc

in reply to:  28 comment:30 by olli, 8 years ago

Replying to anonymous:

PPC/x86 - 32-64 was tested both with both clang-apple and gcc-apple

Toolsets are different from the vanilla gcc.

architectures universal (32_64) and combined enabled for PPC in branch develop and master

Note: See TracTickets for help on using tickets.